This commit is contained in:
wangshiming
2022-04-25 17:21:34 +08:00
parent ff6fd0b801
commit f4743c180b
5 changed files with 33 additions and 16 deletions

View File

@ -62,6 +62,7 @@ export class SettingRoleEditComponent implements OnInit {
}
getRoleInfo() {
this.roleInfoData = []
const params = {
id: this.params.id
};

View File

@ -19,6 +19,7 @@ export class SettingMenuComponent implements OnInit, OnChanges {
defaultCheckedKeys: any[] = [];
functionList: any[] = [];
allChecked = false;
changeIFT = false;
indeterminate = true;
@Input() type = 'edit';
@Input() source = '';
@ -58,7 +59,7 @@ export class SettingMenuComponent implements OnInit, OnChanges {
});
}
addAuthority(origin: { id: any; all: any }, node: { buttonInfoList: any[] }, item?: { checked: any; functionButtonId: any }) {
console.log(origin,node);
console.log(origin);
if (this.authority?.length && this.authority.filter(authItem => authItem.authorityId === origin.id).length) {
// 判断此菜单权限是否已经存在权限列表中
@ -69,6 +70,23 @@ export class SettingMenuComponent implements OnInit, OnChanges {
menuItem.buttonAuthorityIds = menuItem.buttonAuthorityIds || []; // 防止属性不存在,给属性指定数据类型
if (item) {
this.changeIF.emit(true);
this.changeIFT = true
// 判断此菜单下是否已有此按钮权限
// this.againGetBtn(id, origin);
const params = {
id: origin.id
};
this.service.request(this.service.$api_getFunctionButtonInfo, params).subscribe(res => {
if (res) {
let origins: any = {};
origins.buttonInfoList = res;
origins.all = false;
console.log(origins);
// 判断此菜单下是否已有此按钮权限
this.againGetBtn(origin.id, origins);
}
});
// 单选
if (item.checked) {
if (menuItem.buttonAuthorityIds.indexOf(item.functionButtonId) === -1) {
@ -329,7 +347,12 @@ export class SettingMenuComponent implements OnInit, OnChanges {
}
// 再次请求,需要判断暂存权限数组是否已有此权限
againGetBtn(id: any, origin: any) {
if (this.authority && this.authority.length !== 0) {
console.log(id,origin);
console.log(this.authority);
console.log(this.authority.length);
if ((this.authority && this.authority.length !== 0)) {
console.log('1111');
const buttonAuthorityIds: any = [];