提交
This commit is contained in:
@ -110,23 +110,23 @@ 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
|
||||
// };
|
||||
// });
|
||||
|
||||
// 计算每个项目的百分比
|
||||
processedData.forEach((item) => {
|
||||
item.percentage = totalCapacity > 0 ? ((item.value / totalCapacity) * 100).toFixed(2) : '0%';
|
||||
});
|
||||
processedDataList.value = processedData;
|
||||
initPieChart();
|
||||
// // 计算每个项目的百分比
|
||||
// processedData.forEach((item) => {
|
||||
// item.percentage = totalCapacity > 0 ? ((item.value / totalCapacity) * 100).toFixed(2) : '0%';
|
||||
// });
|
||||
// processedDataList.value = processedData;
|
||||
// initPieChart();
|
||||
}
|
||||
};
|
||||
// 初始化饼图
|
||||
@ -158,6 +158,25 @@ 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%';
|
||||
});
|
||||
console.log(processedData, 55555555);
|
||||
|
||||
processedDataList.value = processedData;
|
||||
initPieChart();
|
||||
initLineChart();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user