|
@@ -1,95 +1,19 @@
|
|
|
<template>
|
|
|
<div class="screen-common-component">
|
|
|
- <ScreenComHeader :module-id="moduleId" title="不合格产品分布" />
|
|
|
- <div ref="chartRef" class="charts-container"></div>
|
|
|
+ <ScreenComHeader :module-id="moduleId" title="剔除列表分布" />
|
|
|
+ <dv-scroll-board
|
|
|
+ :config="config"
|
|
|
+ style="width: 100%; height: calc(100% - 32px)"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
import ScreenComHeader from "@/views/screens/configs/screenComHeader.vue";
|
|
|
-import * as echarts from "echarts";
|
|
|
-import { allChartColors } from "@/views/screens/configs/chartsConfig";
|
|
|
import { unqualifiedProduct } from "@/api/screens";
|
|
|
const bigScreenData: any = inject("bigScreenData");
|
|
|
-const chartRef = ref(null);
|
|
|
|
|
|
-const gernerateOptionsWithData = (
|
|
|
- data: any,
|
|
|
- centerText: string,
|
|
|
- unitText: string
|
|
|
-) => {
|
|
|
- const option = {
|
|
|
- color: allChartColors,
|
|
|
- backgroundColor: "transparent",
|
|
|
- title: {
|
|
|
- show: false,
|
|
|
- },
|
|
|
- textStyle: {
|
|
|
- fontSize: bigScreenData.value.fontSize * 1.8,
|
|
|
- },
|
|
|
- tooltip: {
|
|
|
- trigger: "item",
|
|
|
- formatter: "{a} <br/>{b} : {c} ({d}%)",
|
|
|
- textStyle: {
|
|
|
- fontSize: bigScreenData.value.fontSize * 1.8,
|
|
|
- },
|
|
|
- },
|
|
|
- legend: {
|
|
|
- type: "scroll",
|
|
|
- orient: "vertical",
|
|
|
- right: 10,
|
|
|
- top: 20,
|
|
|
- bottom: 20,
|
|
|
- data: data.legendData,
|
|
|
- },
|
|
|
- series: [
|
|
|
- {
|
|
|
- name: "占比",
|
|
|
- type: "pie",
|
|
|
- radius: ["40%", "50%"],
|
|
|
- center: ["40%", "50%"],
|
|
|
- data: data.seriesData,
|
|
|
- // emphasis: {
|
|
|
- // itemStyle: {
|
|
|
- // shadowBlur: 10,
|
|
|
- // shadowOffsetX: 0,
|
|
|
- // shadowColor: "rgba(0, 0, 0, 0.5)",
|
|
|
- // },
|
|
|
- // },
|
|
|
- label: {
|
|
|
- normal: {
|
|
|
- formatter: centerText + "\n" + unitText, // 显示数据标签,格式化为:名称\n百分比
|
|
|
- position: "center", // 标签的位置在饼图的中心
|
|
|
- textStyle: {
|
|
|
- fontSize: bigScreenData.value.fontSize * 2.5, // 标签字体大小
|
|
|
- color: "#00BCD4", // 标签字体颜色
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- labelLine: {
|
|
|
- normal: {
|
|
|
- show: false, // 不显示标签线
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
- ],
|
|
|
- };
|
|
|
- return option;
|
|
|
-};
|
|
|
-onMounted(async () => {
|
|
|
- const chart = echarts.init(chartRef.value, "dark");
|
|
|
- let res = await unqualifiedProduct();
|
|
|
- let data = {
|
|
|
- legendData: res?.data?.list.map((item: any) => item.name) ?? [],
|
|
|
- seriesData: res?.data?.list ?? [],
|
|
|
- };
|
|
|
-
|
|
|
- if (res?.data?.list?.length > 0) {
|
|
|
- chart.setOption(
|
|
|
- gernerateOptionsWithData(data, res?.data?.total ?? 0, "件", "个")
|
|
|
- );
|
|
|
- }
|
|
|
-});
|
|
|
+const config = ref({});
|
|
|
|
|
|
const props = defineProps({
|
|
|
moduleId: {
|
|
@@ -97,4 +21,48 @@ const props = defineProps({
|
|
|
required: true,
|
|
|
},
|
|
|
});
|
|
|
+
|
|
|
+const loadData = async () => {
|
|
|
+ let res = await unqualifiedProduct(4);
|
|
|
+ if (res.data.length > 0) {
|
|
|
+ let dicts = {
|
|
|
+ workOrderCode: `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>生产批号</span>`,
|
|
|
+ materialModel: `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>物料型号</span>`,
|
|
|
+ stage: `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>工序类型</span>`,
|
|
|
+ total: `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>数量</span>`,
|
|
|
+ updated: `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px'>时间</span>`,
|
|
|
+ };
|
|
|
+ let bigData: any[] = [];
|
|
|
+ res.data.forEach((item: any) => {
|
|
|
+ const rowStyle = `
|
|
|
+ ${item.state === "0" ? "color: yellow;" : ""} `;
|
|
|
+ let row = [
|
|
|
+ `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px;'>${item.workOrderCode}</span>`,
|
|
|
+ `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px;'>${item.materialModel}</span>`,
|
|
|
+ `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px;'>${item.stage}</span>`,
|
|
|
+ `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px;'>${item.total}</span>`,
|
|
|
+ `<span style='font-size:${bigScreenData.value.fontSize * 1.5}px;'>${item.updated}</span>`,
|
|
|
+ ];
|
|
|
+ bigData.push(row);
|
|
|
+ });
|
|
|
+
|
|
|
+ config.value = {
|
|
|
+ header: Object.values(dicts),
|
|
|
+ data: bigData,
|
|
|
+ index: true,
|
|
|
+ rowNum: 10,
|
|
|
+ // columnWidth: [50, 130, 160, 160, 120, 160, 120],
|
|
|
+ columnWidth: [50],
|
|
|
+ align: ["center"],
|
|
|
+ carousel: "single",
|
|
|
+ };
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+onMounted(async () => {
|
|
|
+ loadData();
|
|
|
+ const timer = setInterval(loadData, 60 * 5 * 1000);
|
|
|
+ // 组件卸载时清除定时器
|
|
|
+ onUnmounted(() => clearInterval(timer));
|
|
|
+});
|
|
|
</script>
|