From 7c9c9433b7f57e2e3935685da967c29b76ebb939 Mon Sep 17 00:00:00 2001
From: xiejun <xj@2023>
Date: 星期二, 26 九月 2023 17:26:57 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

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

diff --git a/Source/UBCS-WEB/src/views/integration/systemInfo.vue b/Source/UBCS-WEB/src/views/integration/systemInfo.vue
index 4d3dee2..ac49796 100644
--- a/Source/UBCS-WEB/src/views/integration/systemInfo.vue
+++ b/Source/UBCS-WEB/src/views/integration/systemInfo.vue
@@ -59,7 +59,7 @@
     return {
       checkAll: {},
       ParentList: [],
-      ParentRemoveList:[],
+      ParentRemoveList: [],
       //閬垮厤缂撳瓨
       reload: Math.random(),
       TreeLoading: false,
@@ -147,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,
@@ -179,26 +179,41 @@
               }
             }
           }
-          console.log(this.ParentList);
         }
       } else {
-        if (!row.parentId && row.children) {
-          this.ParentRemoveList = this.ParentList.filter(record => record.oid !== row.oid);
+        // 鍙栨秷鍕鹃�夌殑鑺傜偣鏄埗鑺傜偣
+        if (!row.parentId) {
+          // 鎵惧埌鐖惰妭鐐瑰湪ParentList涓殑绱㈠紩
+          const parentIndex = this.ParentList.findIndex(item => item.oid === row.oid);
+          if (parentIndex !== -1) {
+            const parentOid = this.ParentList[parentIndex].classifyOid;
 
-          if (row.children && row.children.length > 0) {
-            for (let child of row.children) {
-              this.ParentRemoveList = this.ParentList.filter(record => record.oid !== child.oid);
-
-              if (child.children && child.children.length > 0) {
-                for (let subChild of child.children) {
-                  this.ParentRemoveList = this.ParentList.filter(record => record.oid !== subChild.oid);
-                }
+            // 鏌ユ壘鎵�鏈夐渶瑕佸垹闄ょ殑瀛愯妭鐐圭殑绱㈠紩
+            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.ParentRemoveList)
       }
+      console.log(this.ParentList);
     },
     //鍒嗙被鎺堟潈
     classifyHandler(row) {

--
Gitblit v1.9.3