From 0dd36d8c7f3406a6d96d221abc66e9e3de34f60a Mon Sep 17 00:00:00 2001 From: wangshiming Date: Thu, 24 Mar 2022 14:20:58 +0800 Subject: [PATCH] fix bug --- .../driver/captain/add/add.component.html | 17 +++- .../driver/captain/add/add.component.ts | 86 +++++++++++-------- 2 files changed, 63 insertions(+), 40 deletions(-) diff --git a/src/app/routes/usercenter/components/driver/captain/add/add.component.html b/src/app/routes/usercenter/components/driver/captain/add/add.component.html index 1e60ca0b..fdc58217 100644 --- a/src/app/routes/usercenter/components/driver/captain/add/add.component.html +++ b/src/app/routes/usercenter/components/driver/captain/add/add.component.html @@ -1,7 +1,17 @@ + -
+
@@ -24,7 +34,6 @@
diff --git a/src/app/routes/usercenter/components/driver/captain/add/add.component.ts b/src/app/routes/usercenter/components/driver/captain/add/add.component.ts index 45f387a7..8a477dc9 100644 --- a/src/app/routes/usercenter/components/driver/captain/add/add.component.ts +++ b/src/app/routes/usercenter/components/driver/captain/add/add.component.ts @@ -90,12 +90,13 @@ export class CtcCaptatinAddComponent implements OnInit { widget: this.i.id ? 'text' : '', placeholder: '请输入手机号', blur: () => { - if(this.sf?.value?.mobile) { + if(!this.sf.value.mobile) { + return + } this.service.request(this.service.$api_getByMobile, { mobile: this.sf.value.mobile }).subscribe(res => { if (res.certificateNumber) { this.readFlag = true this.detailData = { - ...res, mobile: this.sf.value.mobile, bankName: this.sf.value.bankName, bankCardNo: this.sf.value.bankCardNo, @@ -109,28 +110,41 @@ export class CtcCaptatinAddComponent implements OnInit { url: res.certificatePhotoFrontWatermark, response: res.certificatePhotoFrontWatermark, }], - certificatePhotoBackWatermark: [ - { - uid: -1, - name: 'LOGO', - status: 'done', - url: res.certificatePhotoBackWatermark, - response: res.certificatePhotoBackWatermark, - }], - name: res.name, - certificateNumber: res.certificateNumber, - certificatePhotoFront: res.certificatePhotoFront, - certificatePhotoBack: res.certificatePhotoBack, + certificatePhotoBackWatermark: [ + { + uid: -1, + name: 'LOGO', + status: 'done', + url: res.certificatePhotoBackWatermark, + response: res.certificatePhotoBackWatermark, + }], + name: res.name, + certificateNumber: res.certificateNumber, + certificatePhotoFront: res.certificatePhotoFront, + certificatePhotoBack: res.certificatePhotoBack, } } this.initSF() } else { this.readFlag = false - this.detailData = {} + this.detailData = { + mobile: this.sf.value.mobile, + bankName: this.sf.value.bankName, + bankCardNo: this.sf.value.bankCardNo, + remark: this.sf.value.remark, + identityInfoDTO: { + certificatePhotoFrontWatermark: '', + certificatePhotoBackWatermark: '', + name: '', + certificateNumber: '', + certificatePhotoFront: '', + certificatePhotoBack: '', + } + } + this.initSF() } }) - } - } + } }, default: this.detailData.mobile }, @@ -138,7 +152,7 @@ export class CtcCaptatinAddComponent implements OnInit { title: '姓名', type: 'string', ui: { - widget: this.i.id ? 'text' : '', + widget: this.i.id && (this.i.driverLicenseStatus === 10 || this.i.driverLicenseStatus === 20) ? 'text' : '', placeholder: '请输入姓名', }, readOnly: this.readFlag, @@ -147,12 +161,11 @@ export class CtcCaptatinAddComponent implements OnInit { bankCardNo: { title: '银行卡号', type: 'string', - maxLength: 20, ui: { - widget: this.i.id ? 'text' : '', + widget: '', placeholder: '请输入银行卡号', - change: (val: any) =>{ - const value = val.replace(/\D/g,'') + change: (val: any) => { + const value = val.replace(/\D/g, '') this.sf.setValue('/bankCardNo', value) }, errors: { @@ -164,9 +177,8 @@ export class CtcCaptatinAddComponent implements OnInit { bankName: { title: '开户行', type: 'string', - maxLength: 35, ui: { - widget: this.i.id ? 'text' : '', + widget: '', placeholder: '请输入开户行', }, default: this.detailData.bankName @@ -178,7 +190,7 @@ export class CtcCaptatinAddComponent implements OnInit { ui: { widget: 'textarea', showRequired: true, - borderless:true, + borderless: true, }, default: '请上传身份证原件的高清照片,若上传复印件,则需加盖公司印章及法人签字;上传后系统会自动识别并填写', }, @@ -193,11 +205,11 @@ export class CtcCaptatinAddComponent implements OnInit { certificatePhotoFrontWatermark: { type: 'string', title: '', - readOnly: this.i.id || this.readFlag, + readOnly: (this.i.id && (this.i.driverLicenseStatus === 10 || this.i.driverLicenseStatus === 20)) || this.readFlag, ui: { offsetControl: 6, action: apiConf.fileUpload, - fileType: 'image/png,image/jpeg,image/jpg,image/gif', + accept: 'image/png,image/jpeg,image/jpg,image/gif', limit: 1, limitFileCount: 1, resReName: 'data.fullFileWatermarkPath', @@ -212,10 +224,10 @@ export class CtcCaptatinAddComponent implements OnInit { listType: 'picture-card', change: (args: any) => { if (args.type === 'success') { - this.detailData.certificatePhotoFront = args.file.response.data.fullFilePath + this.detailData.identityInfoDTO.certificatePhotoFront = args.file.response.data.fullFilePath this.checkIdCard(args.file.response.data.fullFilePath, 'front'); } else { - this.detailData.certificatePhotoFront = '' + this.detailData.identityInfoDTO.certificatePhotoFront = '' } }, beforeUpload: (file: any, _fileList: any) => { @@ -230,6 +242,7 @@ export class CtcCaptatinAddComponent implements OnInit { observer.complete(); }); }, + previewFile: (file: any) => { } }, default: this.detailData.identityInfoDTO.certificatePhotoFrontWatermark }, @@ -244,11 +257,11 @@ export class CtcCaptatinAddComponent implements OnInit { certificatePhotoBackWatermark: { type: 'string', title: '', - readOnly: this.i.id || this.readFlag, + readOnly: (this.i.id && (this.i.driverLicenseStatus === 10 || this.i.driverLicenseStatus === 20)) || this.readFlag, ui: { offsetControl: 6, action: apiConf.fileUpload, - fileType: 'image/png,image/jpeg,image/jpg,image/gif', + accept: 'image/png,image/jpeg,image/jpg,image/gif', limit: 1, limitFileCount: 1, resReName: 'data.fullFileWatermarkPath', @@ -263,9 +276,9 @@ export class CtcCaptatinAddComponent implements OnInit { listType: 'picture-card', change: (args: any) => { if (args.type === 'success') { - this.detailData.certificatePhotoBack = args.file.response.data.fullFilePath + this.detailData.identityInfoDTO.certificatePhotoBack = args.file.response.data.fullFilePath } else { - this.detailData.certificatePhotoBack = '' + this.detailData.identityInfoDTO.certificatePhotoBack = '' } }, beforeUpload: (file: any, _fileList: any) => { @@ -280,15 +293,16 @@ export class CtcCaptatinAddComponent implements OnInit { observer.complete(); }); }, + previewFile: (file: any) => { } }, default: this.detailData.identityInfoDTO.certificatePhotoBackWatermark }, certificateNumber: { title: '身份证号', type: 'string', - readOnly: this.readFlag, + readOnly: (this.i.id && (this.i.driverLicenseStatus === 10 || this.i.driverLicenseStatus === 20)) || this.readFlag, ui: { - widget: this.i.id ? 'text' : '', + widget: this.i.id && (this.i.driverLicenseStatus !== 10 && this.i.driverLicenseStatus !== 20) ? 'text' : '', placeholder: '请输入身份证号', }, default: this.detailData.identityInfoDTO.certificateNumber @@ -298,7 +312,7 @@ export class CtcCaptatinAddComponent implements OnInit { type: 'string', maxLength: 100, ui: { - widget: this.i.id ? 'text' : 'textarea', + widget: 'textarea', placeholder: '请输入备注', autosize: { minRows: 2, maxRows: 6 }, },