edit
This commit is contained in:
@ -17,11 +17,9 @@ export class StaffManagementComponent implements OnInit {
|
||||
@ViewChild('sf', { static: false })
|
||||
sf!: SFComponent;
|
||||
|
||||
url = `/rule?_allow_anonymous=true`;
|
||||
|
||||
searchSchema: SFSchema = {
|
||||
properties: {
|
||||
receiveName: {
|
||||
nameOrPhone: {
|
||||
type: 'string',
|
||||
title: '输入搜索',
|
||||
ui: { placeholder: '手机号码 / 成员姓名' }
|
||||
@ -31,23 +29,21 @@ export class StaffManagementComponent implements OnInit {
|
||||
|
||||
columns: STColumn[] = [
|
||||
{ title: '', index: 'key', type: 'checkbox' },
|
||||
{ title: '员工姓名', index: 'no' },
|
||||
{ title: '手机号码', index: 'description' },
|
||||
{ title: '角色', index: 'description' },
|
||||
{ title: '员工姓名', index: 'name' },
|
||||
{ title: '手机号码', index: 'telephone' },
|
||||
{ title: '角色', render: 'description' },
|
||||
{
|
||||
title: '最后登录时间',
|
||||
index: 'updatedAt',
|
||||
index: 'lastLoginDate',
|
||||
type: 'date'
|
||||
},
|
||||
{
|
||||
title: '成员状态',
|
||||
className: 'text-center',
|
||||
index: 'status',
|
||||
index: 'stateLocked',
|
||||
type: 'badge',
|
||||
badge: {
|
||||
0: { text: '正常', color: 'success' },
|
||||
2: { text: '废弃', color: 'warning' },
|
||||
3: { text: '废弃', color: 'warning' },
|
||||
1: { text: '冻结', color: 'error' }
|
||||
}
|
||||
},
|
||||
@ -60,13 +56,13 @@ export class StaffManagementComponent implements OnInit {
|
||||
},
|
||||
{
|
||||
text: '恢复',
|
||||
iif: item => item.status === 1,
|
||||
click: item => this.action(2)
|
||||
iif: item => item.stateLocked === 1,
|
||||
click: item => this.action(item, 2)
|
||||
},
|
||||
{
|
||||
text: '冻结',
|
||||
iif: item => item.status === 0,
|
||||
click: item => this.action(1)
|
||||
iif: item => item.stateLocked === 0,
|
||||
click: item => this.action(item, 1)
|
||||
},
|
||||
{
|
||||
text: '超管转授',
|
||||
@ -75,8 +71,8 @@ export class StaffManagementComponent implements OnInit {
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
iif: item => item.status === 1,
|
||||
click: item => this.action(3)
|
||||
iif: item => item.stateLocked === 0,
|
||||
click: item => this.action(item, 3)
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -84,8 +80,6 @@ export class StaffManagementComponent implements OnInit {
|
||||
|
||||
selectedRows: any[] = [];
|
||||
|
||||
reqParams = { pageIndex: 1, pageSize: 10 };
|
||||
|
||||
actionLabel = {
|
||||
1: { title: '确认冻结?', text: '冻结后用户在本系统将无法登录使用,请谨慎操作!' },
|
||||
2: { title: '确认恢复?', text: '恢复后用户在本系统的权限将一并重新开启。' },
|
||||
@ -100,13 +94,10 @@ export class StaffManagementComponent implements OnInit {
|
||||
case 'checkbox':
|
||||
this.selectedRows = e.checkbox!;
|
||||
break;
|
||||
case 'filter':
|
||||
this.st.load();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
action(type: 1 | 2 | 3) {
|
||||
action(item: any, type: 1 | 2 | 3) {
|
||||
this.nzModalService.error({
|
||||
nzTitle: this.actionLabel[type].title,
|
||||
nzContent: `<label class="error-color">${this.actionLabel[type].text}</label>`,
|
||||
@ -115,6 +106,13 @@ export class StaffManagementComponent implements OnInit {
|
||||
nzOnOk: () => {
|
||||
switch (type) {
|
||||
case 1:
|
||||
this.freeOrResumStaff({ appUserId: item.appUserId, freezeOrResume: true });
|
||||
break;
|
||||
case 2:
|
||||
this.freeOrResumStaff({ appUserId: item.appUserId, freezeOrResume: false });
|
||||
break;
|
||||
case 3:
|
||||
this.deleteStaff([item.appUserId]);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -138,11 +136,13 @@ export class StaffManagementComponent implements OnInit {
|
||||
staffAction(item?: any) {
|
||||
const modal = this.nzModalService.create({
|
||||
nzContent: SystemStaffStaffModalComponent,
|
||||
nzComponentParams: item ? { i: { ...item, roleId: '1,2,3', name: '用户名', phone: 18555555555 } } : { i: { id: 0 } },
|
||||
nzComponentParams: item ? { i: { ...item } } : { i: { userId: 0 } },
|
||||
nzFooter: null
|
||||
});
|
||||
modal.afterClose.subscribe(res => {
|
||||
this.st.load();
|
||||
if (true) {
|
||||
this.st.load();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -152,4 +152,22 @@ export class StaffManagementComponent implements OnInit {
|
||||
resetSF() {
|
||||
this.sf.reset();
|
||||
}
|
||||
|
||||
private deleteStaff(params: any) {
|
||||
this.service.request(this.service.$api_delete_staff, params).subscribe(res => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success('操作成功');
|
||||
this.st.load();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private freeOrResumStaff(params: any) {
|
||||
this.service.request(this.service.$api_free_or_resume_staff, params).subscribe(res => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success('操作成功');
|
||||
this.st.load();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user