From 4c37374149d56aef3f0a923dd5f41f9a01839500 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期四, 18 一月 2024 11:48:58 +0800
Subject: [PATCH] 提交代码

---
 Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue |   46 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 45 insertions(+), 1 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue b/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue
index 66d686c..ed964a5 100644
--- a/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue
+++ b/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue
@@ -108,6 +108,9 @@
       roleList: [],
       //褰撳墠閫変腑鐨勮〃鏍艰
       selectList: [],
+      itemKey: '',
+      addIndex: Number,
+      currentRow: {}
     };
   },
   watch: {
@@ -139,6 +142,7 @@
               let columnItem = {
                 label: item.name,
                 prop: item.id,
+                code: item.code,
                 type: "checkbox",
                 width: 180,
               };
@@ -171,6 +175,8 @@
                 });
                 //console.log(item)
                 this.classifyAuthData.push(item);
+                this.addIndex = this.classifyAuthData.length - 1; //娣诲姞琛屼笅鏍囩瓑浜巆lassifyAuthData鐨勯暱搴�-1
+                // this.roleHandlerMethods(authData.roleId, 'create', this.addIndex)
               })
             }
           });
@@ -184,6 +190,44 @@
   created() {
   },
   methods: {
+    roleHandlerMethods(id, type, index) {
+      if (this.classifyAuthData.length < 0) {
+        return;
+      }
+
+      getButtonsByRoleId({roleId: id, code: 'classifyTree'}).then(res => {
+        // 鎵惧埌this.classifyAuthButton涓病鏈夊搴旂殑灞炴��
+        const filteredItems = this.classifyAuthButton.filter(item => {
+          return !res.data.data.find(x => x.id === item.id);
+        });
+
+        //鎷胯〃鏍煎垪澶村惊鐜拰娌℃湁瀵瑰簲鐨勫睘鎬ц繘琛屾瘮杈�
+        this.classifyAuthHeader.forEach((item) => {
+          if (filteredItems.some(x => x.id === item.prop)) {
+            this.$nextTick(() => {
+              if (this.classifyAuthData[index] !== undefined && this.classifyAuthData[index] !== null) {
+                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.classifyAuthData.forEach((classkey, classIndex) => {
+          if (classkey.classify_view) {
+            this.$set(this.classifyAuthData[classIndex], 'allDisabled', true)
+          }
+        });
+
+        //寮哄埗鍒锋柊琛ㄦ牸
+        this.itemKey = uuidv4();
+      })
+    },
     // 鍏抽棴瀵硅瘽妗�
     closeDialog() {
       this.$emit('update:visible', false);
@@ -192,7 +236,7 @@
     // 瑙掕壊鏀瑰彉鏃�
     roleChange(roleId){
       console.log(roleId);
-      
+
     },
     // 澧炲姞琛�
     addClassifyAuth() {

--
Gitblit v1.9.3