This commit is contained in:
Lingzi
2022-03-25 15:22:32 +08:00
parent c87ca9f9e6
commit 9a0c58504c
3 changed files with 66 additions and 34 deletions

View File

@ -1,14 +1,5 @@
<!-- <nz-spin *ngIf="!i" class="modal-spin"></nz-spin> -->
<div class="serviceBox">
<div class="left"><span style="color:red">* </span>客服人员</div>
<div class="right">
<nz-select [(ngModel)]="appUserId" style="width: 250px;">
<nz-option *ngFor="let item of serviceList" [nzValue]="item.appUserId" [nzLabel]="item.name"></nz-option>
</nz-select>
</div>
</div>
<sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf>
<div class="modal-footer">
<button nz-button type="button" (click)="close()">关闭</button>
<button nz-button type="button" nzType="primary" (click)="submitForm()" [disabled]="!appUserId">确定</button>
<button nz-button type="button" nzType="primary" (click)="submitForm()" [disabled]="!sf?.valid">确定</button>
</div>

View File

@ -1,12 +1,13 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { apiConf } from '@conf/api.conf';
import { cacheConf } from '@conf/cache.conf';
import { SFUISchema, SFSchema, SFUploadWidgetSchema, SFComponent, SFSelectWidgetSchema } from '@delon/form';
import { SFUISchema, SFSchema, SFUploadWidgetSchema, SFComponent, SFSelectWidgetSchema, SFSchemaEnum } from '@delon/form';
import { _HttpClient } from '@delon/theme';
import { EACacheService, EAEnvironmentService } from '@shared';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { NzUploadFile } from 'ng-zorro-antd/upload';
import { Observable, Observer, of } from 'rxjs';
import { map } from 'rxjs/operators';
import { UsermanageService } from 'src/app/routes/usercenter/services/usercenter.service';
@Component({
@ -19,7 +20,8 @@ export class ShowServiceComponent implements OnInit {
appUserId = ''
record: any = {};
i: any;
serviceList: any = [];
ui!: SFUISchema;
schema!: SFSchema;
constructor(
private modal: NzModalRef,
@ -27,27 +29,64 @@ export class ShowServiceComponent implements OnInit {
) { }
ngOnInit(): void {
this.initData()
this.initSF()
}
close(): void {
this.modal.close(true)
}
initData(){
this.service.request(this.service.$api_getStaffList).subscribe(res => {
this.serviceList = res
})
}
submitForm(){
const params:any = {
appUserId: this.appUserId,
};
this.service.request(this.service.$api_getStaffList, params).subscribe(res => {
if(res){
this.service.msgSrv.success('分配成功')
this.modal.close(true)
}
})
}
initSF() {
this.schema = {
properties: {
_$expand: { type: 'boolean', ui: { hidden: true } },
customerServiceId: {
title: '客服人员',
type: 'string',
ui: {
widget: 'select',
asyncData: () => {
const params = {
// enterpriseId: 1,
// enterpriseProjectId: this.i.mainProjectId,
}
return this.service.request(this.service.$api_getStaffList, params).pipe(
map((res: any) => {
return res.map((i: any) => {
return { label: i.name, value: i.appUserId };
});
}),
);
// serverSearch: true,
// searchDebounceTime: 300,
// searchLoadingText: '搜索中...',
// onSearch: (q: any) => {
// if (!!q) {
// return this.service
// .request(this.service.$api_getStaffList, {
// nameOrPhone: q
// })
// .pipe(map((res: any) => (res?.records as any[]).map(i => ({ name: i.name, value: i.appUserId } as SFSchemaEnum))))
// .toPromise();
// } else {
// return of([]);
// }
},
} as SFSelectWidgetSchema
}
},
required: ['customerServiceId']
};
}
close(): void {
this.modal.close(true)
}
submitForm() {
const params: any = {
...this.sf.value,
enterpriseIdList: [this.i.id]
};
this.service.request(this.service.$api_distributionCusService, params).subscribe(res => {
if (res) {
this.service.msgSrv.success('分配成功')
this.modal.close(true)
}
})
}
}

View File

@ -162,6 +162,8 @@ export class UsermanageService extends ShipperBaseService {
$api_getEnterpriceRel = '/api/mdc/enterpriceRelLog/getEnterpriceRel';
// 员工列表
$api_getStaffList = '/api/mdc/cuc/userApp/getStaffList';
// 分配客服人员
$api_distributionCusService = '/api/mdc/cuc/enterpriseInfo/operate/distributionCusService';
constructor(public injector: Injector, public nzModalService: NzModalService, private nzImageService: NzImageService) {
super(injector);