From e30d67f3b88515759bc468962375a2e1b07bf655 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期五, 26 一月 2024 15:45:12 +0800
Subject: [PATCH] 数据授权新需求(百分之七十)

---
 Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue |   33 ++++++++++++++++++---------------
 1 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue b/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
index 5a8e927..9ee7e77 100644
--- a/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
@@ -136,7 +136,9 @@
   },
   computed: {},
   mounted() {},
-  created() {},
+  created() {
+    this.addIndex = this.classifyAuthData.length <= 0 ? 0 :this.classifyAuthData.length -1;
+  },
   watch: {
     // 鐩戝惉鐖剁粍浠朵紶鐨勭獥鍙f樉绀洪殣钘忕殑鍊�
     visible() {
@@ -165,24 +167,26 @@
                 Object.keys(this.classifyAuthData[index]).forEach((key) => {
                   this.$set(this.classifyAuthData[index].authButton,item.code,true);
                 });
+
+                //娣诲姞 鈥滄煡鐪嬪叏閮ㄧ鐢ㄦ潯浠垛��
+                if (item.code === "classify_view") {
+                  this.$set(this.classifyAuthData[index].authButton, "allDisabled", true);
+                  console.log(this.classifyAuthData[index].authButton.allDisabled)
+                }
+
               } else {
                 Object.keys(this.classifyAuthData[index]).forEach((key) => {
                   this.$set(this.classifyAuthData[index].authButton,item.code,false);
                 });
+
+                if(item.code === "classify_view"){
+                  this.classifyAuthData[index].authButton.allDisabled = false;
+                }
               }
             }
           });
         });
-        //娣诲姞 鈥滄煡鐪嬪叏閮ㄧ鐢ㄦ潯浠垛��
-        if (this.classifyAuthData) {
-          this.classifyAuthData.forEach((classkey, classIndex) => {
-            if (classkey.authButton.classify_view) {
-              this.$set(this.classifyAuthData[classIndex].authButton,"allDisabled",true);
-            } else {
-              this.classifyAuthData[classIndex].authButton.allDisabled = false;
-            }
-          });
-        }
+
         //寮哄埗鍒锋柊琛ㄦ牸
         this.itemKey = uuidv4();
       });
@@ -238,8 +242,7 @@
         this.$message.warning("褰撳墠绉熸埛涓嶅瓨鍦ㄨ鑹蹭俊鎭紒");
         return;
       }
-      // console.log('this.roleList', this.roleList)
-      this.addIndex++; //鑷畾涔夌敓鎴愭坊鍔犺涓嬫爣
+
       let item = {
         roleData: this.roleList[0].id,
         classifyItem: this.classifyData.label,
@@ -253,6 +256,7 @@
       });
       this.classifyAuthData.push(item);
       this.roleHandlerMethods(this.roleList[0].id, "add", this.addIndex);
+      this.addIndex++; //鑷畾涔夌敓鎴愭坊鍔犺涓嬫爣
     },
     // 鍒犻櫎琛�
     subClassifyAuth() {
@@ -305,7 +309,7 @@
           this.$message.warning("瑙掕壊鍜屽垎绫诲凡缁忓瓨鍦紝璇烽噸鏂伴厤缃紒");
           return;
         }
-        
+
         let flag = false;
         this.classifyAuthData.forEach((item) => {
           let itemButtonList = [];
@@ -432,7 +436,6 @@
                 Vue.set(item, data, true);
               });
               this.classifyAuthData.push(item);
-              this.addIndex = this.classifyAuthData.length - 1; //娣诲姞琛屼笅鏍囩瓑浜巆lassifyAuthData鐨勯暱搴�-1
               this.roleHandlerMethods(authData.roleId, "create", index);
               // console.log('index', index)
             });

--
Gitblit v1.9.3