From 99824bc8412280f710e8182631dc37a38720e8a3 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期二, 05 十二月 2023 15:30:17 +0800
Subject: [PATCH] 统计分析真实数据联调

---
 Source/UBCS-WEB/src/views/statistic/statisticPage.vue |  128 ++++++++++--------------------------------
 1 files changed, 30 insertions(+), 98 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/statistic/statisticPage.vue b/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
index 2619751..979622f 100644
--- a/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
+++ b/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
@@ -13,6 +13,7 @@
       top="-50px"
     >
       <el-table
+        ref="table"
         :data="tableData"
         border
         style="width: 100%"
@@ -66,6 +67,8 @@
 import ColumnarChart from "../../components/StatisticsComponent/ColumnarChart"
 import mixCart from "../../components/StatisticsComponent/mixCart"
 import {getStatisticAnalysis} from "@/api/statistic/chart"
+import {getList} from "@/api/system/statistic";
+
 export default {
   components: {
     lineChart,
@@ -76,6 +79,8 @@
   name: "statisticPage",
   data() {
     return {
+      menuList:[],
+      dataKeyList: [],
       addVisible: false,
       chartName: "",
       lineList: [],
@@ -83,105 +88,22 @@
       columnarList: [],
       mixList: [],
       selectData: [],
-      tableData: [
-        {
-          menuName: "宸ヨ壓鏂囦欢",
-          codeType: "1",
-          menuData: [
-            [222, 232, 301, 334, 290, 330, 410, 330, 212, 322, 200, 234],
-            [120, 132, 101, 134, 90, 230, 210, 130, 10, 122, 100, 80],
-          ]
-        },
-        {
-          menuName: "娴嬭瘯sc",
-          codeType: null,
-          menuData: [
-            [220, 232, 301, 334, 290, 330, 410, 330, 212, 322, 200, 234],
-            [120, 132, 101, 134, 90, 230, 210, 130, 10, 122, 100, 80],
-          ]
-        },
-        {
-          menuName: "浜у搧鍨嬪彿",
-          codeType: null,
-          menuData: [
-            [220, 232, 301, 334, 290, 330, 410, 330, 212, 322, 200, 234],
-            [120, 132, 101, 134, 90, 230, 210, 130, 10, 122, 100, 80],
-          ]
-        },
-        {
-          menuName: "鍥哄畾璧勪骇",
-          codeType: null,
-          menuData: [
-            [220, 232, 301, 334, 290, 330, 410, 330, 212, 322, 200, 234],
-            [120, 132, 101, 134, 90, 230, 210, 130, 10, 122, 100, 80],
-          ]
-        },
-        {
-          menuName: "鏉庤埅涓绘暟鎹�",
-          codeType: null,
-          menuData: [
-            [220, 232, 301, 334, 290, 330, 410, 330, 212, 322, 200, 234],
-            [120, 132, 101, 134, 90, 230, 210, 130, 10, 122, 100, 80],
-          ]
-        },
-        {
-          menuName: "Part",
-          codeType: null,
-          menuData: [
-            [220, 232, 301, 334, 290, 330, 410, 330, 212, 322, 200, 234],
-            [120, 132, 101, 134, 90, 230, 210, 130, 10, 122, 100, 80],
-          ]
-        },
-        {
-          menuName: "浜哄憳涓绘暟鎹�",
-          codeType: null,
-          menuData: [
-            [220, 232, 301, 334, 290, 330, 410, 330, 212, 322, 200, 234],
-            [120, 132, 101, 134, 90, 230, 210, 130, 10, 122, 100, 80],
-          ]
-        },
-        {
-          menuName: "浜哄憳",
-          codeType: null,
-          menuData: [
-            [220, 232, 301, 334, 290, 330, 410, 330, 212, 322, 200, 234],
-            [120, 132, 101, 134, 90, 230, 210, 130, 10, 122, 100, 80],
-          ]
-        },
-        {
-          menuName: "鏍囧噯",
-          codeType: null,
-          menuData: [
-            [220, 232, 301, 334, 290, 330, 410, 330, 212, 322, 200, 234],
-            [120, 132, 101, 134, 90, 230, 210, 130, 10, 122, 100, 80],
-          ]
-        },
-        {
-          menuName: "鐗╁搧涓绘暟鎹�",
-          codeType: null,
-          menuData: [
-            [220, 232, 301, 334, 290, 330, 410, 330, 212, 322, 200, 234],
-            [120, 132, 101, 134, 90, 230, 210, 130, 10, 122, 100, 80],
-          ]
-        },
-        {
-          menuName: "鍨嬪彿",
-          codeType: null,
-          menuData: [
-            [220, 232, 301, 334, 290, 330, 410, 330, 212, 322, 200, 234],
-            [120, 132, 101, 134, 90, 230, 210, 130, 10, 122, 100, 80],
-          ]
-        }
-      ]
+      tableData: []
     }
   },
+  created() {
+    this.getMasterList()
+  },
   methods: {
+    getMasterList() {
+      const userId = localStorage.getItem('userId');
+      getList({userId: userId}).then(res => {
+        this.tableData = res.data.data;
+      })
+    },
     //鏂板
     addHandler() {
       this.addVisible = true;
-      getStatisticAnalysis({btmNames:'part'}  ).then(res=>{
-        console.log(res)
-      })
     },
     //鍙栨秷
     escHandler() {
@@ -207,27 +129,37 @@
         this.$message.warning("璇锋鏌ュ凡鍕鹃�夋暟鎹被鍨嬫槸鍚︿负绌猴紒");
         return;
       }
-      this.selectData.forEach(item => {
+      this.dataKeyList = this.selectData.map(obj => obj.code)
+      const btmName = this.dataKeyList.join(",");
+      if (btmName) {
+        getStatisticAnalysis({btmNames:btmName}  ).then(res=>{
+          this.menuList = res.data.data;
+          this.$message.success('淇濆瓨鎴愬姛')
+        })
+
+      }
+      this.selectData.forEach((item,index) => {
+        item.menuData = this.menuList[index].menuData;
         const dataKey = typeList[item.codeType];
         if (dataKey) {
           this[dataKey].push(item);
-          hasValidData = true; // 鏍囪鏈夋湁鏁堟暟鎹娣诲姞
+          hasValidData = true;
         }
       });
 
       if (hasValidData) {
+        // this.$refs.table.clearSelection();
         this.addVisible = false;
       }
     },
     //琛ㄦ牸澶氶��
-    selectChange(selection, row) {
-      // console.log(selection, row)
+    selectChange(selection) {
       this.selectData = selection;
     },
   }
 }
 </script>
 
-<style scoped lang="scss">
+<style lang="scss" scoped>
 
 </style>

--
Gitblit v1.9.3