From b33517d527aff48ff30eb78d341bbce53d0ed3bb Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期六, 30 十一月 2024 06:42:42 +0800
Subject: [PATCH] 部门、人。回显bug

---
 src/components/flow/Dept/index.vue |   34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/src/components/flow/Dept/index.vue b/src/components/flow/Dept/index.vue
index 105e6a7..0f23c51 100644
--- a/src/components/flow/Dept/index.vue
+++ b/src/components/flow/Dept/index.vue
@@ -4,16 +4,19 @@
       :title="`閫夋嫨鍊欓�夐儴闂╜"
       :visible.sync="show"
       width="65%"
+
+      :destroy-on-close="true"
       :close-on-click-modal="false"
       :before-close="close">
       <el-tree
+        ref="tree"
         :data="deptTree"
         show-checkbox
         node-key="id"
         :check-strictly="true"
         :default-expanded-keys="['dept:100']"
         @check-change="handleCheckChange"
-        :default-checked-keys="checkeds">
+        >
       </el-tree>
       <span slot="footer" class="dialog-footer">
         <el-button @click="close">鍙� 娑�</el-button>
@@ -34,21 +37,21 @@
       type: Boolean
     },
     checkeds: {
-      required: true,
-      type: Array
+      required: true
     }
   },
-  // watch: {
-  //   checkeds: {
-  //     handler(newV) {
-  //       if (newV) {
-  //         console.log("djjdjdjdjdjdjj")
-  //         this.checkedAfterHandler = newV.map(item => {const arr = item.split(':'); return parseInt(arr[1])})
-  //       }
-  //     },
-  //     deep: true
-  //   }
-  // },
+  watch: {
+    show: {
+      handler(newV) {
+        this.$nextTick(() => {
+          if (this.$refs.tree && this.checkeds) {
+            this.$refs.tree.setCheckedKeys(this.checkeds);
+          }
+        });
+      },
+      deep: true
+    }
+  },
   data() {
     return {
       deptTree: [],
@@ -61,6 +64,9 @@
     })
   },
   methods: {
+    setCheckList(value) {
+      this.checkList = value
+    },
     handleCheckChange(data, checked, indeterminate) {
       if (checked) {
         this.checkList.push(data)

--
Gitblit v1.8.0