diff --git a/src/app/routes/sys-setting/components/close-account/close-account.component.ts b/src/app/routes/sys-setting/components/close-account/close-account.component.ts index c63b5418..1d880abd 100644 --- a/src/app/routes/sys-setting/components/close-account/close-account.component.ts +++ b/src/app/routes/sys-setting/components/close-account/close-account.component.ts @@ -156,22 +156,23 @@ export class CloseAccountComponent implements OnInit { maxLength: 30, ui: { widget: 'select', - serverSearch: true, + // serverSearch: true, + allowClear: true, searchDebounceTime: 300, searchLoadingText: '搜索中...', onSearch: (q: any) => { - let str =q.replace(/^\s+|\s+$/g,""); + let str = q?.replace(/^\s+|\s+$/g, ''); if (str) { return this.service - .request(this.service.$api_enterpriceList, { enterpriseName: str}) - .pipe(map((res: any) => (res as any[]).map((i) => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum)))) + .request(this.service.$api_enterpriceList, { enterpriseName: str }) + .pipe(map(res => (res as any[]).map(i => ({ label: i.enterpriseName, value: i.id } as SFSchemaEnum)))) .toPromise(); } else { return of([]); } }, - } as SFSelectWidgetSchema, - }, + } as SFSelectWidgetSchema + }, }, 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) => { console.log(res) if(res) { - this.formData = res; const List: any = []; - List.push({ label: res.enterpriseName, value: res.enterpriseId }); - this.sfFre.getProperty('/enterpriseId')!.schema.enum = List; - this.sfFre.getProperty('/enterpriseId')!.widget.reset(List); + List.push({ label: value.enterpriseName, value: res.enterpriseId }); + // this.sfFre.getProperty('/enterpriseId')!.schema.enum = 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;