1
This commit is contained in:
@ -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']),
|
||||
|
||||
@ -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']),
|
||||
// 是否显示提示
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user