fix bug
This commit is contained in:
		| @ -1,14 +1,5 @@ | |||||||
|  | <sf #sf [schema]="schema" [ui]="ui" [compact]="true" [button]="'none'"></sf> | ||||||
| <!-- <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> |  | ||||||
| <div class="modal-footer"> | <div class="modal-footer"> | ||||||
|     <button nz-button type="button" (click)="close()">关闭</button> |     <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> | </div> | ||||||
| @ -1,12 +1,13 @@ | |||||||
| import { Component, OnInit, ViewChild } from '@angular/core'; | import { Component, OnInit, ViewChild } from '@angular/core'; | ||||||
| import { apiConf } from '@conf/api.conf'; | import { apiConf } from '@conf/api.conf'; | ||||||
| import { cacheConf } from '@conf/cache.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 { _HttpClient } from '@delon/theme'; | ||||||
| import { EACacheService, EAEnvironmentService } from '@shared'; | import { EACacheService, EAEnvironmentService } from '@shared'; | ||||||
| import { NzModalRef } from 'ng-zorro-antd/modal'; | import { NzModalRef } from 'ng-zorro-antd/modal'; | ||||||
| import { NzUploadFile } from 'ng-zorro-antd/upload'; | import { NzUploadFile } from 'ng-zorro-antd/upload'; | ||||||
| import { Observable, Observer, of } from 'rxjs'; | import { Observable, Observer, of } from 'rxjs'; | ||||||
|  | import { map } from 'rxjs/operators'; | ||||||
| import { UsermanageService } from 'src/app/routes/usercenter/services/usercenter.service'; | import { UsermanageService } from 'src/app/routes/usercenter/services/usercenter.service'; | ||||||
|  |  | ||||||
| @Component({ | @Component({ | ||||||
| @ -19,7 +20,8 @@ export class ShowServiceComponent implements OnInit { | |||||||
|   appUserId = '' |   appUserId = '' | ||||||
|   record: any = {}; |   record: any = {}; | ||||||
|   i: any; |   i: any; | ||||||
|   serviceList: any = []; |   ui!: SFUISchema; | ||||||
|  |   schema!: SFSchema; | ||||||
|  |  | ||||||
|   constructor( |   constructor( | ||||||
|     private modal: NzModalRef, |     private modal: NzModalRef, | ||||||
| @ -27,23 +29,60 @@ export class ShowServiceComponent implements OnInit { | |||||||
|   ) { } |   ) { } | ||||||
|  |  | ||||||
|   ngOnInit(): void { |   ngOnInit(): void { | ||||||
|     this.initData() |     this.initSF() | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   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 { |   close(): void { | ||||||
|     this.modal.close(true) |     this.modal.close(true) | ||||||
|   } |   } | ||||||
| initData(){ |  | ||||||
|   this.service.request(this.service.$api_getStaffList).subscribe(res => { |  | ||||||
|     this.serviceList = res |  | ||||||
|   }) |  | ||||||
| } |  | ||||||
|   submitForm() { |   submitForm() { | ||||||
|     const params: any = { |     const params: any = { | ||||||
|     appUserId: this.appUserId, |       ...this.sf.value, | ||||||
|  |       enterpriseIdList: [this.i.id] | ||||||
|     }; |     }; | ||||||
|   this.service.request(this.service.$api_getStaffList, params).subscribe(res => { |     this.service.request(this.service.$api_distributionCusService, params).subscribe(res => { | ||||||
|       if (res) { |       if (res) { | ||||||
|         this.service.msgSrv.success('分配成功') |         this.service.msgSrv.success('分配成功') | ||||||
|         this.modal.close(true) |         this.modal.close(true) | ||||||
|  | |||||||
| @ -162,6 +162,8 @@ export class UsermanageService extends ShipperBaseService { | |||||||
|   $api_getEnterpriceRel = '/api/mdc/enterpriceRelLog/getEnterpriceRel'; |   $api_getEnterpriceRel = '/api/mdc/enterpriceRelLog/getEnterpriceRel'; | ||||||
|   // 员工列表 |   // 员工列表 | ||||||
|   $api_getStaffList = '/api/mdc/cuc/userApp/getStaffList'; |   $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) { |   constructor(public injector: Injector, public nzModalService: NzModalService, private nzImageService: NzImageService) { | ||||||
|     super(injector); |     super(injector); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user