From 354cad3d3ab22ba147169beb6a0f6f51b9bab3a8 Mon Sep 17 00:00:00 2001
From: wangting <wangting@vci-tech.com>
Date: 星期三, 08 一月 2025 09:07:22 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/plt-web/plt-web-ui/src/views/authority/function/functionView/index.vue |   66 ++++++++++++++++++++-------------
 1 files changed, 40 insertions(+), 26 deletions(-)

diff --git a/Source/plt-web/plt-web-ui/src/views/authority/function/functionView/index.vue b/Source/plt-web/plt-web-ui/src/views/authority/function/functionView/index.vue
index fa92987..c1d1132 100644
--- a/Source/plt-web/plt-web-ui/src/views/authority/function/functionView/index.vue
+++ b/Source/plt-web/plt-web-ui/src/views/authority/function/functionView/index.vue
@@ -7,7 +7,7 @@
           <div style="height:  calc(100vh - 195px);">
             <avue-tree :data="treeData" :option="treeOption" @node-click="nodeClick">
               <span slot-scope="{ node, data }" class="el-tree-node__label">
-               <span style="font-size: 15px">
+               <span>
                   <i class="el-icon-user-solid"></i>
                     {{ (node || {}).label }}
                 </span>
@@ -22,15 +22,20 @@
       <basic-container v-loading="treeLoading">
         <h3 style="margin: 0 0 10px 0">鍔熻兘鏉冮檺閰嶇疆</h3>
         <div>
-          <el-button icon="el-icon-place" plain size="small" type="primary" @click="saveHandler">鎺堟潈</el-button>
-          <el-button icon="el-icon-close" plain size="small" style="margin-right: 40px;" type="primary"
-                     @click="clearValue">閲嶇疆
+          <el-button v-if="permissionList.rightBtn" class="button-custom-icon" plain size="small" type="primary" @click="saveHandler">
+            <icon-show :name="permissionList.rightBtn.source"></icon-show>
+            鎺堟潈
+          </el-button>
+          <el-button v-if="permissionList.resetBtn" class="button-custom-icon" plain size="small" style="margin-right: 40px;" type="primary"
+                     @click="clearValue">
+            <icon-show :name="permissionList.resetBtn.source"></icon-show>
+            閲嶇疆
           </el-button>
         </div>
         <div style="height:  calc(100vh - 232px);margin-top: 10px;">
           <avue-tree ref="uiTree" :data="uiTreeData" :node-key="id" :option="uiTreeOption">
             <span slot-scope="{ node, data }" class="el-tree-node__label">
-               <span style="font-size: 15px">
+               <span>
                   <i :class="data.icon"></i>
                     {{ (node || {}).label }}
                 </span>
@@ -46,6 +51,7 @@
 <script>
 import {gridRoles} from "@/api/system/role/api";
 import {getSysModelAuthTreeMenuByPID, getSysModelAuth, saveRoleRight} from "@/api/authority/functionView/api"
+import {mapGetters} from "vuex";
 
 export default {
   name: "index",
@@ -83,6 +89,15 @@
       contextData: []
     }
   },
+  computed:{
+    ...mapGetters(["permission"]),
+    permissionList() {
+      return {
+        rightBtn: this.vaildData(this.permission[this.$route.query.id].RIGHT, false),
+        resetBtn: this.vaildData(this.permission[this.$route.query.id].RESET, false),
+      };
+    },
+  },
   created() {
     this.getTreeList();
     this.getUITree();
@@ -103,6 +118,7 @@
       this.treeLoading = true;
       getSysModelAuth({roleId: row.oid}).then(res => {
         const data = res.data.data;
+        // console.log(data);
         this.$refs.uiTree.setCheckedKeys(data);
         this.treeLoading = false;
       })
@@ -118,9 +134,20 @@
       this.defaultExpandKeys = ['root'];
       getSysModelAuthTreeMenuByPID(params).then(res => {
         console.log(res);
-        this.processChildren(res.data.data); // 澶勭悊姣忎釜鑺傜偣
+        let data= [{
+          attributes: {},
+          checked: false,
+          expanded: true,
+          data: "root",
+          childType: 1,
+          icon: 'el-icon-s-home',
+          id: 'root',
+          name:'鍔熻兘妯″潡',
+          children: res.data.data
+        }];
+        this.processChildren(data[0]); // 澶勭悊姣忎釜鑺傜偣
         this.uiTreeOption.defaultExpandedKeys = this.defaultExpandKeys;
-        this.uiTreeData = res.data.data;
+        this.uiTreeData = data;
         this.treeLoading = false;
       }).catch(error => {
         this.treeLoading = false;
@@ -130,25 +157,15 @@
     processChildren(item) {
       if (item.children && item.children.length > 0) {
         item.children = item.children.map(child => {
-          if (child.level < 2) {
-            // 榛樿鏍戣妭鐐瑰睍寮�涓ゅ眰鏁堟灉
+          if (!child.childType) {
+            // 榛樿鏍戣妭鐐瑰睍寮�,鏈�瀛愮骇涓嶅睍寮�
             this.defaultExpandKeys.push(child.id)
           }
-          if (child.level == 1) {
-            child.icon = 'el-icon-s-promotion';
-            child.label = child.data.label + '锛�' + child.data.name + '锛�'
-          } else if (child.level == 2) {
-            child.icon = 'el-icon-s-order';
-            child.label = child.text
-          } else if (child.level == 3) {
-            child.icon = 'el-icon-office-building';
-            child.label = child.text
-          } else if (child.level == 4) {
+          child.icon = 'el-icon-s-promotion';
+          if (child.childType == 1) {
             child.icon = 'el-icon-document';
-            child.label = child.text
-          } else if (child.level == 5) {
+          } else if (child.childType == 2) {
             child.icon = 'el-icon-s-tools';
-            child.label = child.text
           }
           this.processChildren(child); // 閫掑綊澶勭悊姣忎釜瀛愯妭鐐�
           return child; // 鍙繑鍥炲瓙鑺傜偣鐨� attributes
@@ -158,9 +175,6 @@
     saveHandler() {
       const selectTreeList = this.$refs.uiTree.getCheckedNodes();
       const selectParentList = this.$refs.uiTree.getHalfCheckedNodes();
-
-      console.log(selectTreeList);
-      console.log(selectParentList);
 
       if (selectTreeList.length == 0) {
         this.$message.error("璇烽�夋嫨鍔熻兘妯″潡");
@@ -183,12 +197,12 @@
         }
       })
       const data = [...parentData,...formData];
+      data.shift();
       const params = {
         roleId: this.nodeRow.oid,
         roleData: data
       }
       saveRoleRight(params).then(res => {
-        console.log(res);
         if (res.data.code === 200) {
           this.$message.success("鎺堟潈鎴愬姛");
         }

--
Gitblit v1.9.3