1
This commit is contained in:
@ -107,7 +107,7 @@ const props = defineProps({
|
|||||||
// 数量限制
|
// 数量限制
|
||||||
limit: propTypes.number.def(5),
|
limit: propTypes.number.def(5),
|
||||||
// 大小限制(MB)
|
// 大小限制(MB)
|
||||||
fileSize: propTypes.number.def(5),
|
fileSize: propTypes.number.def(10),
|
||||||
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||||
// fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf', 'png', 'jpg', 'jpeg', 'zip']),
|
// fileType: propTypes.array.def(['doc', 'xls', 'ppt', 'txt', 'pdf', 'png', 'jpg', 'jpeg', 'zip']),
|
||||||
fileType: propTypes.array.def(['pdf']),
|
fileType: propTypes.array.def(['pdf']),
|
||||||
|
|||||||
@ -56,7 +56,7 @@ const props = defineProps({
|
|||||||
// 图片数量限制
|
// 图片数量限制
|
||||||
limit: propTypes.number.def(5),
|
limit: propTypes.number.def(5),
|
||||||
// 大小限制(MB)
|
// 大小限制(MB)
|
||||||
fileSize: propTypes.number.def(5),
|
fileSize: propTypes.number.def(10),
|
||||||
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||||
fileType: propTypes.array.def(['png', 'jpg', 'jpeg']),
|
fileType: propTypes.array.def(['png', 'jpg', 'jpeg']),
|
||||||
// 是否显示提示
|
// 是否显示提示
|
||||||
|
|||||||
@ -47,7 +47,7 @@ export let pieOption = {
|
|||||||
alignTo: 'edge',
|
alignTo: 'edge',
|
||||||
formatter: function (params) {
|
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,
|
minMargin: 10,
|
||||||
edgeDistance: 20,
|
edgeDistance: 20,
|
||||||
|
|||||||
@ -111,17 +111,18 @@ const getData = async () => {
|
|||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
capacityData.value = res.data;
|
capacityData.value = res.data;
|
||||||
// processedDataList.value = res.data.projectProgressDetailList;
|
// processedDataList.value = res.data.projectProgressDetailList;
|
||||||
let totalCapacity = 0;
|
// let totalCapacity = 0;
|
||||||
const processedData = res.data.projectProgressDetailList.map((item) => {
|
// const processedData = res.data.projectProgressDetailList.map((item) => {
|
||||||
const capacity = parseInt(item.projectCapacity) || 0;
|
// const capacity = parseInt(item.projectCapacity) || 0;
|
||||||
totalCapacity += capacity;
|
// totalCapacity += capacity;
|
||||||
return {
|
// return {
|
||||||
name: item.projectName,
|
// name: item.projectName,
|
||||||
value: capacity,
|
// value: capacity,
|
||||||
completionRate: item.completionRate
|
// completionRate: item.completionRate
|
||||||
};
|
// };
|
||||||
});
|
// });
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
// 计算每个项目的百分比
|
// 计算每个项目的百分比
|
||||||
processedData.forEach((item) => {
|
processedData.forEach((item) => {
|
||||||
item.percentage = totalCapacity > 0 ? ((item.value / totalCapacity) * 100).toFixed(2) : '0%';
|
item.percentage = totalCapacity > 0 ? ((item.value / totalCapacity) * 100).toFixed(2) : '0%';
|
||||||
@ -129,6 +130,14 @@ const getData = async () => {
|
|||||||
processedDataList.value = processedData;
|
processedDataList.value = processedData;
|
||||||
console.log('🚀 ~ getData ~ processedDataList.value :', processedDataList.value);
|
console.log('🚀 ~ getData ~ processedDataList.value :', processedDataList.value);
|
||||||
initPieChart();
|
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));
|
designAreaData.value = res.data.map((item: any) => Number((item.plannedCapacity * item.progressPercentage) / 100));
|
||||||
transferAreaData.value = res.data.map((item: any) => Number(item.plannedCapacity));
|
transferAreaData.value = res.data.map((item: any) => Number(item.plannedCapacity));
|
||||||
barNames.value = res.data.map((item: any) => item.projectName);
|
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();
|
initLineChart();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user