浏览代码

查看角色权限禁用选择

cxmo 1 年之前
父节点
当前提交
6e5a4ff979
共有 1 个文件被更改,包括 17 次插入16 次删除
  1. 17 16
      src/views/system_manage/newAuthManage.vue

+ 17 - 16
src/views/system_manage/newAuthManage.vue

@@ -15,7 +15,7 @@
             <div class="menu_auth_cont">
                 <h3 style="color:#333;fontSize:14px;">权限设置</h3>
                 <div class="auth-wrap">
-                    <el-tree ref="checkboxTree" :data="authList" :props="{label:'Name',children:'Children',disabled:(node,data)=>{node.disabled=true}}"
+                    <el-tree ref="checkboxTree" :data="authList" :props="{label:'Name',children:'Children',disabled:'Disabled'}"
                         :default-expand-all="false" show-checkbox node-key="MenuId"
                         :default-checked-keys="defaultCheckedKeys">
                     </el-tree>
@@ -81,8 +81,9 @@ export default {
                 this.authList = List || []
                 this.defaultCheckedKeys = ChoiceList.filter((item) => !HalfChoiceList.some((halfItem) =>
                     item === halfItem))
+                const type = this.isLook?'all':''
                 this.authList.forEach(l=>{
-                    this.formatTree(l)
+                    this.formatTree(l,type)
                 })
             })
         },
@@ -103,20 +104,20 @@ export default {
                 if(res.Ret!==200) return 
                 this.$message.success('权限设置成功')
             })
-        }
-    },
-    formatTree(data){
-        if(data.MenuType===2){
-            //同时存一下ParentId
-            //监听check事件,如果是ParentId的check,就把子项从defaultCheckedKeys中删除
-            data.Disabled = true
-        }
-        if(data.Children && data.Children.length){
-            data.Children = data.Children.map(i=>{
-                return this.formatTree(i)
-            })
-        }
-        return data
+        },
+        formatTree(data,type){
+            if(/* data.MenuType===2|| */type==='all'){
+                //同时存一下ParentId
+                //监听check事件,如果是ParentId的check,就把子项从defaultCheckedKeys中删除
+                data.Disabled = true
+            }
+            if(data.Children && data.Children.length){
+                data.Children = data.Children.map(i=>{
+                    return this.formatTree(i,type)
+                })
+            }
+            return data
+        },
     },
     created() {
         //只查看权限 不可编辑