This commit is contained in:
Taric Xin
2022-01-04 17:18:05 +08:00
parent 9a6818fb7e
commit a6a0a9f7fb
10 changed files with 59 additions and 175 deletions

View File

@ -8,8 +8,7 @@ import { SystemService } from '../../../services/system.service';
@Component({
selector: 'app-system-add',
templateUrl: './staff-modal.component.html',
styleUrls: ['./staff-modal.less']
templateUrl: './staff-modal.component.html'
})
export class SystemStaffStaffModalComponent implements OnInit {
@ViewChild('sf', { static: false })
@ -17,20 +16,12 @@ export class SystemStaffStaffModalComponent implements OnInit {
i: any;
schema!: SFSchema;
ui!: SFUISchema;
roleList = [];
roleNames: any = [];
constructor(private modal: NzModalRef, public msgSrv: NzMessageService, public service: SystemService) {}
ngOnInit(): void {
if (this.i?.userId !== 0) {
// this.i.roleIds = this.i.roleId !== '' ? this.i.roleId.split(',') : [];
}
this.initSF(this.i);
}
initSF(staff: any) {
console.log(staff);
this.schema = {
properties: {
staffName: {
@ -59,10 +50,11 @@ export class SystemStaffStaffModalComponent implements OnInit {
asyncData: () => {
return this.service.request(this.service.$api_getAppRoleList).pipe(
map((res: any) => {
this.roleList = res;
return res.map((item: any) => {
return { label: item.roleName, value: item.id };
});
return res
.filter((role: any) => role.roleCode !== 'Administrator')
.map((item: any) => {
return { label: item.roleName, value: item.id };
});
})
);
}
@ -81,10 +73,10 @@ export class SystemStaffStaffModalComponent implements OnInit {
}
sure() {
// if (!this.sf.value.roleIds || this.sf.value.roleIds.length === 0) {
// this.service.msgSrv.error('员工角色不能为空!');
// return;
// }
if (!this.sf.value.roleId || this.sf.value.roleId.length === 0) {
this.service.msgSrv.error('员工角色不能为空!');
return;
}
if (this.i.userId === 0) {
const params: any = {
...this.sf.value,