This commit is contained in:
wangshiming
2022-05-10 10:41:01 +08:00
parent de8bb56dad
commit 0936b30387
11 changed files with 284 additions and 100 deletions

View File

@ -1,9 +1,11 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { SFComponent, SFRadioWidgetSchema, SFSchema, SFUISchema } from '@delon/form';
import { SFComponent, SFRadioWidgetSchema, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFUISchema } from '@delon/form';
import { ShipperBaseService } from '@shared';
import { NzMessageService } from 'ng-zorro-antd/message';
import { UsermanageService } from 'src/app/routes/usercenter/services/usercenter.service';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { map } from 'rxjs/operators';
import { of } from 'rxjs';
@Component({
selector: 'app-ad-components-Sale',
@ -48,18 +50,49 @@ export class EditSaleComponentsAddComponent implements OnInit {
initSF() {
this.schema = {
properties: {
// channelId: {
// type: 'string',
// title: '渠道销售修改为',
// ui: {
// widget: 'select',
// placeholder: '请选择',
// allowClear: true,
// visibleIf: {
// _$expand: (value: boolean) => value
// },
// asyncData: () => this.shipperservice.getChanners()
// }
// },
channelId: {
type: 'string',
title: '渠道销售修改为',
ui: {
widget: 'select',
placeholder: '请选择',
serverSearch: true,
searchDebounceTime: 300,
searchLoadingText: '搜索中...',
allowClear: true,
visibleIf: {
_$expand: (value: boolean) => value
onSearch: (q: any) => {
let str = q.replace(/^\s+|\s+$/g, '');
let params :any= {}
if (str) {
console.log(+str);
if(+str) {
console.log('数字');
params.phoneNumber = str
} else {
console.log('中文');
params.name = str
}
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))))
.toPromise();
} else {
return of([]);
}
},
asyncData: () => this.shipperservice.getChanners()
}
} as SFSelectWidgetSchema
},
remark: {
type: 'string',