From 5db4019b73a704d8ecdcf7892e39e6190699846d Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期四, 18 四月 2024 00:05:28 +0800
Subject: [PATCH] 整合前几日代码

---
 Source/UBCS-WEB/src/views/integration/vciAttribute.vue |  121 +++++++++++++++++++++-------------------
 1 files changed, 63 insertions(+), 58 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/integration/vciAttribute.vue b/Source/UBCS-WEB/src/views/integration/vciAttribute.vue
index c07974a..d39551f 100644
--- a/Source/UBCS-WEB/src/views/integration/vciAttribute.vue
+++ b/Source/UBCS-WEB/src/views/integration/vciAttribute.vue
@@ -4,7 +4,7 @@
                @size-change="sizeChange" @row-dblclick="handleRowClick" @row-update="handleUpdate"
                @selection-change="selectChange">
       <template slot="menuLeft">
-        <!--        <el-button plain size="small" type="success" @click="savaHandler">淇濆瓨</el-button>-->
+        <el-button plain size="small" type="success" @click="savaHandler">淇濆瓨</el-button>
         <el-button plain size="small" type="primary" @click="syncHandler">鍚屾</el-button>
       </template>
     </avue-crud>
@@ -25,7 +25,7 @@
         calcHeight: 20,
         headerAlign: "center",
         border: true,
-        // selection: true,
+        selection: true,
         tip: false,
         index: true,
         refreshBtn: false,
@@ -80,12 +80,7 @@
     }
   },
   created() {
-    const params = {
-      'conditionMap[groupAttrKey_like]': 'RY_',
-      page: this.page.currentPage,
-      limit: this.page.pageSize
-    }
-    this.onLoad(params)
+    this.onLoad()
     this.codeColumnOnload()
   },
   computed: {
@@ -107,7 +102,11 @@
     selectChange(list) {
       this.selectList = list;
     },
-    async onLoad(params) {
+    async onLoad() {
+      const params = {
+        page: this.page.currentPage,
+        limit: this.page.pageSize
+      }
       getGroupAttrPoolALlList(params).then(res => {
         const data = res.data.data;
         this.data = data.records;
@@ -140,18 +139,24 @@
 
       // row.codeMetaAttrName鍥犱负涓嬫媺妗唙alue鍊煎師鍥犵粦瀹氫负codeMetaAttrOid
       let updataList = []
+      // console.log(this.ChangeName)
+      // console.log(row.codeMetaAttrName)
+      // if (this.ChangeName && this.ChangeName === row.codeMetaAttrName) {
+      //   updataList = this.codeMetaColumn.dicData.find(item => item.codeMetaAttrOid === row.codeMetaAttrOid)
+      // } else {
+      //   console.log('2')
+      //     updataList = this.codeMetaColumn.dicData.find(item => item.codeMetaAttrOid === row.codeMetaAttrName)
+      // }
+      updataList = this.codeMetaColumn.dicData.find(item => item.codeMetaAttrOid === row.codeMetaAttrName)
 
-      if (this.ChangeName && this.ChangeName === row.codeMetaAttrName) {
-        updataList = this.codeMetaColumn.dicData.find(item => item.codeMetaAttrOid === row.codeMetaAttrOid)
-      } else {
-        if (row.codeMetaAttrName !== "" && row.codeMetaAttrName) {
-          updataList = this.codeMetaColumn.dicData.find(item => item.codeMetaAttrOid === row.codeMetaAttrName)
-        }
-      }
       // 鍥犱负row閲岄潰鐨勫�兼槸涓嶆纭殑 閲嶆柊璧嬪�间竴閬�
       if (updataList) {
         const {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName} = updataList;
-        Object.assign(row, {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName});
+        Object.assign(row, {
+          codeMetaAttrOid: codeMetaAttrOid.toLowerCase(),
+          codeMetaAttrKey: codeMetaAttrKey.toLowerCase(),
+          codeMetaAttrName: codeMetaAttrName.toLowerCase()
+        });
       }
 
       const objet = {
@@ -162,6 +167,7 @@
         codeMetaAttrKey: row.codeMetaAttrKey,
         codeMetaAttrName: row.codeMetaAttrName
       }
+
       const response = await editGroupAttr([objet])
       if (response.data.success) {
         this.$message.success('淇濆瓨鎴愬姛锛�')
@@ -174,30 +180,41 @@
       } else {
         const hasTrueValue = this.selectList.some(item => !item.$cellEdit);
         if (hasTrueValue) {
-          this.$message.warning('璇峰紑鍚紪杈戝悗淇濆瓨锛�')
-        } else {
-          let saveList = []
-          for (const item of this.selectList) {
-            console.log(item)
-            const updataList = this.codeMetaColumn.dicData.find(p => p.codeMetaAttrOid === item.codeMetaAttrName);
-            const {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName} = updataList;
-            Object.assign(item, {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName});
-            console.log(updataList)
-            item.$cellEdit = false;
-            saveList.push({
-              oid: item.oid,
-              groupAttrKey: item.groupAttrKey,
-              groupAttrName: item.groupAttrName,
-              codeMetaAttrOid: item.codeMetaAttrOid,
-              codeMetaAttrKey: item.codeMetaAttrKey,
-              codeMetaAttrName: item.codeMetaAttrName
-            })
-          }
-          const response = await editGroupAttr(saveList)
-          if (response.data.success) {
-            this.$message.success('淇濆瓨鎴愬姛锛�')
-          }
+          this.$message.warning('璇峰紑鍚紪杈戝悗杩涜淇濆瓨锛�')
+          return
         }
+        const codeMetaInput = this.selectList.some(item => item.codeMetaAttrName === "");
+        if (codeMetaInput) {
+          this.$message.warning('璇锋鏌ュ凡鍕鹃�夋暟鎹腑鏄惁瀛樺湪鏈�夋嫨鐨勯」锛�');
+          return
+        }
+        let saveList = []
+        for (const item of this.selectList) {
+          const updataList = this.codeMetaColumn.dicData.find(column => column.codeMetaAttrOid === item.codeMetaAttrName);
+          if (updataList) {
+            const {codeMetaAttrOid, codeMetaAttrKey, codeMetaAttrName} = updataList;
+            Object.assign(item, {
+              codeMetaAttrOid: codeMetaAttrOid.toLowerCase(),
+              codeMetaAttrKey: codeMetaAttrKey.toLowerCase(),
+              codeMetaAttrName: codeMetaAttrName.toLowerCase()
+            });
+          }
+          item.$cellEdit = false;
+          saveList.push({
+            oid: item.oid,
+            groupAttrKey: item.groupAttrKey,
+            groupAttrName: item.groupAttrName,
+            codeMetaAttrOid: item.codeMetaAttrOid,
+            codeMetaAttrKey: item.codeMetaAttrKey,
+            codeMetaAttrName: item.codeMetaAttrName
+          })
+        }
+        const response = await editGroupAttr(saveList)
+        if (response.data.success) {
+          this.$message.success('淇濆瓨鎴愬姛锛�')
+          await this.onLoad()
+        }
+
       }
     },
     async syncHandler() {
@@ -214,32 +231,20 @@
         const response = await syncGroupAttrMapping(syncList)
         if (response.data.success) {
           this.$message.success(response.data.msg);
-          const params = {
-            'conditionMap[groupAttrKey_like]': 'RY_',
-            page: this.page.currentPage,
-            limit: this.page.pageSize
-          }
-          await this.onLoad(params)
+
+          await this.onLoad()
         }
       }
     },
     currentChange(currentPage) {
       this.page.currentPage = currentPage;
-      const params = {
-        'conditionMap[groupAttrKey_like]': 'RY_',
-        page: this.page.currentPage,
-        limit: this.page.pageSize
-      }
-      this.onLoad(params)
+
+      this.onLoad()
     },
     sizeChange(pageSize) {
       this.page.pageSize = pageSize;
-      const params = {
-        'conditionMap[groupAttrKey_like]': 'RY_',
-        page: this.page.currentPage,
-        limit: this.page.pageSize
-      }
-      this.onLoad(params)
+
+      this.onLoad()
     },
   }
 }

--
Gitblit v1.9.3