edit
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { AfterViewInit, ChangeDetectorRef, Component, OnChanges, OnInit, ViewChild } from '@angular/core';
|
||||
import { SFComponent, SFSchema, SFSchemaEnumType, SFUISchema } from '@delon/form';
|
||||
import { _HttpClient } from '@delon/theme';
|
||||
import { EAEnvironmentService } from '@shared';
|
||||
import { NzModalRef } from 'ng-zorro-antd/modal';
|
||||
import { of } from 'rxjs';
|
||||
import { delay, map } from 'rxjs/operators';
|
||||
@ -26,16 +27,12 @@ export class SettingRoleEditComponent implements OnInit {
|
||||
schema!: SFSchema;
|
||||
authority: any[] = [];
|
||||
roleTplData: any[] = [];
|
||||
appId = '';
|
||||
ui!: SFUISchema;
|
||||
constructor(private modal: NzModalRef, public service: SystemService, public http: _HttpClient, private cdr: ChangeDetectorRef) {}
|
||||
constructor(private modal: NzModalRef, public service: SystemService, private envSrv: EAEnvironmentService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
console.log('i', this.i, this.source);
|
||||
if (this.i.id) {
|
||||
this.getRoleInfo();
|
||||
} else {
|
||||
this.getTplList();
|
||||
}
|
||||
if (this.source === '') {
|
||||
this.initSF();
|
||||
@ -97,9 +94,7 @@ export class SettingRoleEditComponent implements OnInit {
|
||||
})
|
||||
);
|
||||
}
|
||||
getTplList() {
|
||||
// this.menu.getAllFunction();
|
||||
}
|
||||
|
||||
getRoleInfo() {
|
||||
const params = {
|
||||
id: this.i.id
|
||||
@ -111,7 +106,6 @@ export class SettingRoleEditComponent implements OnInit {
|
||||
if (this.source === '') {
|
||||
this.initSF();
|
||||
}
|
||||
this.getTplList();
|
||||
});
|
||||
}
|
||||
getData(res: { authority: any[]; authorityAssistId: any[] }) {
|
||||
@ -122,30 +116,39 @@ export class SettingRoleEditComponent implements OnInit {
|
||||
this.modal.destroy();
|
||||
}
|
||||
sure() {
|
||||
this.menu.washTree();
|
||||
if (this.authorityAssistId.length === 0) {
|
||||
this.service.msgSrv.warning('请选择权限!');
|
||||
return;
|
||||
}
|
||||
// this.menu.washTree();
|
||||
// if (this.authorityAssistId.length === 0) {
|
||||
// this.service.msgSrv.warning('请选择权限!');
|
||||
// return;
|
||||
// }
|
||||
console.log(this.menu.nzTreeComponent.getCheckedNodeList());
|
||||
const selectedFun = this.menu?.nzTreeComponent?.getCheckedNodeList()?.map(node => ({ authorityId: node.key }));
|
||||
const authorityAssistId = selectedFun?.map(node => node.authorityId);
|
||||
const params: any = {
|
||||
id: this.i.id,
|
||||
...this.sf.value,
|
||||
authority: this.authority,
|
||||
authorityAssistId: this.authorityAssistId
|
||||
authority: selectedFun,
|
||||
authorityAssistId: authorityAssistId
|
||||
};
|
||||
if (this.sf) {
|
||||
this.appList.forEach(item => {
|
||||
if (item.appId === this.sf.value.appId) {
|
||||
params.tenantId = item.tenantId;
|
||||
}
|
||||
});
|
||||
}
|
||||
delete params.tplId;
|
||||
// if (this.sf) {
|
||||
// this.appList.forEach(item => {
|
||||
// if (item.appId === this.sf.value.appId) {
|
||||
// params.tenantId = item.tenantId;
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// delete params.tplId;
|
||||
if (this.i.id === 0) {
|
||||
delete params.id;
|
||||
}
|
||||
this.service.request(this.service.$api_updateRoleInfo, params).subscribe(res => {
|
||||
this.modal.close(true);
|
||||
});
|
||||
if (this.i.id) {
|
||||
this.service.request(this.service.$api_update_role, params).subscribe(res => {
|
||||
this.modal.close(true);
|
||||
});
|
||||
} else {
|
||||
this.service.request(this.service.$api_save_role, params).subscribe(res => {
|
||||
this.modal.close(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user