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
* @Date : 2022-04-29 17:28:23
* @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
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
@ -92,12 +92,9 @@
<se label="合伙人名称"> {{ selectItem?.enterpriseName || selectItem?.contactName }} </se>
<se label="当前渠道销售"> {{ selectItem?.channelIdLabel }} </se>
<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
nzMode="multiple"
nzPlaceHolder="Select users"
nzPlaceHolder="请搜索"
nzAllowClear
nzShowSearch
nzServerSearch
@ -105,12 +102,8 @@
(nzOnSearch)="onSearch($event)"
>
<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>
<nz-option *ngIf="isLoading" nzDisabled nzCustomContent>
<i nz-icon nzType="loading" class="loading-icon"></i>
Loading Data...
</nz-option>
</nz-select>
</se>
<se label="备注" required>

View File

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