This commit is contained in:
wangshiming
2022-05-10 11:39:26 +08:00
parent 37ffac6326
commit 4b41d9b971
3 changed files with 27 additions and 36 deletions

View File

@ -4,7 +4,7 @@
* @Author : Shiming * @Author : Shiming
* @Date : 2022-04-29 17:28:23 * @Date : 2022-04-29 17:28:23
* @LastEditors : Shiming * @LastEditors : Shiming
* @LastEditTime : 2022-05-10 10:47:03 * @LastEditTime : 2022-05-10 11:39:19
* @FilePath : \\tms-obc-web\\src\\app\\routes\\partner\\partner-list\\components\\index\\partner-list.component.html * @FilePath : \\tms-obc-web\\src\\app\\routes\\partner\\partner-list\\components\\index\\partner-list.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved. * Copyright (C) 2022 huzhenhong. All rights reserved.
--> -->
@ -92,12 +92,9 @@
<se label="合伙人名称"> {{ selectItem?.enterpriseName || selectItem?.contactName }} </se> <se label="合伙人名称"> {{ selectItem?.enterpriseName || selectItem?.contactName }} </se>
<se label="当前渠道销售"> {{ selectItem?.channelIdLabel }} </se> <se label="当前渠道销售"> {{ selectItem?.channelIdLabel }} </se>
<se label="渠道销售修改为" required> <se label="渠道销售修改为" required>
<!-- <nz-select [(ngModel)]="cannelItem.channelId" style="width: 100%">
<nz-option [nzValue]="item.value" [nzLabel]="item.label" *ngFor="let item of cannels"></nz-option>
</nz-select> -->
<nz-select <nz-select
nzMode="multiple" nzMode="multiple"
nzPlaceHolder="Select users" nzPlaceHolder="请搜索"
nzAllowClear nzAllowClear
nzShowSearch nzShowSearch
nzServerSearch nzServerSearch
@ -105,12 +102,8 @@
(nzOnSearch)="onSearch($event)" (nzOnSearch)="onSearch($event)"
> >
<ng-container *ngFor="let item of cannels"> <ng-container *ngFor="let item of cannels">
<nz-option *ngIf="!isLoading" [nzValue]="item.value" [nzLabel]="item.label"></nz-option> <nz-option [nzValue]="item.value" [nzLabel]="item.label"></nz-option>
</ng-container> </ng-container>
<nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
<i nz-icon nzType="loading" class="loading-icon"></i>
Loading Data...
</nz-option>
</nz-select> </nz-select>
</se> </se>
<se label="备注" required> <se label="备注" required>

View File

@ -4,13 +4,12 @@ import { Router } from '@angular/router';
import { STComponent, STColumn, STRequestOptions, STChange } from '@delon/abc/st'; import { STComponent, STColumn, STRequestOptions, STChange } from '@delon/abc/st';
import { SFComponent, SFSchema, SFDateWidgetSchema, SFAutoCompleteWidgetSchema, SFSelectWidgetSchema } from '@delon/form'; import { SFComponent, SFSchema, SFDateWidgetSchema, SFAutoCompleteWidgetSchema, SFSelectWidgetSchema } from '@delon/form';
import { NzModalService } from 'ng-zorro-antd/modal'; import { NzModalService } from 'ng-zorro-antd/modal';
import { of } from 'rxjs'; import { BehaviorSubject, Observable, of } from 'rxjs';
import { AddCollectionInvoiceModalComponent } from 'src/app/routes/ticket-management/components/input-invoice/add-collection-invoice-modal/add-collection-invoice-modal.component'; import { AddCollectionInvoiceModalComponent } from 'src/app/routes/ticket-management/components/input-invoice/add-collection-invoice-modal/add-collection-invoice-modal.component';
import { map, filter } from 'rxjs/operators';
import { PartnerListService } from '../../services/partner-list.service'; import { PartnerListService } from '../../services/partner-list.service';
import { PartnerAuditModalComponent } from '../partner-audit-modal/partner-audit-modal.component'; import { PartnerAuditModalComponent } from '../partner-audit-modal/partner-audit-modal.component';
import { catchError, debounceTime, map, switchMap } from 'rxjs/operators';
@Component({ @Component({
selector: 'app-partner-list', selector: 'app-partner-list',
templateUrl: './partner-list.component.html', templateUrl: './partner-list.component.html',
@ -36,13 +35,14 @@ export class PartnerListComponent {
cannels: any[] = []; cannels: any[] = [];
selectedRows: any[] = []; selectedRows: any[] = [];
cannelItem: any = { channelId: null, effectiveNode: 1, enterpriseIdList: [], remark: '' }; cannelItem: any = { channelId: null, effectiveNode: 1, enterpriseIdList: [], remark: '' };
searchChange$ = new BehaviorSubject('');
selectItem: any = {}; selectItem: any = {};
constructor(public service: PartnerListService, private nzModalService: NzModalService, private router: Router) { constructor(public service: PartnerListService, private nzModalService: NzModalService, private router: Router) {
this.loadSelectOptions(); this.loadSelectOptions();
} }
ngOnInit(): void {
}
beforeReq = (requestOptions: STRequestOptions) => { beforeReq = (requestOptions: STRequestOptions) => {
if (this.sf) { if (this.sf) {
let params = { ...this.sf?.value }; let params = { ...this.sf?.value };
@ -62,11 +62,6 @@ export class PartnerListComponent {
this.customers = res; this.customers = res;
} }
}); });
this.service.getChannel().subscribe(res => {
if (res) {
this.cannels = res;
}
});
} }
auditPartner(item: any) { auditPartner(item: any) {
@ -511,28 +506,32 @@ export class PartnerListComponent {
} }
onSearch(value: string): void { onSearch(value: string): void {
this.isLoading = true; this.isLoading = true;
console.log(value);
let str = value.replace(/^\s+|\s+$/g, '');
let params: any = {}; let params: any = {};
if (str) { if (value) {
console.log(+str); console.log(+value);
if (+str) { // 数字
console.log('数字'); if (+value) {
params.phoneNumber = str; params.phoneNumber = value;
} else { } else {
console.log('中文'); // 中文
params.name = str; params.name = value;
} }
this.service.request(this.service.$api_get_channel, params).subscribe(res => { this.service.request(this.service.$api_get_channel, params).subscribe(res => {
console.log(res);
let NewList: { label: string; value: any; }[] = []; let NewList: { label: string; value: any; }[] = [];
let List = res.filter((i: any) => { let List = res.filter((i: any) => {
NewList.push({ label: `${i.name}/${i.telephone}`, value: i.channelId }) ; NewList.push({ label: `${i.name}/${i.telephone}`, value: i.id }) ;
}); });
console.log(NewList); this.cannels = NewList
});
this.searchChange$.next(value);
} else if(value === '') {
this.service.request(this.service.$api_get_channel, {name: '清空数X'}).subscribe(res => {
let NewList: { label: string; value: any; }[] = [];
let List = res.filter((i: any) => {
NewList.push({ label: `${i.name}/${i.telephone}`, value: i.id }) ;
});
this.cannels = NewList
}); });
// .pipe(map((res: any) => (res as any[]).map(i => ({ label: `${i.name}/${i.telephone}`, value: i.channelId })))
// this.searchChange$.next(value);
} }
} }
} }

View File

@ -114,13 +114,12 @@ export class PartnerAuditModalComponent implements OnInit {
} }
return this.service return this.service
.request(this.service.$api_get_channel, params) .request(this.service.$api_get_channel, params)
.pipe(map((res: any) => (res as any[]).map(i => ({ label: `${i.name}/${i.telephone}`, value: i.channelId } as SFSchemaEnum)))) .pipe(map((res: any) => (res as any[]).map(i => ({ label: `${i.name}/${i.telephone}`, value: i.id } as SFSchemaEnum))))
.toPromise(); .toPromise();
} else { } else {
return of([]); return of([]);
} }
}, },
default: user.channelId
} as SFSelectWidgetSchema } as SFSelectWidgetSchema
}, },
approvalOpinion: { approvalOpinion: {