This commit is contained in:
wangshiming
2022-04-28 19:44:12 +08:00
parent 4b69dc96fc
commit c3bb84e927

View File

@ -156,22 +156,23 @@ export class CloseAccountComponent implements OnInit {
maxLength: 30, maxLength: 30,
ui: { ui: {
widget: 'select', widget: 'select',
serverSearch: true, // serverSearch: true,
allowClear: true,
searchDebounceTime: 300, searchDebounceTime: 300,
searchLoadingText: '搜索中...', searchLoadingText: '搜索中...',
onSearch: (q: any) => { onSearch: (q: any) => {
let str =q.replace(/^\s+|\s+$/g,""); let str = q?.replace(/^\s+|\s+$/g, '');
if (str) { if (str) {
return this.service return this.service
.request(this.service.$api_enterpriceList, { enterpriseName: str}) .request(this.service.$api_enterpriceList, { enterpriseName: str })
.pipe(map((res: any) => (res as any[]).map((i) => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum)))) .pipe(map(res => (res as any[]).map(i => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum))))
.toPromise(); .toPromise();
} else { } else {
return of([]); return of([]);
} }
}, },
} as SFSelectWidgetSchema, } as SFSelectWidgetSchema
}, },
}, },
required: ['customerName', 'customerCode', 'networkTransporterId', 'enterpriseId'] required: ['customerName', 'customerCode', 'networkTransporterId', 'enterpriseId']
}; };
@ -186,11 +187,26 @@ this.ui2 = { '*': { spanLabelFixed: 120, grid: { span: 24 } } };
this.service.request(this.service.$api_settlementCustomer_get, {id: value.id}).subscribe((res: any) => { this.service.request(this.service.$api_settlementCustomer_get, {id: value.id}).subscribe((res: any) => {
console.log(res) console.log(res)
if(res) { if(res) {
this.formData = res;
const List: any = []; const List: any = [];
List.push({ label: res.enterpriseName, value: res.enterpriseId }); List.push({ label: value.enterpriseName, value: res.enterpriseId });
this.sfFre.getProperty('/enterpriseId')!.schema.enum = List; // this.sfFre.getProperty('/enterpriseId')!.schema.enum = List;
this.sfFre.getProperty('/enterpriseId')!.widget.reset(List); // console.log(List);
// this.sfFre.getProperty('/enterpriseId')!.widget.reset(List);
// if(res.enterpriseId) {
// this.sfFre.setValue('/enterpriseId', res.enterpriseId);
// }
console.log(this.sfFre.getProperty('/enterpriseId'));
this.formData = res;
setTimeout(() => {
this.sfFre.getProperty('/enterpriseId')!.schema.enum = List;
this.sfFre.getProperty('/enterpriseId')!.widget.reset(List);
if (res?.enterpriseId) {
console.log(res?.enterpriseId);
console.log(res?.enterpriseId);
this.sfFre.setValue('/enterpriseId', res.enterpriseId);
}
})
} }
}) })
this.edit = true; this.edit = true;