From 62ae55ae397b7997b147a7b946f7ad5f1c78a45d Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期三, 26 十月 2022 19:34:33 +0800
Subject: [PATCH] 综合展示,系统管理,授权管理,专题图,资料馆添加权限配置

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

diff --git a/src/views/AuthorizationManagement/roleMenuAuthorization.vue b/src/views/AuthorizationManagement/roleMenuAuthorization.vue
index ef60fad..f5237ec 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>
@@ -154,6 +156,7 @@
         >
         <div class="btn" style="margin-left: auto">
           <el-button
+            v-if="menuStatus.insert"
             type="primary"
             icon="el-icon-circle-plus-outline"
             size="small"
@@ -162,6 +165,7 @@
             >{{ $t('operatManage.UserRoleAuthorizationObj.Added') }}</el-button
           >
           <el-button
+            v-if="menuStatus.delete"
             type="danger"
             icon="el-icon-delete"
             size="small"
@@ -309,6 +313,11 @@
       gridData: [],
       addmultipleSelection: [],
       usermultipleSelection: [],
+      menuStatus: {
+        delete: false,
+        insert: false,
+        update: false,
+      },
     };
   },
   methods: {
@@ -344,6 +353,7 @@
       this.depid = e.id;
       this.selFrom.name = e.name;
       this.selectTree = e.name;
+      this.chooseCustom('multiSelect');
       this.getRoleDep();
       this.getMenuTree();
     },
@@ -353,6 +363,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 +406,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;
@@ -473,8 +497,28 @@
         })
         .catch(() => {});
     },
+    showPermsMenu(res) {
+      switch (res.tag) {
+        case '/delete':
+          this.menuStatus.delete = true;
+          break;
+        case '/insert':
+          this.menuStatus.insert = true;
+          break;
+        case '/update':
+          this.menuStatus.update = true;
+          break;
+      }
+    },
   },
   created() {
+    var val = this.$store.state.currentPerms;
+    var permsEntity = this.$store.state.permsEntity;
+    for (var i = 0; i < permsEntity.length; i++) {
+      if (permsEntity[i].perms == val) {
+        this.showPermsMenu(permsEntity[i]);
+      }
+    }
     this.getDepTree();
     this.getMenuTree();
   },

--
Gitblit v1.9.3