diff --git a/src/app/routes/sys-setting/components/staff-management/staff-management.component.ts b/src/app/routes/sys-setting/components/staff-management/staff-management.component.ts index 09a2f96a..b1840925 100644 --- a/src/app/routes/sys-setting/components/staff-management/staff-management.component.ts +++ b/src/app/routes/sys-setting/components/staff-management/staff-management.component.ts @@ -31,7 +31,7 @@ export class StaffManagementComponent implements OnInit { { title: '', index: 'key', type: 'checkbox' }, { title: '员工姓名', index: 'name' }, { title: '手机号码', index: 'telephone' }, - { title: '角色', render: 'description' }, + { title: '角色', index: 'roleName' }, { title: '最后登录时间', index: 'lastLoginDate', @@ -136,7 +136,7 @@ export class StaffManagementComponent implements OnInit { staffAction(item?: any) { const modal = this.nzModalService.create({ nzContent: SystemStaffStaffModalComponent, - nzComponentParams: item ? { i: { ...item } } : { i: { userId: 0 } }, + nzComponentParams: item ? { i: { ...item, roleId: (item.roleId as string)?.split(',') || [] } } : { i: { userId: 0 } }, nzFooter: null }); modal.afterClose.subscribe(res => { diff --git a/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.component.ts b/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.component.ts index 3c0b4749..7af499c1 100644 --- a/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.component.ts +++ b/src/app/routes/sys-setting/components/staff-management/staff-modal/staff-modal.component.ts @@ -3,6 +3,7 @@ import { SFComponent, SFSchema, SFUISchema } from '@delon/form'; import { _HttpClient } from '@delon/theme'; import { NzMessageService } from 'ng-zorro-antd/message'; import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; +import { map } from 'rxjs/operators'; import { SystemService } from '../../../services/system.service'; @Component({ @@ -53,22 +54,24 @@ export class SystemStaffStaffModalComponent implements OnInit { placeholder: '请选择员工角色', mode: 'multiple', maxMultipleCount: 5, - // 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 }; - // }); - // }), - // ); - // }, + 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 }; + }); + }), + ); + }, change: (i: any) => { - this.sf.value.roleIds = i; - this.sf?.setValue('/roleIds', i); + console.log(i); + + // this.sf.value.roleIds = i; + // this.sf?.setValue('/roleIds', i); } }, - default: staff?.roleIds + default: staff?.roleId } }, required: ['staffName', 'telephone'] @@ -90,7 +93,6 @@ export class SystemStaffStaffModalComponent implements OnInit { const params: any = { ...this.sf.value, enterpriseId: 0, - roleId: [] }; this.service.request(this.service.$api_add_staff, params).subscribe(res => { if (res) { @@ -102,7 +104,6 @@ export class SystemStaffStaffModalComponent implements OnInit { const params: any = { appUserId: this.i.appUserId, ...this.sf.value, - roleId: [] }; this.service.request(this.service.$api_edit_staff, params).subscribe(res => { if (res) { diff --git a/src/app/routes/sys-setting/services/system.service.ts b/src/app/routes/sys-setting/services/system.service.ts index 31125e27..26d49caf 100644 --- a/src/app/routes/sys-setting/services/system.service.ts +++ b/src/app/routes/sys-setting/services/system.service.ts @@ -34,6 +34,8 @@ export class SystemService extends BaseService { $api_dalete_role = '/api/mdc/cuc/roleInfo/removeRoleInfo'; // 获取角色详情 $api_getRoleInfo = '/api/mdc/cuc/roleInfo/getRoleInfo'; + // 获取角色列表 + $api_getAppRoleList = '/api/mdc/cuc/roleInfo/getRoleList'; // 查询字典选项列表 $api_get_dict_page = '/api/mdc/pbc/dictItems/list/page';