diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index fdb4562..779f01d 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -107,7 +107,7 @@ const props = defineProps({ // 数量限制 limit: propTypes.number.def(5), // 大小限制(MB) - fileSize: propTypes.number.def(5), + fileSize: propTypes.number.def(10), // 文件类型, 例如['png', 'jpg', 'jpeg'] // fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf', 'png', 'jpg', 'jpeg', 'zip']), fileType: propTypes.array.def(['pdf']), diff --git a/src/components/ImageUpload/index.vue b/src/components/ImageUpload/index.vue index 3a7a0ed..ef092ef 100644 --- a/src/components/ImageUpload/index.vue +++ b/src/components/ImageUpload/index.vue @@ -56,7 +56,7 @@ const props = defineProps({ // 图片数量限制 limit: propTypes.number.def(5), // 大小限制(MB) - fileSize: propTypes.number.def(5), + fileSize: propTypes.number.def(10), // 文件类型, 例如['png', 'jpg', 'jpeg'] fileType: propTypes.array.def(['png', 'jpg', 'jpeg']), // 是否显示提示 diff --git a/src/views/enterpriseLarge/digitalizationScreen/components/optionList.ts b/src/views/enterpriseLarge/digitalizationScreen/components/optionList.ts index e05f29e..ecc521c 100644 --- a/src/views/enterpriseLarge/digitalizationScreen/components/optionList.ts +++ b/src/views/enterpriseLarge/digitalizationScreen/components/optionList.ts @@ -47,7 +47,7 @@ export let pieOption = { alignTo: 'edge', formatter: function (params) { // 只显示前三个数据项 - return `{name|${params.data.name}}\n{percent|${params.data.completionRate}MW}`; + return `{name|${params.data.name}}\n{percent|${(params.data.completionRate / 100).toFixed(2)}%}`; }, minMargin: 10, edgeDistance: 20, diff --git a/src/views/enterpriseLarge/digitalizationScreen/components/rightPage.vue b/src/views/enterpriseLarge/digitalizationScreen/components/rightPage.vue index fc291bc..62dac99 100644 --- a/src/views/enterpriseLarge/digitalizationScreen/components/rightPage.vue +++ b/src/views/enterpriseLarge/digitalizationScreen/components/rightPage.vue @@ -111,17 +111,18 @@ const getData = async () => { if (res.code == 200) { capacityData.value = res.data; // processedDataList.value = res.data.projectProgressDetailList; - let totalCapacity = 0; - const processedData = res.data.projectProgressDetailList.map((item) => { - const capacity = parseInt(item.projectCapacity) || 0; - totalCapacity += capacity; - return { - name: item.projectName, - value: capacity, - completionRate: item.completionRate - }; - }); + // let totalCapacity = 0; + // const processedData = res.data.projectProgressDetailList.map((item) => { + // const capacity = parseInt(item.projectCapacity) || 0; + // totalCapacity += capacity; + // return { + // name: item.projectName, + // value: capacity, + // completionRate: item.completionRate + // }; + // }); +<<<<<<< HEAD // 计算每个项目的百分比 processedData.forEach((item) => { item.percentage = totalCapacity > 0 ? ((item.value / totalCapacity) * 100).toFixed(2) : '0%'; @@ -129,6 +130,14 @@ const getData = async () => { processedDataList.value = processedData; console.log('🚀 ~ getData ~ processedDataList.value :', processedDataList.value); initPieChart(); +======= + // // 计算每个项目的百分比 + // processedData.forEach((item) => { + // item.percentage = totalCapacity > 0 ? ((item.value / totalCapacity) * 100).toFixed(2) : '0%'; + // }); + // processedDataList.value = processedData; + // initPieChart(); +>>>>>>> l-origin/ljx } }; // 初始化饼图 @@ -160,6 +169,24 @@ const getOutputData = async () => { designAreaData.value = res.data.map((item: any) => Number((item.plannedCapacity * item.progressPercentage) / 100)); transferAreaData.value = res.data.map((item: any) => Number(item.plannedCapacity)); barNames.value = res.data.map((item: any) => item.projectName); + let totalCapacity = 0; + const processedData = res.data.map((item) => { + const capacity = item.plannedCapacity * item.progressPercentage || 0; + totalCapacity += capacity; + return { + name: item.projectName, + value: capacity, + completionRate: item.progressPercentage + }; + }); + + // 计算每个项目的百分比 + processedData.forEach((item) => { + item.percentage = totalCapacity > 0 ? ((item.value / totalCapacity) * 100).toFixed(2) : '0%'; + }); + + processedDataList.value = processedData; + initPieChart(); initLineChart(); } };