Переглянути джерело

卡片删除后树的选中问题

zhongxiaoyu 3 роки тому
батько
коміт
1c221b3108

+ 4 - 4
src/views/accountGroupManagement/components/accountGroupHome.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2022-01-08 09:27:43
- * @LastEditTime: 2022-03-18 18:18:29
+ * @LastEditTime: 2022-03-21 03:17:37
  * @LastEditors: your name
  * @Description: 用户组管理
  * @FilePath: \Foshan4A2.0\src\views\accountGroupManagement\components\home.vue
@@ -367,7 +367,9 @@ export default {
     },
     currentKey: {
       handler(val) {
-        this.$refs.tree.setCurrentKey(val)
+        this.$nextTick(() => {
+          this.$refs.tree.setCurrentKey(val)
+        })
       }
     }
   },
@@ -547,8 +549,6 @@ export default {
           this.flag = false
           this.getGroupTree()
           this.childrenData.splice(this.delIndex, 1)
-          this.$refs.tree.setCurrentKey(this.currDataArr[0].GroupId)
-          this.currentKey = this.currDataArr[0].GroupId
         } else {
           this.flag = false
           this.$message.error(res.message)

+ 4 - 1
src/views/accountGroupManagement/mixins/treeData.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-12-22 17:00:22
- * @LastEditTime: 2022-03-18 17:55:45
+ * @LastEditTime: 2022-03-21 03:27:01
  * @LastEditors: your name
  * @Description: 获取权限树
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\minixs\treeData.js
@@ -80,6 +80,9 @@ export default {
         this.currDataArr = this.decompose(this.dataArr, 'GroupId', this.currentKey)
         this.childrenData = this.decompose(this.dataArr, 'GroupUpid', this.currentKey)
       }
+      this.$nextTick(() => {
+        this.$refs.tree?.setCurrentKey(this.currentKey)
+      })
     }
   }
 }

+ 4 - 2
src/views/authorityManagement/components/authorityHome.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 09:27:43
- * @LastEditTime: 2022-03-18 18:18:39
+ * @LastEditTime: 2022-03-21 03:21:52
  * @LastEditors: your name
  * @Description: 权限管理
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\home.vue
@@ -206,7 +206,9 @@ export default {
     },
     currentKey: {
       handler(val) {
-        this.$refs.tree.setCurrentKey(val)
+        this.$nextTick(() => {
+          this.$refs.tree.setCurrentKey(val)
+        })
       }
     }
   },

+ 4 - 1
src/views/authorityManagement/minixs/treeData.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-12-22 17:00:22
- * @LastEditTime: 2022-03-18 17:49:39
+ * @LastEditTime: 2022-03-21 03:26:52
  * @LastEditors: your name
  * @Description: 获取权限树
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\minixs\treeData.js
@@ -105,6 +105,9 @@ export default {
         this.childrenData = this.decompose(this.dataArr, "UpAuthId", this.currentKey)
         this.loading = false
       }
+      this.$nextTick(() => {
+        this.$refs.tree?.setCurrentKey(this.currentKey)
+      })
     }
   }
 }

+ 4 - 4
src/views/organizationManagement/components/organizationHome.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 09:27:43
- * @LastEditTime: 2022-03-18 18:18:54
+ * @LastEditTime: 2022-03-21 03:28:09
  * @LastEditors: your name
  * @Description: 权限管理
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\home.vue
@@ -246,7 +246,9 @@ export default {
     },
     currentKey: {
       handler(val) {
-        this.$refs.tree.setCurrentKey(val)
+        this.$nextTick(() => {
+          this.$refs.tree.setCurrentKey(val)
+        })
       }
     }
   },
@@ -389,8 +391,6 @@ export default {
           this.flag = false;
           this.getOrganTree();
           this.childrenData.splice(this.delIndex, 1);
-          this.$refs.tree.setCurrentKey(this.currDataArr[0].OrganId);
-          this.currentKey = this.currDataArr[0].OrganId;
         } else {
           this.flag = false;
           this.$message.error(res.message);

+ 4 - 1
src/views/organizationManagement/minixs/treeData.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-12-22 17:00:22
- * @LastEditTime: 2022-03-14 17:08:51
+ * @LastEditTime: 2022-03-21 03:29:33
  * @LastEditors: your name
  * @Description: 获取权限树
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\minixs\treeData.js
@@ -100,6 +100,9 @@ export default {
         this.currDataArr = this.decompose(this.dataArr, 'OrganId', this.currentKey)
         this.childrenData = this.decompose(this.dataArr, 'OrganUpid', this.currentKey)
       }
+      this.$nextTick(() => {
+        this.$refs.tree?.setCurrentKey(this.currentKey)
+      })
     }
   }
 }