From d7e3c8a813f8f85c89c06782f1e36e8089ffc31b Mon Sep 17 00:00:00 2001
From: 田源 <tianyuan@vci-tech.com>
Date: 星期四, 09 一月 2025 11:42:06 +0800
Subject: [PATCH] 集成模块回车查询报错问题

---
 Source/UBCS-WEB/src/views/wel/Statistic.vue |  199 ++++++++++++++++++++++++++++---------------------
 1 files changed, 114 insertions(+), 85 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/wel/Statistic.vue b/Source/UBCS-WEB/src/views/wel/Statistic.vue
index 9f9d094..4d4f437 100644
--- a/Source/UBCS-WEB/src/views/wel/Statistic.vue
+++ b/Source/UBCS-WEB/src/views/wel/Statistic.vue
@@ -1,20 +1,59 @@
 <template>
-  <div class="App" v-loading="this.loading">
+  <div v-loading="this.loading" class="App">
     <div style="display: flex; justify-content: flex-end;margin-bottom: 10px">
-      <el-button icon="el-icon-more" plain size="small" type="primary" @click="MoreHandler">鏇村</el-button>
+      <el-button plain size="small" type="primary" @click="MoreHandler">鑷畾涔�</el-button>
     </div>
-    <avue-data-box ref="dataBox" :animation="true" :option="option"  ></avue-data-box>
-<!--      <avue-data-panel :animation="true":option="option"></avue-data-panel>-->
+    <avue-data-box ref="dataBox" :animation="true" :option="option"></avue-data-box>
+
     <el-dialog :visible.sync="dialogTableVisible" append-to-body class="avue-dialog avue-dialog--top" title="涓绘暟鎹厤缃�"
-               top="0">
-      <avue-crud ref="crud"
-                 v-model="Crud.form"
-                 :data="Crud.data"
-                 :option="Crud.option"
-                 @selection-change="selectionChange">
-      </avue-crud>
+               top='-40px'>
+      <el-table
+        ref="TableBox"
+        :data="Crud.data"
+        border
+        style="width: 100%"
+        @selection-change="selectionChange"
+        @row-click="TableRoute">
+        <el-table-column
+          type="selection"
+          width="55">
+        </el-table-column>
+        <el-table-column
+          align="center"
+          label="涓绘暟鎹悕绉�"
+          prop="menuName"
+        >
+          <template slot-scope="scope">
+            <el-link type="primary" @click="TableRoute(scope.row)">{{ scope.row.menuName }}</el-link>
+          </template>
+        </el-table-column>
+        <el-table-column
+          align="center"
+          label="寰呭姙鏁版嵁"
+          prop="mdmCount"
+        >
+        </el-table-column>
+        <el-table-column
+          align="center"
+          label="icon鍥炬爣"
+          prop="icon">
+          <template slot-scope="scope">
+            <i :class="scope.row.icon" style="font-size: 20px"></i>
+          </template>
+        </el-table-column>
+        <el-table-column
+          :show-overflow-tooltip='true'
+          label="璺敱鍦板潃"
+          prop="menuRoute">
+        </el-table-column>
+        <el-table-column
+          align="center"
+          label="code"
+          prop="code">
+        </el-table-column>
+      </el-table>
       <div slot="footer" class="dialog-footer">
-        <el-button plain type="primary" @click="SaveHandler">淇濆瓨</el-button>
+        <el-button plain type="primary" @click="SaveHandler" v-loading="BtnLoading">淇濆瓨</el-button>
       </div>
     </el-dialog>
   </div>
@@ -22,51 +61,16 @@
 
 <script>
 import {getList, save} from "@/api/system/statistic";
+
 export default {
   name: "Statistic",
   data() {
     return {
-      loading:true,
+      BtnLoading: false,
+      loading: true,
       Crud: {
         form: '',
         data: [],
-        option: {
-          calcHeight: 80,
-          tip: false,
-          searchShow: false,
-          addBtn: false,
-          columnBtn: false,
-          header: false,
-          menu: false,
-          border: true,
-          index: true,
-          selection: true,
-          column: [
-            {
-              label: "涓绘暟鎹悕绉�",
-              prop: "menuName",
-            },
-            {
-              label: "寰呭姙鏁版嵁",
-              prop: "mdmCount",
-            },
-            {
-              label: "icon鍥炬爣",
-              prop: "icon",
-              overHidden: true,
-            },
-            {
-              label: "璺敱鍦板潃",
-              prop: "menuRoute",
-              overHidden: true,
-            },
-            {
-              label: "code",
-              prop: "code",
-              overHidden: true,
-            },
-          ]
-        }
       },
       userId: '',
       hexColor: '',
@@ -85,16 +89,16 @@
     this.MasterGetList();
   },
   mounted() {
-   this.FontInfo()
+    this.FontInfo()
   },
   computed() {
 
   },
   methods: {
-    FontInfo(){
+    FontInfo() {
       this.$nextTick(() => {
         const dataFatherBox = this.$refs.dataBox.$el;
-        console.log(dataFatherBox);
+        // console.log(dataFatherBox);
         this.$nextTick(() => {
           setTimeout(() => {
             //瀛椾綋
@@ -106,9 +110,9 @@
               info.style.fontSize = '16px';
             });
             items.forEach((item) => {
-              item.style.border = '1px solid  rgb(200, 200, 200, 1)'; // 娣诲姞杈规鏍峰紡
+              item.style.border = '1px solid  #DCDFE6';
             });
-            this.loading=false;
+            this.loading = false;
           }, 1000); // 寤惰繜1绉掓煡鎵緄nfo鍏冪礌
         });
       });
@@ -117,34 +121,45 @@
       // console.log(row)
       this.SelectRow = row;
     },
-    SaveHandler() {
+    async SaveHandler() {
       if (this.SelectRow.length <= 0) {
-        this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹紒')
-        return
+        this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹紒');
+        return;
       }
-      let mdmNameList = [];
-      mdmNameList = this.SelectRow.map(item => {
-        return item.code
-      })
-      console.log(mdmNameList)
-      save(this.userId, mdmNameList).then(res => {
-        console.log(res)
-        if (res.data.code === 200) {
-          this.$message.success('淇濆瓨鎴愬姛锛�')
-          //娓呴櫎宸叉湁鏁扮粍涓璸ush鏁版嵁
+      this.BtnLoading = true;
+      try {
+        const {data: {code}} = await save(this.userId, this.SelectRow.map(item => item.code));
+        if (code === 200) {
+          this.$message.success('淇濆瓨鎴愬姛锛�');
+          this.newData = [];
           this.option.data = [];
-          this.newData=[];
-
-          this.MasterGetList()
+          this.MasterGetList();
           this.dialogTableVisible = false;
-          //瀛椾綋閲嶆柊鍔犺浇鍙樺ぇ
-          this.loading=true;
-          this.FontInfo()
+          this.BtnLoading = false;
+          this.loading = true;
+          this.FontInfo();
         }
-      })
+      } catch {
+        this.BtnLoading = false;
+      }
     },
     MoreHandler() {
       this.dialogTableVisible = true;
+      let checkedrow = []
+      this.newData.forEach(item => {
+        this.option.data.forEach(v => {
+          if (item.code === v.code) {
+            checkedrow.push(item)
+          }
+        })
+      })
+
+      // console.log(checkedrow)
+      this.$nextTick(() => {
+        checkedrow.forEach(row => {
+          this.$refs.TableBox.toggleRowSelection(row, true) // 鍥炴樉
+        })
+      })
     },
     // 闅忔満鑹�
     randomColor() {
@@ -158,10 +173,13 @@
     MasterGetList() {
       this.userId = localStorage.getItem('userId');
       getList({userId: this.userId}).then(res => {
-        res.data.data.filter(item => {
-          // console.log(item.icon)
+        res.data.data.filter((item, index) => {
+          this.newData.push(item);
+          this.Crud.data = this.newData;
           if (item.isDefault === 1) {
-            this.hexColor = this.randomColor();
+            const colors = ['rgb(49, 180, 141)', 'rgb(56, 161, 242)', 'rgb(117, 56, 199)', 'rgb(242, 104, 31)',
+              'rgb(19, 150, 111)', 'rgb(26, 131, 212)', 'rgb(87, 26, 169)', 'rgb(212, 83, 1)'];
+            const color = colors[index % colors.length];
             this.option.data.push({
               click: (item) => {
                 this.$router.push({path: item.uiUrl});
@@ -171,23 +189,34 @@
               icon: item.icon,
               code: item.code,
               isDefault: item.isDefault,
-              color: this.hexColor,
+              color: color,
               uiUrl: item.menuRoute,
               id: 'custom-title'
             });
-          } else if (item.isDefault === 0) {
-            this.newData.push(item);
-            this.Crud.data = this.newData;
           }
         });
-        // console.log(this.option.data);
-        // console.log(this.newData);
       });
-    }
+    },
+    TableRoute(row) {
+      this.$router.push({path: row.menuRoute});
+    },
   }
 }
 </script>
 
 <style scoped>
+* {
+  list-style: none;
+}
 
+.MasterBox {
+  display: flex;
+  width: 100%;
+  padding: 0;
+}
+
+div {
+  margin: 0;
+  padding: 0;
+}
 </style>

--
Gitblit v1.9.3