From d0b163b5f1114a93b5d0f04e77a00ed8adb91894 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期四, 14 十二月 2023 20:18:37 +0800
Subject: [PATCH] 整合代码

---
 Source/UBCS-WEB/src/api/statistic/chart.js                  |   16 ++++++++
 Source/UBCS-WEB/src/views/statistic/statisticPage.vue       |   69 +++++++++++++++++++++++++---------
 Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue |   31 +++++++++------
 Source/UBCS-WEB/src/components/Master/MasterTree.vue        |    2 
 4 files changed, 86 insertions(+), 32 deletions(-)

diff --git a/Source/UBCS-WEB/src/api/statistic/chart.js b/Source/UBCS-WEB/src/api/statistic/chart.js
index 9806a7e..87d23af 100644
--- a/Source/UBCS-WEB/src/api/statistic/chart.js
+++ b/Source/UBCS-WEB/src/api/statistic/chart.js
@@ -9,3 +9,19 @@
     params
   })
 }
+//缁熻鍒嗘瀽淇濆瓨
+export const saveStatisticAnalysis = (data) => {
+  return request({
+    url: '/api/ubcs-system/statisticConfig/saveStatisticAnalysis',
+    method: 'post',
+    data:data
+  })
+}
+
+//缁熻鍒嗘瀽鍒楄〃
+export const getBtmAndChart = () => {
+  return request({
+    url: '/api/ubcs-system/statisticConfig/getBtmAndChartIds',
+    method: 'get',
+  })
+}
diff --git a/Source/UBCS-WEB/src/components/Master/MasterTree.vue b/Source/UBCS-WEB/src/components/Master/MasterTree.vue
index 9f9a378..7b39aea 100644
--- a/Source/UBCS-WEB/src/components/Master/MasterTree.vue
+++ b/Source/UBCS-WEB/src/components/Master/MasterTree.vue
@@ -188,7 +188,7 @@
           List.forEach(item => {
             let columnItem = {
               label: item.title,
-              prop: item.field,
+              prop: item.queryField,
               // type: this.columnType[item.type],
               sortable: item.sort,
               width: item.minWidth
diff --git a/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue b/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue
index 82d1ebe..51e6949 100644
--- a/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue
+++ b/Source/UBCS-WEB/src/components/MasterCrud/VciMasterCrud.vue
@@ -427,7 +427,8 @@
           }
 
           if (_index == 0) {
-            this.keyWordFind = record.queryField
+            this.keyWordFind = record.queryField;
+            console.log(record)
           }
         })
         this.tableHeadFindDatas = newval;
@@ -1017,24 +1018,30 @@
     similarHandler() {
       if (this.selectRow.length <= 0) {
         this.$message.warning("璇烽�夋嫨涓�鏉℃暟鎹�");
-      } else if (this.selectRow.length > 1) {
-        this.$message.warning("鍙兘閫夋嫨涓�鏉℃暟鎹�");
-      } else {
-        this.similarVisible = true;
+        return;
       }
+      if (this.selectRow.length > 1) {
+        this.$message.warning("鍙兘閫夋嫨涓�鏉℃暟鎹�");
+        return;
+      }
+      this.similarVisible = true;
     },
     //鏁版嵁鏇存敼
     DataChange() {
       if (this.selectRow.length <= 0) {
         this.$message.warning("璇烽�夋嫨涓�鏉℃暟鎹�");
-      } else if (this.selectRow.length > 1) {
-        this.$message.warning("鍙兘閫夋嫨涓�鏉℃暟鎹�");
-      } else if (this.selectRow[0].lcstatus != "Released") {
-        this.$message.warning("鍙湁鐘舵�佷负宸插彂甯冪殑鏁版嵁鎵嶈兘杩涜鏁版嵁鏇存敼");
-      } else {
-        this.DataVisible = true;
-        this.rowOid = this.selectRow[0]['oid']
+        return
       }
+      if (this.selectRow.length > 1) {
+        this.$message.warning("鍙兘閫夋嫨涓�鏉℃暟鎹�");
+        return;
+      }
+      if (this.selectRow[0].lcstatus != "Released") {
+        this.$message.warning("鍙湁鐘舵�佷负宸插彂甯冪殑鏁版嵁鎵嶈兘杩涜鏁版嵁鏇存敼");
+        return;
+      }
+      this.DataVisible = true;
+      this.rowOid = this.selectRow[0]['oid']
     },
     //澧炲姞淇濆瓨
     AddSumbit(val) {
diff --git a/Source/UBCS-WEB/src/views/statistic/statisticPage.vue b/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
index 093ef55..87f13cb 100644
--- a/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
+++ b/Source/UBCS-WEB/src/views/statistic/statisticPage.vue
@@ -26,18 +26,16 @@
         <el-table-column
           align="center"
           label="涓绘暟鎹簱鍚�"
-          prop="menuName">
+          prop="menuName"
+          width="300">
         </el-table-column>
         <el-table-column
           align="center"
           label="绫诲瀷"
           prop="codeType">
           <template slot-scope="{ row }">
-            <el-select v-model="row.codeType" placeholder="璇烽�夋嫨鍥捐〃绫诲瀷">
-              <el-option label="鎶樼嚎鍥�" value="0"></el-option>
-              <el-option label="楗肩姸鍥�" value="1"></el-option>
-              <el-option label="鏌辩姸鍥�" value="2"></el-option>
-              <el-option label="鍫嗗彔鎶樼嚎鍥�" value="3"></el-option>
+            <el-select v-model="row.codeType" :multiple="true" limit="4" placeholder="璇烽�夋嫨鍥捐〃绫诲瀷" style="width: 400px">
+              <el-option v-for="(item) in selectList" :label="item.label" :value="item.value"></el-option>
             </el-select>
           </template>
         </el-table-column>
@@ -66,7 +64,7 @@
 import pieChart from "../../components/StatisticsComponent/pieChart"
 import ColumnarChart from "../../components/StatisticsComponent/ColumnarChart"
 import mixCart from "../../components/StatisticsComponent/mixCart"
-import {getStatisticAnalysis} from "@/api/statistic/chart"
+import {getStatisticAnalysis,getBtmAndChart,saveStatisticAnalysis} from "@/api/statistic/chart"
 import {getList} from "@/api/system/statistic";
 
 export default {
@@ -79,6 +77,25 @@
   name: "statisticPage",
   data() {
     return {
+      selectValue: '',
+      selectList: [
+        {
+          label: '鎶樼嚎鍥�',
+          value: '0'
+        },
+        {
+          label: '楗肩姸鍥�',
+          value: '1'
+        },
+        {
+          label: '鏌辩姸鍥�',
+          value: '2'
+        },
+        {
+          label: '鍫嗗彔鎶樼嚎鍥�',
+          value: '3'
+        }
+      ],
       menuList: [],
       dataKeyList: [],
       addVisible: false,
@@ -92,13 +109,27 @@
     }
   },
   created() {
-    this.getMasterList()
+    this.getMasterList();
+    this.getEcharts()
   },
   methods: {
     getMasterList() {
       const userId = localStorage.getItem('userId');
       getList({userId: userId}).then(res => {
         this.tableData = res.data.data;
+      }).catch(error=>{
+        this.$message.error(error)
+      })
+    },
+    getEcharts(){
+      getBtmAndChart().then(res=>{
+        const btmNames = Object.keys(res.data.data).join(',');
+        console.log(btmNames);
+        if(btmNames){
+          getStatisticAnalysis({btmNames}).then(item=>{
+            console.log(item)
+          })
+        }
       })
     },
     //鏂板
@@ -110,7 +141,7 @@
       this.addVisible = false;
     },
     //淇濆瓨
-    addSaveHandler() {
+     async addSaveHandler() {
       if (this.selectData.length <= 0) {
         this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒');
         return;
@@ -121,17 +152,19 @@
         return;
       }
 
-      this.dataKeyList = this.selectData.map(obj => obj.code)
-      const btmName = this.dataKeyList.join(",");
-      if (btmName) {
-        getStatisticAnalysis({btmNames: btmName}).then(res => {
+      const newArray = this.selectData.map(item => {
+        return {
+          btmname: item.code,
+          chartIds: item.codeType.join(',')
+        }
+      })
+       saveStatisticAnalysis(newArray).then(res => {
           this.menuList = res.data.data;
           this.nextSave();
           this.$message.success('淇濆瓨鎴愬姛')
+        }).catch(error=>{
+          this.$message.error(error)
         });
-      } else {
-        this.$message.warning('璇烽�夋嫨鏁版嵁锛�')
-      }
     },
     nextSave() {
       const typeList = {
@@ -148,9 +181,7 @@
         const dataKey = typeList[item.codeType];
         if (dataKey) {
           this[dataKey].push(item);
-          this[dataKey].forEach(res=>{
-            console.log('this[dataKey]',this[dataKey])
-            console.log('res',res)
+          this[dataKey].forEach(res => {
           })
           hasValidData = true;
         }

--
Gitblit v1.9.3