From 3fce634eeb56f9425d5e745b1d4333da962fc3d7 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期五, 25 八月 2023 11:19:10 +0800
Subject: [PATCH] 1.新增功能菜单

---
 src/views/basicSettings/powerDivider.vue |   40 +++++++++++++++++++++++++++++++---------
 1 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/src/views/basicSettings/powerDivider.vue b/src/views/basicSettings/powerDivider.vue
index eabdde9..4a55af6 100644
--- a/src/views/basicSettings/powerDivider.vue
+++ b/src/views/basicSettings/powerDivider.vue
@@ -46,6 +46,8 @@
           <el-button
             style="position: absolute;right: 15px;z-index:1;top:3px"
             type="primary"
+            :loading="$store.state.app.buttonIsDisabled"
+            :disabled="$store.state.app.buttonIsDisabled"
             @click="saveClick"
           >淇� 瀛�
           </el-button>
@@ -55,7 +57,7 @@
               <div style="display: flex;">
                 <div
                   ref="scrollLeft"
-                  style="border-right: 1px solid rgba(0,0,0,0.2);width: 220px;
+                  style="border-right: 1px solid rgba(0,0,0,0.2);width:260px;
                   overflow-y: auto;overflow-x:hidden;"
                   :style="{height:(tableHeight-40)+'px'}"
                   @scroll="scrollLeftScroll()"
@@ -81,7 +83,7 @@
                 </div>
                 <div
                   ref="scrollCenter"
-                  style="width: 660px;padding-left: 10px;overflow-y: auto"
+                  style="width: calc(100% - 260px );padding-left: 10px;overflow-y: auto"
                   :style="{height:(tableHeight-40)+'px'}"
                   @scroll="scrollCenterScroll()"
                   @mouseover="isScroll='center'"
@@ -178,12 +180,15 @@
 
       allButtonData: [], // 鎵�鏈夎彍鍗曞搴旂殑鎸夐挳鏉冮檺鍔犳暟鎹潈闄�
 
-      isScroll: 'left'
+      isScroll: 'left',
+
+      ButtonData: JSON.parse(localStorage.getItem('ButtonData'))
 
     }
   },
 
   created() {
+
   },
   mounted() {
     window.addEventListener('resize', this.getHeight)
@@ -198,14 +203,19 @@
       const { data: res } = await RolePermissionSearchRole()
       this.treeLeft = res
 
+      let rolecode = ''
+      if (window.location.hash.indexOf('?') !== -1) {
+        rolecode = window.location.hash.split('?')[1].split('=')[1]
+      }
+
       if (res && res.length > 0) {
         this.$nextTick(() => { // 榛樿閫変腑绗竴涓�
-          this.$refs.treeLeftRef.setCurrentKey(res[0].code) // 榛樿閫変腑鑺傜偣绗竴涓�
+          this.$refs.treeLeftRef.setCurrentKey(rolecode || res[0].code) // 榛樿閫変腑鑺傜偣绗竴涓�
         })
 
-        await this.getRolePermissionSearchRoleMenuButton(res[0].code)// 鐢ㄤ簬鏁版嵁鍥炴樉
+        await this.getRolePermissionSearchRoleMenuButton(rolecode || res[0].code)// 鐢ㄤ簬鏁版嵁鍥炴樉
 
-        await this.getRolePermissionSearchRoleMenu(res[0].code)// 鐢ㄤ簬娓叉煋椤甸潰
+        await this.getRolePermissionSearchRoleMenu(rolecode || res[0].code)// 鐢ㄤ簬娓叉煋椤甸潰
       } else {
         this.$notify.error('璇峰厛寤虹浉瀵瑰簲鐨勮鑹诧紒')
       }
@@ -236,7 +246,7 @@
           item.children.forEach(it => {
             it.buttoncodelist = it.buttoncodelist !== '' && it.buttoncodelist !== null ? it.buttoncodelist.split(',') : []
             if (it.buttoncodelist && it.buttoncodelist.length > 0) {
-              it.buttoncodelist = this.$ButtonData.filter(j =>
+              it.buttoncodelist = this.ButtonData.filter(j =>
                 it.buttoncodelist.includes(j.buttoncode)
               )
 
@@ -263,7 +273,7 @@
             let temp = this.allButtonData.filter(j => j.menucode === it.menucode).length > 0 ? this.allButtonData.filter(j => j.menucode === it.menucode)[0].buttoncode : []
             temp = temp.length > 0 ? temp.split(',') : []
             it.buttonChecked = [] // 鏁版嵁鍥炴樉
-            this.$ButtonData.forEach(j => {
+            this.ButtonData.forEach(j => {
               if (temp.includes(j.buttoncode)) {
                 it.buttonChecked.push(j.buttonname)
               }
@@ -417,7 +427,7 @@
           item.children.forEach(it => {
             if (menuKeyArr.includes(it.menucode)) {
               if (it.buttonChecked && it.buttonChecked.length > 0) { // 宸查�夎彍鍗�
-                it.buttonCheckedCode = this.$ButtonData.filter(i =>
+                it.buttonCheckedCode = this.ButtonData.filter(i =>
                   it.buttonChecked.includes(i.buttonname)
                 ).map(i => i.buttoncode)
               }
@@ -430,11 +440,14 @@
           })
         }
       })
+      this.$store.state.app.buttonIsDisabled = true
+
       const res = await RolePermissionSava(JSON.stringify(arr), rolecode, this.activeName)
       if (res.code === '200') {
         const rolename = this.treeLeft.find(i => i.code === rolecode).name
         this.$notify.success(rolename + '鐨勮鑹叉潈闄愭彁浜ゆ垚鍔燂紒')
         await this.getRolePermissionSearchRoleMenuButton(rolecode)
+        this.$store.state.app.buttonIsDisabled = false
       }
     },
     // 鑾峰彇椤甸潰楂樺害
@@ -463,4 +476,13 @@
 ::v-deep .el-checkbox__label {
   width: 55px;
 }
+
+.el-checkbox-group {
+  margin-left: 0 !important;
+  padding-left: 40px;
+}
+
+.el-checkbox-group:hover {
+  background: #f0f7ff;
+}
 </style>

--
Gitblit v1.9.3