From 5e92efc70f0aa33c097f66053688a700a0bcf247 Mon Sep 17 00:00:00 2001 From: Taric Xin Date: Fri, 1 Apr 2022 10:13:50 +0800 Subject: [PATCH] edit --- proxy.conf.js | 2 +- .../index/partner-list.component.ts | 18 ++++++-- .../services/business/shipper-base.service.ts | 43 ++++++++++--------- 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/proxy.conf.js b/proxy.conf.js index cb9ce42c..a4074f73 100644 --- a/proxy.conf.js +++ b/proxy.conf.js @@ -20,7 +20,7 @@ module.exports = { // } '//api': { target: { - host: 'tms-api-test.eascs.com', + host: 'tms-api-dev.eascs.com', protocol: 'https:', port: 443 }, diff --git a/src/app/routes/partner/partner-list/components/index/partner-list.component.ts b/src/app/routes/partner/partner-list/components/index/partner-list.component.ts index 49172423..938c8be6 100644 --- a/src/app/routes/partner/partner-list/components/index/partner-list.component.ts +++ b/src/app/routes/partner/partner-list/components/index/partner-list.component.ts @@ -1,8 +1,9 @@ import { Component, ViewChild } from '@angular/core'; import { Router } from '@angular/router'; import { STComponent, STColumn, STRequestOptions, STChange } from '@delon/abc/st'; -import { SFComponent, SFSchema, SFDateWidgetSchema } from '@delon/form'; +import { SFComponent, SFSchema, SFDateWidgetSchema, SFAutoCompleteWidgetSchema, SFSelectWidgetSchema } from '@delon/form'; import { NzModalService } from 'ng-zorro-antd/modal'; +import { of } from 'rxjs'; import { AddCollectionInvoiceModalComponent } from 'src/app/routes/ticket-management/components/input-invoice/add-collection-invoice-modal/add-collection-invoice-modal.component'; import { PartnerListService } from '../../services/partner-list.service'; @@ -241,11 +242,22 @@ export class PartnerListComponent { type: 'string', title: '渠道销售', ui: { - placeholder: '请输入姓名或者手机号', + widget: 'select', + searchDebounceTime: 300, + searchLoadingText: '搜索中...', + allowClear: true, visibleIf: { expand: (value: boolean) => value + }, + onSearch: (q: any) => { + let str = q.replace(/^\s+|\s+$/g, ''); + if (str) { + return this.service.getChannel({ enterpriseName: str }).toPromise(); + } else { + return of([]); + } } - } + } as SFSelectWidgetSchema }, partnerType: { type: 'string', diff --git a/src/app/shared/services/business/shipper-base.service.ts b/src/app/shared/services/business/shipper-base.service.ts index 045ca354..fdc0d02e 100644 --- a/src/app/shared/services/business/shipper-base.service.ts +++ b/src/app/shared/services/business/shipper-base.service.ts @@ -176,21 +176,23 @@ export class ShipperBaseService extends BaseService { getEnterpriceList(params = { enterpriseName: '' }, containerAll = false) { let str = params.enterpriseName.replace(/^\s+|\s+$/g, ''); if (str) { - return this.request(this.$api_enterpriceList, params).pipe( - map((res: any) => { - if (!res) { - return []; - } - const list = res.map((item: any) => { - return { label: item.enterpriseName, value: item.id }; - }); - const obj = []; - if (containerAll) { - obj.push({ label: '全部', value: '' }); - } - return [...obj, ...list]; - }) - ).toPromise();; + return this.request(this.$api_enterpriceList, params) + .pipe( + map((res: any) => { + if (!res) { + return []; + } + const list = res.map((item: any) => { + return { label: item.enterpriseName, value: item.id }; + }); + const obj = []; + if (containerAll) { + obj.push({ label: '全部', value: '' }); + } + return [...obj, ...list]; + }) + ) + .toPromise(); } else { return of([]); } @@ -291,14 +293,15 @@ export class ShipperBaseService extends BaseService { * 获取渠道销售管理集合 * @returns */ - getChannel() { - const params = {}; + getChannel(params = {}, containerAll = false) { return this.request(this.$api_get_channel, params, 'POST').pipe( map(res => { if (res) { - return res.map((m: any) => { - return { label: `${m.employeeVO?.empName}/${m.employeeVO?.mobile}`, value: m.id }; - }); + const obj = []; + if (containerAll) { + obj.push({ label: '全部', value: '' }); + } + return [...obj, ...res.map((m: any) => ({ label: `${m.employeeVO?.empName}/${m.employeeVO?.mobile}`, value: m.id }))]; } else { return []; }