From d437a2e4733066e9815b8091e4d2444c291d22db Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 20 十二月 2023 19:22:53 +0800
Subject: [PATCH] 统计分析数据列表渲染

---
 Source/UBCS-WEB/src/views/statistic/statisticPage.vue |   52 +++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 39 insertions(+), 13 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/statistic/statisticPage.vue b/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
index 0369f5c..60ef14b 100644
--- a/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
+++ b/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
@@ -100,10 +100,12 @@
   },
   created() {
     this.getMasterList();
-    this.getEcharts();
     // deleteChartId({btmname:'zxssaac',chartId:'3'}).then(res=>{
     //   console.log('res',res)
     // })
+  },
+  mounted() {
+    this.getEcharts();
   },
   methods: {
     getMasterList() {
@@ -114,21 +116,46 @@
         this.$message.error(error)
       })
     },
-    getEcharts() {
-      getBtmAndChart().then(firstResponse => {
-        console.log('btm', firstResponse)
+    async getEcharts() {
+      try {
+        const firstResponse = await getBtmAndChart();
+        const typeList = {
+          "0": "lineList",
+          "1": "pieList",
+          "2": "columnarList",
+          "3": "mixList"
+        };
+
         const btmNames = Object.keys(firstResponse.data.data).join(',');
         const firstData = firstResponse.data.data;
-        Object.keys(firstData).forEach((item,index) => {
-          let firstIndex = firstData[item].split(',');
-          console.log('firstIndex',firstIndex);
-        });
+        console.log('firstData',firstData)
         if (btmNames) {
-          getStatisticAnalysis({btmNames}).then(secondResponse => {
-            console.log('getStatisticAnalysis', secondResponse)
+          const secondResponse = await getStatisticAnalysis({btmNames});
+          const secondData = secondResponse.data.data;
+          console.log('secondData', secondData)
+          Object.keys(firstData).sort().forEach((key,index)=>{
+            if (firstData[key]) {
+              const indexes = firstData[key].split(',');
+              for (const indexSec of indexes) {
+                const type = typeList[indexSec];
+                const List = secondData.map(record => {
+                  return {
+                    menuData: record.menuData,
+                    menuName: record.menuName
+                  }
+                })
+                List.forEach((i,j)=>{
+                  if(index === j ){
+                    this[type].push(i)
+                  }
+                })
+              }
+            }
           })
         }
-      })
+      } catch (error) {
+        console.error('Error:', error);
+      }
     },
     //鏂板
     addHandler() {
@@ -179,8 +206,6 @@
         const dataKey = typeList[item.codeType];
         if (dataKey) {
           this[dataKey].push(item);
-          this[dataKey].forEach(res => {
-          })
           hasValidData = true;
         }
       });
@@ -192,6 +217,7 @@
     },
     //琛ㄦ牸澶氶��
     selectChange(selection) {
+      console.log('selection', selection)
       this.selectData = selection;
     },
   }

--
Gitblit v1.9.3