From 0943f51b2ecb9e2a456ea9ee9245d52f98c78177 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期四, 18 一月 2024 17:02:51 +0800
Subject: [PATCH] 数据授权整合代码

---
 Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue |   35 ++++++++++++++++++++++++++++-------
 1 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue b/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
index 36c9fe1..7024c51 100644
--- a/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
@@ -176,7 +176,8 @@
                 });
                 this.classifyAuthData.push(item);
                 this.addIndex = this.classifyAuthData.length - 1; //娣诲姞琛屼笅鏍囩瓑浜巆lassifyAuthData鐨勯暱搴�-1
-                this.roleHandlerMethods(authData.roleId, 'create', this.addIndex)
+                this.roleHandlerMethods(authData.roleId, 'create', index)
+                console.log('index', index)
               })
             }
           });
@@ -200,16 +201,33 @@
         const filteredItems = this.classifyAuthButton.filter(item => {
           return !res.data.data.find(x => x.id === item.id);
         });
-
+        console.log('绂佺敤鎸夐挳',filteredItems)
+        console.log('涓嶇鐢ㄦ寜閽�',res.data.data)
         //鎷胯〃鏍煎垪澶村惊鐜拰娌℃湁瀵瑰簲鐨勫睘鎬ц繘琛屾瘮杈�
         this.classifyAuthHeader.forEach((item) => {
-          if (filteredItems.some(x => x.id === item.prop)) {
+          const isMatched = filteredItems.some(x => x.id === item.prop);
+          if (isMatched) {
             this.$nextTick(() => {
-              if (this.classifyAuthData[index] !== undefined && this.classifyAuthData[index] !== null) {
+              if (this.classifyAuthData[index]) {
+                Object.keys(this.classifyAuthData[index]).forEach((key) => {
+
+                    if (this.classifyAuthData[index].classify_view) {
+                      this.$set(this.classifyAuthData[index], item.code, true);
+                    } else {
+                      this.classifyAuthData[index][item.code] = false;
+                    }
+                    // console.log(item.code)
+                    // this.$set(this.classifyAuthData[index], item.code, true);
+
+                });
+              }
+            })
+          } else {
+            this.$nextTick(() => {
+              if (this.classifyAuthData[index]) {
                 Object.keys(this.classifyAuthData[index]).forEach((key) => {
                   if (item.prop === key) {
-                    // this.classifyAuthData[index] = Object.assign({}, this.classifyAuthData[index], {[key]: undefined});
-                    this.$set(this.classifyAuthData[index], item.code, true);
+                    this.$set(this.classifyAuthData[index], item.code, false);
                   }
                 });
               }
@@ -221,9 +239,11 @@
         this.classifyAuthData.forEach((classkey, classIndex) => {
           if (classkey.classify_view) {
             this.$set(this.classifyAuthData[classIndex], 'allDisabled', true)
+          } else {
+            this.classifyAuthData[classIndex].allDisabled = false;
           }
         });
-        console.log(this.classifyAuthData)
+        console.log('classifyAuthData',this.classifyAuthData)
         //寮哄埗鍒锋柊琛ㄦ牸
         this.itemKey = uuidv4();
       })
@@ -358,6 +378,7 @@
           roleId: item.roleData,
           classifyId: this.classifyData.oid,
           buttonIds: itemButtonList.join(","),
+          authType: "classify_auth",
         }
         form.push(data);
       });

--
Gitblit v1.9.3