|
@@ -117,7 +117,9 @@ function handleSave() {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
+function sortDataByDateAsc(rawData) {
|
|
|
+ return rawData.slice().sort((a, b) => new Date(a.date) - new Date(b.date));
|
|
|
+}
|
|
|
function updateChart(monthlyData, displayMonths, selectedYear, currentYear){
|
|
|
echartInstance.value.setOption({
|
|
|
title: { text: '工艺图纸电子化率' },
|
|
@@ -132,12 +134,13 @@ function updateChart(monthlyData, displayMonths, selectedYear, currentYear){
|
|
|
const month = displayMonths[monthIndex];
|
|
|
let requiredDocumentsThisMonth = 0;
|
|
|
var uploadedProducts = 0;
|
|
|
+ const sortedData = sortDataByDateAsc(rawData.value);
|
|
|
if(selectedYear<2024){
|
|
|
requiredDocumentsThisMonth = 0
|
|
|
- }else if (rawData.value[(monthIndex-2)]) {
|
|
|
+ }else if (sortedData[(monthIndex-2)]) {
|
|
|
|
|
|
- requiredDocumentsThisMonth = rawData.value[(monthIndex-2)].number;
|
|
|
- }else if ((selectedYear > 2023 || (selectedYear === 2024 && monthIndex >= 2)) && !rawData.value[monthIndex]) {
|
|
|
+ requiredDocumentsThisMonth = sortedData[(monthIndex-2)].number;
|
|
|
+ }else if ((selectedYear > 2023 || (selectedYear === 2024 && monthIndex >= 2)) && !sortedData[monthIndex]) {
|
|
|
requiredDocumentsThisMonth = 100; // 2024年3月及以后默认值为100
|
|
|
}
|
|
|
|
|
@@ -167,8 +170,12 @@ function updateChart(monthlyData, displayMonths, selectedYear, currentYear){
|
|
|
}
|
|
|
const mes1 = conversion_mes.value[0].label;
|
|
|
const mes2 = conversion_mes.value[1].label ;
|
|
|
- console.log(mes1)
|
|
|
- return `${month}:${mes1}${requiredDocumentsThisMonth},${mes2}${uploadedProducts},电子化率:${rate}%`;
|
|
|
+ return `
|
|
|
+ ${month}:<br/>
|
|
|
+ ${mes1}${requiredDocumentsThisMonth},<br/>
|
|
|
+ ${mes2}${uploadedProducts},<br/>
|
|
|
+ 电子化率:${rate}%
|
|
|
+ `;
|
|
|
}
|
|
|
},
|
|
|
xAxis: {
|
|
@@ -219,7 +226,9 @@ function getList() {
|
|
|
const currentYear = new Date().getFullYear();
|
|
|
|
|
|
listConversion(selectedYear).then(res => {
|
|
|
+
|
|
|
rawData.value = res.data;
|
|
|
+ console.log(rawData.value)
|
|
|
number.value = res.data[0].number;
|
|
|
getProcuctDrawing().then(res => {
|
|
|
procuctDrawing.value = res.data;
|