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