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