From 080a051e1761b2beb2475e0393cdb2d4c7c902bb Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期一, 25 十二月 2023 16:11:02 +0800
Subject: [PATCH] 统计分析删除请求优化
---
Source/UBCS-WEB/src/views/statistic/statisticPage.vue | 48 ++++++++++++++++++++----------------------------
1 files changed, 20 insertions(+), 28 deletions(-)
diff --git a/Source/UBCS-WEB/src/views/statistic/statisticPage.vue b/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
index 9e69921..ad00025 100644
--- a/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
+++ b/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
@@ -130,7 +130,7 @@
try {
const firstResponse = await getBtmAndChart();
this.ResponseData = await getBtmAndChart();
- this.loading = false;
+ console.log(firstResponse)
const btmNames = Object.keys(firstResponse.data.data).join(',');
const btmValue = Object.values(firstResponse.data.data);
if (!btmNames) {
@@ -138,36 +138,23 @@
this.pieList = [];
this.columnarList = [];
this.mixList = [];
+ this.loading = false;
return;
}
- for (const value of btmValue) {
- if (value.includes('0')) {
- await this.handleStatisticAnalysis('lineList', btmNames, firstResponse);
- } else {
- this.lineList = [];
- }
- if (value.includes('1')) {
- await this.handleStatisticAnalysis('pieList', btmNames, firstResponse);
- } else {
- this.pieList = [];
- }
- if (value.includes('2')) {
- await this.handleStatisticAnalysis('columnarList', btmNames, firstResponse);
- } else {
- this.columnarList = [];
- }
- if (value.includes('3')) {
- await this.handleStatisticAnalysis('mixList', btmNames, firstResponse);
- } else {
- this.mixList = [];
- }
- }
+ const typeList = {
+ '0': 'lineList',
+ '1': 'pieList',
+ '2': 'columnarList',
+ '3': 'mixList'
+ };
+ await this.handleStatisticAnalysis(btmNames, firstResponse);
+ this.loading = false;
} catch (error) {
this.loading = false;
console.error('Error:', error);
}
},
- async handleStatisticAnalysis(type, btmNames, firstResponse) {
+ async handleStatisticAnalysis(btmNames, firstResponse) {
const secondResponse = await getStatisticAnalysis({btmNames});
const secondData = secondResponse.data.data;
const typeList = {
@@ -176,6 +163,10 @@
"2": "columnarList",
"3": "mixList"
};
+ this.lineList = [];
+ this.pieList = [];
+ this.columnarList = [];
+ this.mixList = [];
const firstData = firstResponse.data.data;
//Object.keys瀵艰嚧瀵硅薄椤哄簭涓嶄竴鑷达紝浣跨敤sort鎺掑簭涓庡悗绔繑鍥炴牸寮忎竴鑷�
Object.keys(firstData).sort().forEach((key, index) => {
@@ -187,10 +178,9 @@
return {
menuData: record.menuData,
menuName: record.menuName,
- btmname: key
+ btmname: key
};
});
- this[listType] = [];
this.$nextTick(() => {
list.forEach((i, j) => {
if (index === j) {
@@ -199,6 +189,8 @@
});
});
}
+ } else {
+ console.log('else')
}
});
},
@@ -234,12 +226,12 @@
this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
return;
}
- let codeStatus = this.selectData.every(key => key.codeType)
+ let codeStatus = this.selectData.every(key => key.codeType.length > 0);
+
if (!codeStatus) {
this.$message.warning("璇锋鏌ュ凡鍕鹃�夋暟鎹被鍨嬫槸鍚︿负绌猴紒");
return;
}
-
const newArray = this.selectData.map(item => {
return {
btmname: item.code,
--
Gitblit v1.9.3