From 6e0ef2d1f836680e6a55b7fc2d813b759038c144 Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期二, 25 十月 2022 15:35:34 +0800
Subject: [PATCH] 路径规划,底图切换

---
 src/views/AuthorizationManagement/roleMenuAuthorization.vue |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/views/AuthorizationManagement/roleMenuAuthorization.vue b/src/views/AuthorizationManagement/roleMenuAuthorization.vue
index ef60fad..98a466e 100644
--- a/src/views/AuthorizationManagement/roleMenuAuthorization.vue
+++ b/src/views/AuthorizationManagement/roleMenuAuthorization.vue
@@ -20,7 +20,7 @@
             style="width: 300px"
             v-model="selFrom.name"
             placeholder="璇烽�夋嫨鍗曚綅鍚嶇О..."
-            @change="chooseCustom"
+            @change="chooseCustom('multiSelect')"
           >
             <el-option
               :value="selectTree"
@@ -36,6 +36,7 @@
                 node-key="id"
                 ref="treeForm"
                 @node-click="addAdminHandleNodeClick"
+                :default-expanded-keys="[1]"
               >
               </el-tree>
             </el-option>
@@ -125,6 +126,7 @@
           node-key="id"
           @check="menuTreeCheck"
           ref="treeForm"
+          :default-expanded-keys="[1]"
         >
         </el-tree>
       </div>
@@ -344,6 +346,7 @@
       this.depid = e.id;
       this.selFrom.name = e.name;
       this.selectTree = e.name;
+      this.chooseCustom('multiSelect');
       this.getRoleDep();
       this.getMenuTree();
     },
@@ -353,6 +356,10 @@
         this.menuid = node.id;
         this.rolMenuListData.roleid = this.roleid;
         this.getRoleMenu();
+        if (list.checkedKeys.length == 2) {
+          //鍗曢�夊疄鐜�
+          this.$refs.treeForm.setCheckedKeys([node.id]);
+        }
       } else {
         this.menuid = null;
       }
@@ -392,10 +399,20 @@
       );
     },
     //涓嬫媺妗嗛�変腑鍚庤嚜鍔ㄥ叧闂�
-    chooseCustom() {
-      setTimeout(() => {
-        this.$refs.multiSelect.blur();
+    chooseCustom(refName) {
+      // this.$refs[refName] && this.$refs[refName].blur();
+      this.createTimer(this.autoCloseSelect, refName);
+    },
+    createTimer(callback, refName) {
+      const timer = setTimeout(() => {
+        callback(refName);
       }, 50);
+      this.$once('hook:beforeDestroy', () => {
+        clearInterval(timer);
+      });
+    },
+    autoCloseSelect(refName) {
+      this.$refs[refName] && this.$refs[refName].blur();
     },
     dephandleSizeChange() {
       this.roleDepListData.pageSize = val;

--
Gitblit v1.9.3