fix bug
This commit is contained in:
		| @ -1,8 +1,7 @@ | ||||
| import { Component, Input, OnInit, ViewChild } from '@angular/core'; | ||||
| import { SFComponent, SFSchema, SFSchemaEnum, SFSelectWidgetSchema, SFValue } from '@delon/form'; | ||||
| import { SFComponent, SFSchema, SFValue } from '@delon/form'; | ||||
| import { ModalHelper } from '@delon/theme'; | ||||
| import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal'; | ||||
| import { of } from 'rxjs'; | ||||
| import { map } from 'rxjs/operators'; | ||||
| import { PartnerListService } from '../../services/partner-list.service'; | ||||
|  | ||||
| @ -25,6 +24,7 @@ export class PartnerAuditModalComponent implements OnInit { | ||||
|     console.log(this.info); | ||||
|     this.initSF(this.info); | ||||
|     // asyncData: () => this.service.getChannel(), | ||||
|  | ||||
|     if(this.info.channelId) { | ||||
|       const value = [{ | ||||
|         label: this.info.channelIdLabel, | ||||
| @ -38,26 +38,20 @@ export class PartnerAuditModalComponent implements OnInit { | ||||
|          } | ||||
|       }) | ||||
|  | ||||
|     }  | ||||
|     // else { | ||||
|     //   console.log() | ||||
|     //   this.service.getChannel().pipe(map(data => { | ||||
|     //     console.log(data); | ||||
|          | ||||
|     //   })) | ||||
|     //   this.service.getChannel().subscribe((res) => { | ||||
|     //     console.log(res); | ||||
|     //     const value :any= res; | ||||
|     //     setTimeout(() => { | ||||
|     //       if(this.sf) { | ||||
|     //         this.sf.getProperty('/channelId2')!.schema.enum = value; | ||||
|     //         this.sf.getProperty('/channelId2')!.widget.reset(value); | ||||
|     //         this.sf.setValue('/channelId2', value); | ||||
|     //        } | ||||
|     //     }) | ||||
|     //   }) | ||||
|     } else { | ||||
|       this.service.getChannel().subscribe((res) => { | ||||
|         console.log(res); | ||||
|         const value :any= res; | ||||
|         setTimeout(() => { | ||||
|           if(this.sf) { | ||||
|             this.sf.getProperty('/channelId')!.schema.enum = value; | ||||
|             this.sf.getProperty('/channelId')!.widget.reset(value); | ||||
|             this.sf.setValue('/channelId', value); | ||||
|            } | ||||
|         }) | ||||
|       }) | ||||
|      | ||||
|     // } | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   initSF(user: any) { | ||||
| @ -91,36 +85,21 @@ export class PartnerAuditModalComponent implements OnInit { | ||||
|           default: this.info.isPass !== undefined ? this.info.isPass : true | ||||
|         }, | ||||
|         channelId: { | ||||
|           type: 'string', | ||||
|           title: '渠道销售', | ||||
|           type: 'string', | ||||
|           ui: { | ||||
|             widget: 'select', | ||||
|             hidden: this.info.isPass === false, | ||||
|             serverSearch: true, | ||||
|             searchDebounceTime: 300, | ||||
|             searchLoadingText: '搜索中...', | ||||
|             placeholder: '请选择', | ||||
|             allowClear: true, | ||||
|             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.id } as SFSchemaEnum)))) | ||||
|                   .toPromise(); | ||||
|               } else { | ||||
|                 return of([]); | ||||
|               } | ||||
|             hidden: this.info.isPass === false, | ||||
|             visibleIf: { | ||||
|               status: value => value | ||||
|             }, | ||||
|           } as SFSelectWidgetSchema | ||||
|             errors: { | ||||
|               required: ' ' | ||||
|             } | ||||
|           }, | ||||
|           default: user.channelId | ||||
|         }, | ||||
|         approvalOpinion: { | ||||
|           title: '备注', | ||||
| @ -140,8 +119,10 @@ export class PartnerAuditModalComponent implements OnInit { | ||||
|           } | ||||
|         } | ||||
|       }, | ||||
|       required: [ 'approvalOpinion','channelId'] | ||||
|       required: ['channelId', 'approvalOpinion'] | ||||
|     }; | ||||
|     console.log('666'); | ||||
|      | ||||
|   } | ||||
|  | ||||
|   sure() { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user