From 686e93016c6a8d0353a63ac0bbdeaf8aba4bc053 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期四, 25 一月 2024 11:00:07 +0800
Subject: [PATCH] 分类授权,数据授权进一步测试完善bug修改

---
 Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue |   11 ++++++++---
 Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue |   10 ++++++----
 Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue     |   34 ++++++++++++++++++----------------
 3 files changed, 32 insertions(+), 23 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue b/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
index 9a32e26..5a8e927 100644
--- a/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ClassifyAuthDialog.vue
@@ -99,6 +99,7 @@
 export default {
   name: "classifyAuthDialog.vue",
   props: {
+    // 褰撳墠鐐瑰嚮鑺傜偣鐨勯《灞傝妭鐐�
     classifyData: {
       type: "Object",
       default: "",
@@ -108,6 +109,10 @@
       type: "Boolean",
       default: false,
     },
+    // 褰撳墠鐐瑰嚮鐨勮妭鐐�
+    TreeNode:{
+      type:Object
+    }
   },
   data() {
     return {
@@ -278,7 +283,7 @@
       let form = {
         classifyAuthList: [],
         isCLear: false, //榛樿鏄竻绌�
-        classifyId: this.classifyData.oid,
+        classifyId: this.TreeNode.oid,
       };
       let isRepeat = false;
       if(this.classifyAuthData.length > 0){
@@ -319,7 +324,7 @@
           let data = {
             oid: item.oid,
             roleId: item.roleData,
-            classifyId: this.classifyData.oid,
+            classifyId: this.TreeNode.oid,
             buttonIds: itemButtonList.join(","),
             authType: "classify_auth",
           };
@@ -407,7 +412,7 @@
         });
         // 鑾峰彇璇ュ垎绫讳笅宸叉巿鏉冪殑鍒嗙被鎺堟潈淇℃伅
         getClassifyAuthList({
-          classifyId: this.classifyData.oid,
+          classifyId: this.TreeNode.oid,
           authType: "classify_auth",
         }).then((res) => {
           //console.log(res.data.data);
diff --git a/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue b/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue
index 7b9d11a..d1672f2 100644
--- a/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue
+++ b/Source/UBCS-WEB/src/components/Theme/DataAuthDialog.vue
@@ -85,6 +85,7 @@
 export default {
   name: "dataAuthDialog.vue",
   props: {
+    // 褰撳墠鐐瑰嚮鑺傜偣鐨勯《灞傝妭鐐�
     classifyData: {
       type: "Object",
       default: "",
@@ -94,6 +95,7 @@
       type: "Boolean",
       default: false,
     },
+    // 褰撳墠鐐瑰嚮鐨勮妭鐐�
     TreeNode:{
       type:Object
     }
@@ -149,7 +151,7 @@
         return;
       }
       //filteredItems 鏈巿鏉冩暟缁�
-      getButtonsByRoleId({roleId: id, code: this.TreeNode.id}).then(res => {
+      getButtonsByRoleId({roleId: id, code: this.classifyData.attributes.id}).then(res => {
         const filteredItems = this.classifyAuthButton.filter(item =>
           !res.data.data.some(x => x.id === item.id)
         );
@@ -189,7 +191,7 @@
     async roleChange(row, currentRow) {
       try {
         this.currentRow = currentRow;
-        const res = await getButtonsByRoleId({roleId: row, code: this.TreeNode.id});
+        const res = await getButtonsByRoleId({roleId: row, code: this.classifyData.attributes.id});
 
         const filteredItems = this.classifyAuthButton.filter(item => {
           return !res.data.data.find(x => x.id === item.id);
@@ -271,7 +273,7 @@
       let form = {
         classifyAuthList: [],
         isCLear: false, //榛樿鏄竻绌�
-        classifyId: this.classifyData.oid,
+        classifyId: this.TreeNode.oid,
       };
       let isRepeat = false;
       if (this.classifyAuthData.length > 0) {
@@ -310,7 +312,7 @@
           let data = {
             oid: item.oid,
             roleId: item.roleData,
-            classifyId: this.classifyData.oid,
+            classifyId: this.TreeNode.oid,
             buttonIds: itemButtonList.join(","),
             authType: "data_auth",
           }
@@ -321,20 +323,20 @@
           return;
         }
         // console.log(form)
-        // 璋冪敤淇濆瓨鍒嗙被鎺堟潈鐨勬帴鍙�
-        await saveOrUpdate(form).then(res => {
-          this.$message({
-            type: "success",
-            message: res.data.msg,
-          });
-          // this.isShowDialog = false
-        }, (error) => {
-          window.console.log(error);
-        })
       }else{
         // 涓虹┖璇佹槑鏄竻绌烘巿鏉冨垪琛�
         form.isCLear = true;
       }
+      // 璋冪敤淇濆瓨鍒嗙被鎺堟潈鐨勬帴鍙�
+      await saveOrUpdate(form).then(res => {
+        this.$message({
+          type: "success",
+          message: res.data.msg,
+        });
+        // this.isShowDialog = false
+      }, (error) => {
+        window.console.log(error);
+      })
       this.classifyAuthData = [];
       this.loadAuthPage();
     },
@@ -352,7 +354,7 @@
     },
     loadAuthPage() {
       return new Promise((resolve, reject) => {
-        console.log(this.classifyData);
+        // console.log(this.classifyData);
         getButtonByParentCode({code: this.classifyData.attributes.id}).then(res => {
           // 璁板綍鎸夐挳鏁版嵁
           this.classifyAuthButton = res.data.data;
@@ -392,7 +394,7 @@
           this.roleList = res.data.data.records;
         });
         // 鑾峰彇璇ュ垎绫讳笅宸叉巿鏉冪殑鍒嗙被鎺堟潈淇℃伅
-        getClassifyAuthList({classifyId: this.classifyData.oid, authType: "data_auth"}).then(res => {
+        getClassifyAuthList({classifyId: this.TreeNode.oid, authType: "data_auth"}).then(res => {
           //console.log(res.data.data);
           let authDatas = res.data.data;
           if (authDatas.length > 0) {
diff --git a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
index c891337..d6bc77c 100644
--- a/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
+++ b/Source/UBCS-WEB/src/components/Theme/ThemeClassifyTrees.vue
@@ -123,6 +123,7 @@
         </el-dialog>
         <!-- 鍒嗙被鎺堟潈瀵硅瘽妗�-->
         <classify-auth-dialog
+          :TreeNode="TreeEditObj"
           :classifyData="classifyData"
           :visible.sync="classifyAuthVisible"
         ></classify-auth-dialog>
@@ -779,7 +780,7 @@
         this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒')
         return;
       }
-      this.classifyData = this.nodeClickList;
+      // this.classifyData = this.nodeClickList;
       this.classifyAuthVisible = true;
     },
     // 鏁版嵁鎺堟潈瀵硅瘽妗嗘墦寮�
@@ -788,7 +789,7 @@
         this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉℃暟鎹紒')
         return;
       }
-      this.classifyData = this.nodeClickList;
+      // this.classifyData = this.nodeClickList;
       this.dataAuthVisible = true;
     },
     flowingDependHandler() {
@@ -1153,8 +1154,9 @@
     //鏍戠偣鍑讳簨浠�
     async nodeClick(data) {
       const response = this.findTheTopLevelNode(data,this.Treedata)
-      console.log(response)
-      console.log('response',response.attributes.id)
+      this.classifyData = response;
+      // console.log(response)
+      // console.log('response',response.attributes.id)
       this.allButtons = true;
       getAuthButtonList({classifyId: data.oid, code: "classifyTree", authType: "classify_auth"}).then(res => {
         this.btnAuthList = res.data.data;

--
Gitblit v1.9.3