fix bug
This commit is contained in:
@ -1,8 +1,19 @@
|
||||
import { AfterViewInit, ChangeDetectorRef, Component, OnChanges, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { SFAutoCompleteWidgetSchema, SFComponent, SFRadioWidgetSchema, SFSchema, SFSchemaEnumType, SFSelectWidgetSchema, SFTextareaWidgetSchema, SFUISchema } from '@delon/form';
|
||||
import {
|
||||
SFAutoCompleteWidgetSchema,
|
||||
SFComponent,
|
||||
SFRadioWidgetSchema,
|
||||
SFSchema,
|
||||
SFSchemaEnum,
|
||||
SFSchemaEnumType,
|
||||
SFSelectWidgetSchema,
|
||||
SFTextareaWidgetSchema,
|
||||
SFUISchema
|
||||
} from '@delon/form';
|
||||
import { _HttpClient } from '@delon/theme';
|
||||
import { NzModalRef, NzModalService } from 'ng-zorro-antd/modal';
|
||||
import { of } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { AmapPoiPickerComponent } from 'src/app/shared/components/amap';
|
||||
import { ChannelSalesService } from '../../services/channel-sales.service';
|
||||
@ -18,8 +29,8 @@ export class ParterChannelSalesEditComponent implements OnInit {
|
||||
i: any;
|
||||
sts: any;
|
||||
type: any;
|
||||
record:any;
|
||||
currentOAItem:any;
|
||||
record: any;
|
||||
currentOAItem: any;
|
||||
constructor(
|
||||
public http: _HttpClient,
|
||||
private cdr: ChangeDetectorRef,
|
||||
@ -30,29 +41,39 @@ export class ParterChannelSalesEditComponent implements OnInit {
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
if(!this.sts) {
|
||||
this.service.request(this.service.$api_getChannelSalesInfo, {id:this.i?.id}).subscribe(res => {
|
||||
if(res){
|
||||
let value1 = Object.assign({}, res)
|
||||
delete value1.employeeVO;
|
||||
this.record = value1;
|
||||
console.log(value1);
|
||||
console.log(this.record);
|
||||
this.initSF();
|
||||
if (!this.sts) {
|
||||
this.service.request(this.service.$api_getChannelSalesInfo, { id: this.i?.id }).subscribe(res => {
|
||||
const List: any = [];
|
||||
if (res) {
|
||||
let value1 = Object.assign({}, res);
|
||||
delete value1.employeeVO;
|
||||
console.log(value1);
|
||||
console.log(this.record);
|
||||
|
||||
let value = res.employeeVO;
|
||||
let yeeVO = {label: value.empName+"/"+value.empNo, value: value.empNo}
|
||||
console.log(yeeVO);
|
||||
let value = res.employeeVO;
|
||||
console.log(value);
|
||||
|
||||
setTimeout(()=>{
|
||||
this.sf.getProperty('/employeeVO')!.schema.enum = [yeeVO];
|
||||
this.sf.getProperty('/employeeVO')!.widget.reset([yeeVO]);
|
||||
})
|
||||
List.push({ label: value.empName + '/' + value.empNo, value: value.empNo });
|
||||
console.log(List);
|
||||
|
||||
this.initSF();
|
||||
setTimeout(() => {
|
||||
if (this.sf) {
|
||||
console.log(this.sf.getProperty('/employeeVO')!.schema);
|
||||
|
||||
this.sf.getProperty('/employeeVO')!.schema.enum = List;
|
||||
this.sf.getProperty('/employeeVO')!.widget.reset(List);
|
||||
}
|
||||
if (value.empNo) {
|
||||
this.sf.setValue('/employeeVO', value.empNo);
|
||||
this.currentOAItem = value;
|
||||
this.sf.setValue('/phoneNumber', res.telephone);
|
||||
}
|
||||
});
|
||||
this.record = value1;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
initSF() {
|
||||
this.schema = {
|
||||
@ -67,7 +88,7 @@ export class ParterChannelSalesEditComponent implements OnInit {
|
||||
type: 'string',
|
||||
maxLength: 12,
|
||||
ui: {
|
||||
placeholder:'请输入'
|
||||
placeholder: '请输入'
|
||||
}
|
||||
},
|
||||
phoneNumber: {
|
||||
@ -75,26 +96,59 @@ export class ParterChannelSalesEditComponent implements OnInit {
|
||||
type: 'string',
|
||||
maxLength: 11,
|
||||
ui: {
|
||||
placeholder:'请输入'
|
||||
placeholder: '请输入'
|
||||
}
|
||||
},
|
||||
// employeeVO: {
|
||||
// title: '关联OA员工',
|
||||
// type: 'string',
|
||||
// ui: {
|
||||
// widget: 'select',
|
||||
// placeholder:'请选择',
|
||||
// asyncData: (input:string) => this.service.request(this.service.$api_fuzzyQuery,{name:input}).pipe(
|
||||
// map((res: any) => {
|
||||
// return res.map((item:any)=>{
|
||||
// return {label: item.empName+"/"+item.empNo, value: item.empNo, obj: item}
|
||||
// })
|
||||
// })
|
||||
// ),
|
||||
// change:(item:any, org:any)=>{
|
||||
// this.currentOAItem = org.obj;
|
||||
// }
|
||||
// } as SFAutoCompleteWidgetSchema,
|
||||
// },
|
||||
employeeVO: {
|
||||
title: '关联OA员工',
|
||||
type: 'string',
|
||||
maxLength: 30,
|
||||
ui: {
|
||||
widget: 'autocomplete',
|
||||
placeholder:'请选择',
|
||||
asyncData: (input:string) => this.service.request(this.service.$api_fuzzyQuery,{name:input}).pipe(
|
||||
map((res: any) => {
|
||||
return res.map((item:any)=>{
|
||||
return {label: item.empName+"/"+item.empNo, value: item.empNo, obj: item}
|
||||
})
|
||||
})
|
||||
),
|
||||
change:(item:any, org:any)=>{
|
||||
widget: 'select',
|
||||
// serverSearch: true,
|
||||
allowClear: true,
|
||||
searchDebounceTime: 300,
|
||||
searchLoadingText: '搜索中...',
|
||||
onSearch: (q: any) => {
|
||||
let str = q?.replace(/^\s+|\s+$/g, '');
|
||||
if (str) {
|
||||
return this.service
|
||||
.request(this.service.$api_fuzzyQuery, { name: str })
|
||||
.pipe(map(res => (res as any[]).map(i => ({ label: i.empName + '/' + i.empNo, value: i.empNo, obj: i } as SFSchemaEnum))))
|
||||
.toPromise();
|
||||
} else {
|
||||
return of([]);
|
||||
}
|
||||
},
|
||||
// asyncData: (input:string) => this.service.request(this.service.$api_fuzzyQuery,{name:input}).pipe(
|
||||
// map((res: any) => {
|
||||
// return res.map((item:any)=>{
|
||||
// return {label: item.empName+"/"+item.empNo, value: item.empNo, obj: item}
|
||||
// })
|
||||
// })
|
||||
// ),
|
||||
change: (item: any, org: any) => {
|
||||
this.currentOAItem = org.obj;
|
||||
}
|
||||
} as SFAutoCompleteWidgetSchema,
|
||||
} as SFSelectWidgetSchema
|
||||
},
|
||||
isAuthorization: {
|
||||
type: 'string',
|
||||
@ -104,9 +158,9 @@ export class ParterChannelSalesEditComponent implements OnInit {
|
||||
{ label: '是', value: '1' }
|
||||
],
|
||||
ui: {
|
||||
widget: 'radio',
|
||||
widget: 'radio'
|
||||
} as SFRadioWidgetSchema,
|
||||
default: '0',
|
||||
default: '0'
|
||||
},
|
||||
roleIds: {
|
||||
title: '',
|
||||
@ -128,7 +182,7 @@ export class ParterChannelSalesEditComponent implements OnInit {
|
||||
);
|
||||
},
|
||||
visibleIf: { isAuthorization: (value: string) => value === '1' }
|
||||
},
|
||||
}
|
||||
},
|
||||
remark: {
|
||||
type: 'string',
|
||||
@ -137,9 +191,9 @@ export class ParterChannelSalesEditComponent implements OnInit {
|
||||
ui: {
|
||||
widget: 'textarea',
|
||||
autosize: { minRows: 3, maxRows: 6 },
|
||||
placeholder:'请输入50字符'
|
||||
} as SFTextareaWidgetSchema,
|
||||
},
|
||||
placeholder: '请输入50字符'
|
||||
} as SFTextareaWidgetSchema
|
||||
}
|
||||
},
|
||||
required: ['name', 'phoneNumber', 'employeeVO', 'roleIds', 'remark']
|
||||
};
|
||||
@ -148,10 +202,8 @@ export class ParterChannelSalesEditComponent implements OnInit {
|
||||
spanLabelFixed: 150,
|
||||
grid: { span: 24 }
|
||||
},
|
||||
$isAuthorization:{ grid: { span: 12 }},
|
||||
$roleIds:{ spanLabelFixed: 10, grid: { span: 12 }},
|
||||
|
||||
|
||||
$isAuthorization: { grid: { span: 12 } },
|
||||
$roleIds: { spanLabelFixed: 10, grid: { span: 12 } }
|
||||
};
|
||||
}
|
||||
|
||||
@ -160,12 +212,15 @@ export class ParterChannelSalesEditComponent implements OnInit {
|
||||
}
|
||||
save() {
|
||||
this.sf.validator({ emitError: true });
|
||||
if(!this.sf.valid) return;
|
||||
this.service.request(this.service.$api_save, { ...this.sf.value, employeeVO: this.currentOAItem}).subscribe(res => {
|
||||
if (!this.sf.valid) return;
|
||||
let params = {
|
||||
...this.sf.value
|
||||
}
|
||||
delete params.telephone
|
||||
this.service.request(this.service.$api_save, { ...params, employeeVO: this.currentOAItem }).subscribe(res => {
|
||||
if (res) {
|
||||
this.service.msgSrv.success(res.msg);
|
||||
this.modalRef.destroy(true);
|
||||
} else {
|
||||
this.service.msgSrv.error(res.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -617,15 +617,8 @@ export class AddEtpPartnerComponent {
|
||||
}
|
||||
|
||||
private setInfo(info: any) {
|
||||
if (info.name) {
|
||||
this.sf.setValue('/adminUserInfo/name', info.name);
|
||||
}
|
||||
if (info.certificatePhotoFront) {
|
||||
this.sf.setValue('/adminUserInfo/certificatePhotoFront', info.certificatePhotoFront);
|
||||
}
|
||||
if (info.certificatePhotoFrontWatermark) {
|
||||
console.log(this.sf.getProperty('/adminUserInfo/certificatePhotoFrontWatermark'));
|
||||
|
||||
this.sf.setValue('/adminUserInfo/certificatePhotoFrontWatermark', [
|
||||
{
|
||||
uid: -1,
|
||||
@ -635,11 +628,7 @@ export class AddEtpPartnerComponent {
|
||||
response: info.certificatePhotoFrontWatermark
|
||||
}
|
||||
]);
|
||||
}
|
||||
if (info.certificatePhotoBack) {
|
||||
this.sf.setValue('/adminUserInfo/certificatePhotoBack', info.certificatePhotoBack);
|
||||
}
|
||||
if (info.certificatePhotoBackWatermark) {
|
||||
this.sf.setValue('/adminUserInfo/certificatePhotoBackWatermark', [
|
||||
{
|
||||
uid: -1,
|
||||
@ -649,18 +638,9 @@ export class AddEtpPartnerComponent {
|
||||
response: info.certificatePhotoBackWatermark
|
||||
}
|
||||
]);
|
||||
}
|
||||
if (info.certificateNumber) {
|
||||
this.sf.setValue('/adminUserInfo/certificateNumber', info.certificateNumber);
|
||||
}
|
||||
if (info.validStartTime) {
|
||||
this.sf.setValue('/adminUserInfo/validStartTime', info.validStartTime);
|
||||
}
|
||||
if (info.validEndTime) {
|
||||
this.sf.setValue('/adminUserInfo/validEndTime', info.validEndTime);
|
||||
this.sf.setValue('/adminUserInfo/_isLoingDate', false);
|
||||
} else {
|
||||
this.sf.setValue('/adminUserInfo/_isLoingDate', true);
|
||||
}
|
||||
this.sf.setValue('/adminUserInfo/validEndTime', info?.validEndTime ? info?.validEndTime: null);
|
||||
this.sf.setValue('/adminUserInfo/_isLoingDate', info?.validEndTime ? false: true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -339,50 +339,30 @@ export class AddPersonalPartnerComponent {
|
||||
}
|
||||
|
||||
private setInfo(info: any) {
|
||||
if (info.name) {
|
||||
this.sf.setValue('/adminUserInfo/name', info.name);
|
||||
}
|
||||
if (info.certificatePhotoFront) {
|
||||
this.sf.setValue('/adminUserInfo/certificatePhotoFront', info.certificatePhotoFront);
|
||||
}
|
||||
if (info.certificatePhotoFrontWatermark) {
|
||||
console.log(this.sf.getProperty('/adminUserInfo/certificatePhotoFrontWatermark'));
|
||||
|
||||
this.sf.setValue('/adminUserInfo/name', info?.name);
|
||||
this.sf.setValue('/adminUserInfo/certificatePhotoFront', info?.certificatePhotoFront);
|
||||
this.sf.setValue('/adminUserInfo/certificatePhotoFrontWatermark', [
|
||||
{
|
||||
uid: -1,
|
||||
name: '文件',
|
||||
status: 'done',
|
||||
url: info.certificatePhotoFrontWatermark,
|
||||
response: info.certificatePhotoFrontWatermark
|
||||
url: info?.certificatePhotoFrontWatermark,
|
||||
response: info?.certificatePhotoFrontWatermark
|
||||
}
|
||||
]);
|
||||
}
|
||||
if (info.certificatePhotoBack) {
|
||||
this.sf.setValue('/adminUserInfo/certificatePhotoBack', info.certificatePhotoBack);
|
||||
}
|
||||
if (info.certificatePhotoBackWatermark) {
|
||||
this.sf.setValue('/adminUserInfo/certificatePhotoBack', info?.certificatePhotoBack);
|
||||
this.sf.setValue('/adminUserInfo/certificatePhotoBackWatermark', [
|
||||
{
|
||||
uid: -1,
|
||||
name: '文件',
|
||||
status: 'done',
|
||||
url: info.certificatePhotoBackWatermark,
|
||||
response: info.certificatePhotoBackWatermark
|
||||
url: info?.certificatePhotoBackWatermark,
|
||||
response: info?.certificatePhotoBackWatermark
|
||||
}
|
||||
]);
|
||||
}
|
||||
if (info.certificateNumber) {
|
||||
this.sf.setValue('/adminUserInfo/certificateNumber', info.certificateNumber);
|
||||
}
|
||||
if (info.validStartTime) {
|
||||
this.sf.setValue('/adminUserInfo/validStartTime', info.validStartTime);
|
||||
}
|
||||
if (info.validEndTime) {
|
||||
this.sf.setValue('/adminUserInfo/validEndTime', info.validEndTime);
|
||||
this.sf.setValue('/adminUserInfo/_isLoingDate', false);
|
||||
} else {
|
||||
this.sf.setValue('/adminUserInfo/_isLoingDate', true);
|
||||
}
|
||||
this.sf.setValue('/adminUserInfo/certificateNumber', info?.certificateNumber);
|
||||
this.sf.setValue('/adminUserInfo/validStartTime', info?.validStartTime);
|
||||
this.sf.setValue('/adminUserInfo/validEndTime', info?.validEndTime ? info?.validEndTime: null);
|
||||
this.sf.setValue('/adminUserInfo/_isLoingDate', info?.validEndTime ? false: true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user