edit
This commit is contained in:
@ -2,7 +2,7 @@ import { ChangeDetectorRef, Component, EventEmitter, Input, OnChanges, OnInit, O
|
||||
import { EAEnvironmentService } from '@shared';
|
||||
import { NzFormatEmitEvent, NzTreeComponent, NzTreeNode } from 'ng-zorro-antd/tree';
|
||||
import { SystemService } from '../../../services/system.service';
|
||||
|
||||
// TODO 父节点修改 更新子节点权限点
|
||||
@Component({
|
||||
selector: 'app-menu-tree',
|
||||
templateUrl: './menu-tree.component.html',
|
||||
@ -130,6 +130,7 @@ export class MenuTreeComponent implements OnInit, OnChanges {
|
||||
this.recursionSetNodeAuth(event.node.origin);
|
||||
} else {
|
||||
this.recursionDeleteNodeAuth(event.node?.origin);
|
||||
console.log(this.origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -195,13 +196,6 @@ export class MenuTreeComponent implements OnInit, OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
private recursionDeleteParantNode(node: NzTreeNode) {
|
||||
this.authorityAssistId = this.authorityAssistId.filter(auth => auth !== node.origin.id);
|
||||
if (node.parentNode) {
|
||||
this.recursionDeleteParantNode(node.parentNode);
|
||||
}
|
||||
}
|
||||
|
||||
washTree() {
|
||||
// const checkedNode: any = this.nzTreeComponent.getCheckedNodeList();
|
||||
// const halfCheckedNode: any = this.nzTreeComponent.getHalfCheckedNodeList();
|
||||
@ -222,10 +216,24 @@ export class MenuTreeComponent implements OnInit, OnChanges {
|
||||
if (res) {
|
||||
origin.buttonInfoList = res;
|
||||
origin.all = false;
|
||||
// if (origin.checked) {
|
||||
// res.forEach(auth => this._apiAuthSet.add(auth.functionButtonId));
|
||||
// }
|
||||
// 如果树节点未勾选 剔除源数据中该节点的权限数据
|
||||
if (!origin.checked) {
|
||||
res.forEach(auth => this._apiAuthSet.delete(auth.functionButtonId));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 向上递归取消父节点勾选
|
||||
* 清理勾选数据
|
||||
*
|
||||
* @param node
|
||||
*/
|
||||
private recursionDeleteParantNode(node: NzTreeNode) {
|
||||
this.authorityAssistId = this.authorityAssistId.filter(auth => auth !== node.origin.id);
|
||||
if (node.parentNode) {
|
||||
this.recursionDeleteParantNode(node.parentNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user