This commit is contained in:
wangshiming
2022-03-24 14:20:58 +08:00
parent 5d60e80783
commit 0dd36d8c7f
2 changed files with 63 additions and 40 deletions

View File

@ -1,7 +1,17 @@
<!--
* @Description :
* @Version : 1.0
* @Author : Shiming
* @Date : 2022-03-14 14:17:38
* @LastEditors : Shiming
* @LastEditTime : 2022-03-24 14:17:55
* @FilePath : \\tms-obc-web\\src\\app\\routes\\usercenter\\components\\driver\\captain\\add\\add.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
<div class="modal-header"> <div class="modal-header">
<div class="modal-title">添加车队长</div> <div class="modal-title">添加车队长</div>
</div> </div>
<div> <div [ngClass]="i.id || readFlag ? 'hideBtn' : ''">
<sf #sf [compact]="true" [ui]="ui" [schema]="schema" [button]="'none'"> <sf #sf [compact]="true" [ui]="ui" [schema]="schema" [button]="'none'">
<ng-template sf-template="tipsA" let-me let-ui="ui" let-schema="schema"> <ng-template sf-template="tipsA" let-me let-ui="ui" let-schema="schema">
<div class="pr"> <div class="pr">
@ -24,7 +34,6 @@
</sf> </sf>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button nz-button type="button" (click)="close()" *ngIf="i.id === ''">取消</button> <button nz-button type="button" (click)="close()">取消</button>
<button nz-button type="button" (click)="close()" *ngIf="i.id">关闭</button> <button nz-button type="button" nzType="primary" (click)="sure()" [disabled]="!sf?.valid" [nzLoading]="service.http.loading">确定</button>
<button nz-button type="button" nzType="primary" (click)="sure()" [disabled]="!sf?.valid" *ngIf="i.id === ''">确定</button>
</div> </div>

View File

@ -90,12 +90,13 @@ export class CtcCaptatinAddComponent implements OnInit {
widget: this.i.id ? 'text' : '', widget: this.i.id ? 'text' : '',
placeholder: '请输入手机号', placeholder: '请输入手机号',
blur: () => { 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 => { this.service.request(this.service.$api_getByMobile, { mobile: this.sf.value.mobile }).subscribe(res => {
if (res.certificateNumber) { if (res.certificateNumber) {
this.readFlag = true this.readFlag = true
this.detailData = { this.detailData = {
...res,
mobile: this.sf.value.mobile, mobile: this.sf.value.mobile,
bankName: this.sf.value.bankName, bankName: this.sf.value.bankName,
bankCardNo: this.sf.value.bankCardNo, bankCardNo: this.sf.value.bankCardNo,
@ -126,11 +127,24 @@ export class CtcCaptatinAddComponent implements OnInit {
this.initSF() this.initSF()
} else { } else {
this.readFlag = false 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 default: this.detailData.mobile
}, },
@ -138,7 +152,7 @@ export class CtcCaptatinAddComponent implements OnInit {
title: '姓名', title: '姓名',
type: 'string', type: 'string',
ui: { ui: {
widget: this.i.id ? 'text' : '', widget: this.i.id && (this.i.driverLicenseStatus === 10 || this.i.driverLicenseStatus === 20) ? 'text' : '',
placeholder: '请输入姓名', placeholder: '请输入姓名',
}, },
readOnly: this.readFlag, readOnly: this.readFlag,
@ -147,9 +161,8 @@ export class CtcCaptatinAddComponent implements OnInit {
bankCardNo: { bankCardNo: {
title: '银行卡号', title: '银行卡号',
type: 'string', type: 'string',
maxLength: 20,
ui: { ui: {
widget: this.i.id ? 'text' : '', widget: '',
placeholder: '请输入银行卡号', placeholder: '请输入银行卡号',
change: (val: any) => { change: (val: any) => {
const value = val.replace(/\D/g, '') const value = val.replace(/\D/g, '')
@ -164,9 +177,8 @@ export class CtcCaptatinAddComponent implements OnInit {
bankName: { bankName: {
title: '开户行', title: '开户行',
type: 'string', type: 'string',
maxLength: 35,
ui: { ui: {
widget: this.i.id ? 'text' : '', widget: '',
placeholder: '请输入开户行', placeholder: '请输入开户行',
}, },
default: this.detailData.bankName default: this.detailData.bankName
@ -193,11 +205,11 @@ export class CtcCaptatinAddComponent implements OnInit {
certificatePhotoFrontWatermark: { certificatePhotoFrontWatermark: {
type: 'string', type: 'string',
title: '', title: '',
readOnly: this.i.id || this.readFlag, readOnly: (this.i.id && (this.i.driverLicenseStatus === 10 || this.i.driverLicenseStatus === 20)) || this.readFlag,
ui: { ui: {
offsetControl: 6, offsetControl: 6,
action: apiConf.fileUpload, action: apiConf.fileUpload,
fileType: 'image/png,image/jpeg,image/jpg,image/gif', accept: 'image/png,image/jpeg,image/jpg,image/gif',
limit: 1, limit: 1,
limitFileCount: 1, limitFileCount: 1,
resReName: 'data.fullFileWatermarkPath', resReName: 'data.fullFileWatermarkPath',
@ -212,10 +224,10 @@ export class CtcCaptatinAddComponent implements OnInit {
listType: 'picture-card', listType: 'picture-card',
change: (args: any) => { change: (args: any) => {
if (args.type === 'success') { 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'); this.checkIdCard(args.file.response.data.fullFilePath, 'front');
} else { } else {
this.detailData.certificatePhotoFront = '' this.detailData.identityInfoDTO.certificatePhotoFront = ''
} }
}, },
beforeUpload: (file: any, _fileList: any) => { beforeUpload: (file: any, _fileList: any) => {
@ -230,6 +242,7 @@ export class CtcCaptatinAddComponent implements OnInit {
observer.complete(); observer.complete();
}); });
}, },
previewFile: (file: any) => { }
}, },
default: this.detailData.identityInfoDTO.certificatePhotoFrontWatermark default: this.detailData.identityInfoDTO.certificatePhotoFrontWatermark
}, },
@ -244,11 +257,11 @@ export class CtcCaptatinAddComponent implements OnInit {
certificatePhotoBackWatermark: { certificatePhotoBackWatermark: {
type: 'string', type: 'string',
title: '', title: '',
readOnly: this.i.id || this.readFlag, readOnly: (this.i.id && (this.i.driverLicenseStatus === 10 || this.i.driverLicenseStatus === 20)) || this.readFlag,
ui: { ui: {
offsetControl: 6, offsetControl: 6,
action: apiConf.fileUpload, action: apiConf.fileUpload,
fileType: 'image/png,image/jpeg,image/jpg,image/gif', accept: 'image/png,image/jpeg,image/jpg,image/gif',
limit: 1, limit: 1,
limitFileCount: 1, limitFileCount: 1,
resReName: 'data.fullFileWatermarkPath', resReName: 'data.fullFileWatermarkPath',
@ -263,9 +276,9 @@ export class CtcCaptatinAddComponent implements OnInit {
listType: 'picture-card', listType: 'picture-card',
change: (args: any) => { change: (args: any) => {
if (args.type === 'success') { if (args.type === 'success') {
this.detailData.certificatePhotoBack = args.file.response.data.fullFilePath this.detailData.identityInfoDTO.certificatePhotoBack = args.file.response.data.fullFilePath
} else { } else {
this.detailData.certificatePhotoBack = '' this.detailData.identityInfoDTO.certificatePhotoBack = ''
} }
}, },
beforeUpload: (file: any, _fileList: any) => { beforeUpload: (file: any, _fileList: any) => {
@ -280,15 +293,16 @@ export class CtcCaptatinAddComponent implements OnInit {
observer.complete(); observer.complete();
}); });
}, },
previewFile: (file: any) => { }
}, },
default: this.detailData.identityInfoDTO.certificatePhotoBackWatermark default: this.detailData.identityInfoDTO.certificatePhotoBackWatermark
}, },
certificateNumber: { certificateNumber: {
title: '身份证号', title: '身份证号',
type: 'string', type: 'string',
readOnly: this.readFlag, readOnly: (this.i.id && (this.i.driverLicenseStatus === 10 || this.i.driverLicenseStatus === 20)) || this.readFlag,
ui: { ui: {
widget: this.i.id ? 'text' : '', widget: this.i.id && (this.i.driverLicenseStatus !== 10 && this.i.driverLicenseStatus !== 20) ? 'text' : '',
placeholder: '请输入身份证号', placeholder: '请输入身份证号',
}, },
default: this.detailData.identityInfoDTO.certificateNumber default: this.detailData.identityInfoDTO.certificateNumber
@ -298,7 +312,7 @@ export class CtcCaptatinAddComponent implements OnInit {
type: 'string', type: 'string',
maxLength: 100, maxLength: 100,
ui: { ui: {
widget: this.i.id ? 'text' : 'textarea', widget: 'textarea',
placeholder: '请输入备注', placeholder: '请输入备注',
autosize: { minRows: 2, maxRows: 6 }, autosize: { minRows: 2, maxRows: 6 },
}, },