From 7d9733a9fe0e21efe346787838aa5182633e30d2 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期日, 08 十月 2023 22:33:10 +0800
Subject: [PATCH] 注意更新blade-core-tool.jar

---
 Source/UBCS-WEB/src/views/integration/systemInfo.vue |   43 +++++++++++++++++++++++++++++++++++++------
 1 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/integration/systemInfo.vue b/Source/UBCS-WEB/src/views/integration/systemInfo.vue
index d816c87..ac49796 100644
--- a/Source/UBCS-WEB/src/views/integration/systemInfo.vue
+++ b/Source/UBCS-WEB/src/views/integration/systemInfo.vue
@@ -59,6 +59,7 @@
     return {
       checkAll: {},
       ParentList: [],
+      ParentRemoveList: [],
       //閬垮厤缂撳瓨
       reload: Math.random(),
       TreeLoading: false,
@@ -135,7 +136,8 @@
       },
     }
   },
-
+  created() {
+  },
   methods: {
     empower() {
       batchAddSave(this.checkAll.oid, this.checkAll.id, this.ParentList).then(res => {
@@ -145,7 +147,7 @@
     //鍒嗙被鎺堟潈澶氶�夊洖璋�
     checkChange(row, checked) {
       if (checked) {
-        if (!row.parentId && row.children) {
+        if (!row.parentId) {
           const parentRecord = {
             oid: row.oid,
             classifyId: row.attributes.classifyId,
@@ -177,12 +179,41 @@
               }
             }
           }
-          console.log(this.ParentList);
         }
-      }else {
-        this.ParentList = this.ParentList.filter(res => res.classifyId !== row.classifyId);
-        console.log(this.ParentList);
+      } else {
+        // 鍙栨秷鍕鹃�夌殑鑺傜偣鏄埗鑺傜偣
+        if (!row.parentId) {
+          // 鎵惧埌鐖惰妭鐐瑰湪ParentList涓殑绱㈠紩
+          const parentIndex = this.ParentList.findIndex(item => item.oid === row.oid);
+          if (parentIndex !== -1) {
+            const parentOid = this.ParentList[parentIndex].classifyOid;
+
+            // 鏌ユ壘鎵�鏈夐渶瑕佸垹闄ょ殑瀛愯妭鐐圭殑绱㈠紩
+            const childIndexes = this.ParentList.reduce((indexes, item, index) => {
+              if (item.classParentOid === parentOid && item.classifyOid !== parentOid) {
+                indexes.push(index);
+              }
+              return indexes;
+            }, []);
+
+            // 浠庡悗寰�鍓嶅垹闄ゅ瓙鑺傜偣鐨勬暟鎹紝淇濊瘉绱㈠紩鐨勬纭��
+            for (let i = childIndexes.length - 1; i >= 0; i--) {
+              this.ParentList.splice(childIndexes[i], 1);
+            }
+
+            // 鍒犻櫎鐖惰妭鐐圭殑鏁版嵁
+            this.ParentList.splice(parentIndex, 1);
+          }
+        } else {
+          // 鍙栨秷鍕鹃�夌殑鑺傜偣鏄瓙鑺傜偣
+          const childIndex = this.ParentList.findIndex(item => item.oid === row.oid);
+          if (childIndex !== -1) {
+            // 鍒犻櫎瀛愯妭鐐圭殑鏁版嵁
+            this.ParentList.splice(childIndex, 1);
+          }
+        }
       }
+      console.log(this.ParentList);
     },
     //鍒嗙被鎺堟潈
     classifyHandler(row) {

--
Gitblit v1.9.3