From 9a0c58504cee1842c0bd86a7fe81eb0e105023bc Mon Sep 17 00:00:00 2001 From: Lingzi Date: Fri, 25 Mar 2022 15:22:32 +0800 Subject: [PATCH] fix bug --- .../showService/showService.component.html | 13 +-- .../list/showService/showservice.component.ts | 85 ++++++++++++++----- .../usercenter/services/usercenter.service.ts | 2 + 3 files changed, 66 insertions(+), 34 deletions(-) diff --git a/src/app/routes/usercenter/components/freight/list/showService/showService.component.html b/src/app/routes/usercenter/components/freight/list/showService/showService.component.html index 2c4deeca..82ea63f2 100644 --- a/src/app/routes/usercenter/components/freight/list/showService/showService.component.html +++ b/src/app/routes/usercenter/components/freight/list/showService/showService.component.html @@ -1,14 +1,5 @@ - - -
-
* 客服人员
-
- - - -
-
+ \ No newline at end of file diff --git a/src/app/routes/usercenter/components/freight/list/showService/showservice.component.ts b/src/app/routes/usercenter/components/freight/list/showService/showservice.component.ts index d0e4b01e..107bdbd2 100644 --- a/src/app/routes/usercenter/components/freight/list/showService/showservice.component.ts +++ b/src/app/routes/usercenter/components/freight/list/showService/showservice.component.ts @@ -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) + } + }) + } } diff --git a/src/app/routes/usercenter/services/usercenter.service.ts b/src/app/routes/usercenter/services/usercenter.service.ts index 47557dbb..6bd733d5 100644 --- a/src/app/routes/usercenter/services/usercenter.service.ts +++ b/src/app/routes/usercenter/services/usercenter.service.ts @@ -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);