饼图数据默认,饼图数据计算方式调整
This commit is contained in:
@@ -260,49 +260,39 @@ watch(
|
|||||||
const pieRef1 = ref(),
|
const pieRef1 = ref(),
|
||||||
pieRef2 = ref(),
|
pieRef2 = ref(),
|
||||||
pieRef3 = ref();
|
pieRef3 = ref();
|
||||||
const changeSelect = () => {
|
|
||||||
console.log(form.value.activeTabs);
|
|
||||||
//getPieData();
|
|
||||||
};
|
|
||||||
const chartsData1: any = ref([]),
|
const chartsData1: any = ref([]),
|
||||||
chartsData2: any = ref([]),
|
chartsData2: any = ref([]),
|
||||||
chartsData3: any = ref([]);
|
chartsData3: any = ref([]);
|
||||||
const getPieData = async (id: string) => {
|
const getPieData = async (id: string) => {
|
||||||
console.log('饼图变了');
|
|
||||||
currentId.value = id; // 设置当前ID
|
currentId.value = id; // 设置当前ID
|
||||||
//handleCheckFunction(0)//切换左侧树,默认css功能是设备检测
|
//handleCheckFunction(0)//切换左侧树,默认css功能是设备检测
|
||||||
const boundPqDevList=ref<Device.ResPqDev[]>([])//根据检测计划id查询出所有已绑定的设备
|
|
||||||
const pqDevList_Result2 = await getBoundPqDevList({'planId': id,'checkStateList':[0,1,2,3]});
|
|
||||||
|
|
||||||
boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[];
|
|
||||||
console.log('饼图列',boundPqDevList)
|
|
||||||
// 初始化计数对象
|
// 初始化计数对象
|
||||||
const checkStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0, 3: 0 };
|
const checkStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0, 3: 0 };
|
||||||
|
const checkResultCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 };
|
||||||
|
const reportStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 };
|
||||||
|
if (id) {
|
||||||
|
const boundPqDevList = ref<Device.ResPqDev[]>([])//根据检测计划id查询出所有已绑定的设备
|
||||||
|
const pqDevList_Result2 = await getBoundPqDevList({'planId': id, 'checkStateList': [0, 1, 2, 3]});
|
||||||
|
boundPqDevList.value = pqDevList_Result2.data as Device.ResPqDev[];
|
||||||
// 遍历 boundPqDevList 并更新计数对象
|
// 遍历 boundPqDevList 并更新计数对象
|
||||||
boundPqDevList.value.forEach(t => {
|
boundPqDevList.value.forEach(t => {
|
||||||
if (t.checkState !== undefined && t.checkState !== null && checkStateCount[t.checkState] !== undefined) {
|
if (t.checkState !== undefined && t.checkState !== null && checkStateCount[t.checkState] !== undefined) {
|
||||||
checkStateCount[t.checkState]++;
|
checkStateCount[t.checkState]++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
console.log("Check", checkStateCount)
|
|
||||||
|
|
||||||
// 统计检测结果的数量
|
|
||||||
const checkResultCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 };
|
|
||||||
boundPqDevList.value.forEach(t => {
|
boundPqDevList.value.forEach(t => {
|
||||||
if (t.checkResult !== undefined && t.checkResult !== null && checkResultCount[t.checkResult] !== undefined) {
|
if (t.checkResult !== undefined && t.checkResult !== null && checkResultCount[t.checkResult] !== undefined) {
|
||||||
checkResultCount[t.checkResult]++;
|
checkResultCount[t.checkResult]++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//报告状态
|
|
||||||
const reportStateCount: { [key: number]: number } = { 0: 0, 1: 0, 2: 0 };
|
|
||||||
boundPqDevList.value.forEach(t => {
|
boundPqDevList.value.forEach(t => {
|
||||||
if (t.reportState !== undefined && t.reportState !== null && reportStateCount[t.reportState] !== undefined) {
|
if (t.reportState !== undefined && t.reportState !== null && reportStateCount[t.reportState] !== undefined) {
|
||||||
reportStateCount[t.reportState]++;
|
reportStateCount[t.reportState]++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
chartsData1.value = [
|
chartsData1.value = [
|
||||||
{ value: checkStateCount[0], name: "未检", itemStyle: { color: '#fac858' } },
|
{ value: checkStateCount[0], name: "未检", itemStyle: { color: '#fac858' } },
|
||||||
@@ -345,7 +335,6 @@ const planDetail = () => {
|
|||||||
};
|
};
|
||||||
//功能选择css切换
|
//功能选择css切换
|
||||||
const handleCheckFunction = (val: any) => {
|
const handleCheckFunction = (val: any) => {
|
||||||
|
|
||||||
editableTabsValue.value = '0';
|
editableTabsValue.value = '0';
|
||||||
form.value.activeChildTabs = 0;
|
form.value.activeChildTabs = 0;
|
||||||
tabsList.value.map((item: any, index: any) => {
|
tabsList.value.map((item: any, index: any) => {
|
||||||
@@ -422,8 +411,6 @@ onBeforeMount(async () => {
|
|||||||
code: 0,
|
code: 0,
|
||||||
state: 0
|
state: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
// debugger;
|
|
||||||
const planList = await getPlanListByPattern(reqPlan);
|
const planList = await getPlanListByPattern(reqPlan);
|
||||||
if (planList.data[0].children[0]) {
|
if (planList.data[0].children[0]) {
|
||||||
currentId.value = planList.data[0].children[0].id;
|
currentId.value = planList.data[0].children[0].id;
|
||||||
@@ -432,8 +419,8 @@ onBeforeMount(async () => {
|
|||||||
resizeObserver.observe(chartsInfoRef.value);
|
resizeObserver.observe(chartsInfoRef.value);
|
||||||
}
|
}
|
||||||
getTree(planList.data);
|
getTree(planList.data);
|
||||||
console.log('挂载')
|
|
||||||
//getPieData('');
|
getPieData(currentId.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user