This commit is contained in:
sjl
2025-01-13 18:12:36 +08:00
parent 85d8a57bf7
commit 0635dda6a0
15 changed files with 205 additions and 81 deletions

View File

@@ -300,22 +300,31 @@ const getPieData = async (id: string) => {
})
}
chartsData1.value = [
{ value: checkStateCount[0], name: '未检', itemStyle: { color: '#fac858' } },
{ value: checkStateCount[1], name: '检测中', itemStyle: { color: '#ee6666' } },
{ value: checkStateCount[2], name: '检测完成', itemStyle: { color: '#91cc75' } },
{ value: checkStateCount[3], name: '归档', itemStyle: { color: '#5470c6' } },
]
chartsData2.value = [
{ value: checkResultCount[2], name: '未检', itemStyle: { color: '#fac858' } },
{ value: checkResultCount[0], name: '不符合', itemStyle: { color: '#ee6666' } },
{ value: checkResultCount[1], name: '符合', itemStyle: { color: '#91cc75' } },
]
chartsData3.value = [
{ value: reportStateCount[2], name: '未检', itemStyle: { color: '#fac858' } },
{ value: reportStateCount[0], name: '未生成', itemStyle: { color: '#ee6666' } },
{ value: reportStateCount[1], name: '已生成', itemStyle: { color: '#91cc75' } },
]
// 检查 checkStateCount 是否全为 0
const allZero = Object.values(checkStateCount).every(count => count === 0);
chartsData1.value = [
{ value: allZero ? 0 : checkStateCount[0] === 0 ? null : checkStateCount[0], name: '检', itemStyle: { color: '#fac858' } },
{ value: allZero ? 0 : checkStateCount[1] === 0 ? null : checkStateCount[1], name: '检测中', itemStyle: { color: '#ee6666' } },
{ value: allZero ? 0 : checkStateCount[2] === 0 ? null : checkStateCount[2], name: '检测完成', itemStyle: { color: '#91cc75' } },
{ value: allZero ? 0 : checkStateCount[3] === 0 ? null : checkStateCount[3], name: '归档', itemStyle: { color: '#5470c6' } },
];
// 同样处理 chartsData2 和 chartsData3
const allZeroResult = Object.values(checkResultCount).every(count => count === 0);
chartsData2.value = [
{ value: allZeroResult ? 0 : checkResultCount[2] === 0 ? null : checkResultCount[2], name: '未检', itemStyle: { color: '#fac858' } },
{ value: allZeroResult ? 0 : checkResultCount[0] === 0 ? null : checkResultCount[0], name: '不符合', itemStyle: { color: '#ee6666' } },
{ value: allZeroResult ? 0 : checkResultCount[1] === 0 ? null : checkResultCount[1], name: '符合', itemStyle: { color: '#91cc75' } },
];
// 检查 reportStateCount 是否全为 0
const allZeroReport = Object.values(reportStateCount).every(count => count === 0);
chartsData3.value = [
{ value: allZeroReport ? 0 : reportStateCount[2] === 0 ? null : reportStateCount[2], name: '未检', itemStyle: { color: '#fac858' } },
{ value: allZeroReport ? 0 : reportStateCount[0] === 0 ? null : reportStateCount[0], name: '未生成', itemStyle: { color: '#ee6666' } },
{ value: allZeroReport ? 0 : reportStateCount[1] === 0 ? null : reportStateCount[1], name: '已生成', itemStyle: { color: '#91cc75' } },
];
pieRef1.value.init()
pieRef2.value.init()