edit
This commit is contained in:
		| @ -66,7 +66,7 @@ export class MenuTreeComponent implements OnInit, OnChanges { | ||||
|     } else { | ||||
|       this._apiAuthSet.delete(item.functionButtonId); | ||||
|     } | ||||
|  | ||||
|     origin._selected = false; | ||||
|     let isHasChecked = false; | ||||
|     const checkedButIds = []; // 当前操作权限中勾选的权限 | ||||
|     // 判断当前操作权限列表的全选状态 | ||||
| @ -103,6 +103,8 @@ export class MenuTreeComponent implements OnInit, OnChanges { | ||||
|   clickTreeNodeAction(event: any): void { | ||||
|     this.origin = event.node.origin; | ||||
|     this.node = event.node; | ||||
|     console.log(this.node); | ||||
|  | ||||
|     // 叶子节点获取操作权限, 非叶子节点则展开 | ||||
|     if (event.node.origin.isLeaf) { | ||||
|       this.initButtonList(event.node.key, event.node.origin); | ||||
| @ -128,9 +130,14 @@ export class MenuTreeComponent implements OnInit, OnChanges { | ||||
|     } else { | ||||
|       if (event.node?.isChecked) { | ||||
|         this.recursionSetNodeAuth(event.node.origin); | ||||
|         if (this.origin.checked) { | ||||
|           this.origin.buttonInfoList.forEach((auth: any) => this._apiAuthSet.add(auth.functionButtonId)); | ||||
|         } | ||||
|       } else { | ||||
|         this.recursionDeleteNodeAuth(event.node?.origin); | ||||
|         console.log(this.origin); | ||||
|         if (!this.origin.checked) { | ||||
|           this.origin.buttonInfoList.forEach((auth: any) => this._apiAuthSet.delete(auth.functionButtonId)); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| @ -140,6 +147,7 @@ export class MenuTreeComponent implements OnInit, OnChanges { | ||||
|     let auths = [...this.authorityAssistId]; | ||||
|     origin.children?.forEach((node: any) => { | ||||
|       auths.push(node.id); | ||||
|       node._selected = true; | ||||
|       const _auth = this._NodeAuthMap.get(node.id); | ||||
|       this._NodeAuthMap.set(node.id, { | ||||
|         authorityId: node.id, | ||||
| @ -220,6 +228,9 @@ export class MenuTreeComponent implements OnInit, OnChanges { | ||||
|         if (!origin.checked) { | ||||
|           res.forEach(auth => this._apiAuthSet.delete(auth.functionButtonId)); | ||||
|         } | ||||
|         if (origin._selected) { | ||||
|           res.forEach(auth => this._apiAuthSet.add(auth.functionButtonId)); | ||||
|         } | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user