Browse Source

补充注释

cxmo 1 year ago
parent
commit
4ebfbdf90f
1 changed files with 5 additions and 5 deletions
  1. 5 5
      src/views/system_manage/newAuthManage.vue

+ 5 - 5
src/views/system_manage/newAuthManage.vue

@@ -121,19 +121,20 @@ export default {
             if(/* data.MenuType===2|| */type==='all'){
                 data.Disabled = true
             }
+            //非叶子节点递归
             if(data.Children && data.Children.length){
                 data.Children = data.Children.map(i=>{
                     return this.formatTree(i,type)
                 })
             }
-            if(data.Children&&data.Children.length===0){
+            if(!data.Children||data.Children&&data.Children.length===0){
                 //叶子节点向上检查MenuId
                 this.checkDataList(data)
             }
             return data
         },
         //根据MenuId找到对应节点
-        findTree(MenuId){
+        findTreeNode(MenuId){
             return this.$refs.checkboxTree.getNode(MenuId)
         },
         checkDataList(data){
@@ -144,10 +145,9 @@ export default {
                 index!==-1&&this.checkList.splice(index,1)
                 console.log('应该去除的节点',data.ParentId)
             }
-            //console.log('data',data.ParentId)
-            const parentNode = this.findTree(data.ParentId)
+            //向上检查MenuId
+            const parentNode = this.findTreeNode(data.ParentId)
             if(parentNode){
-                //console.log('node?',parentNode.data)
                 this.checkDataList(parentNode.data)
             }
         }