fix bug
This commit is contained in:
		| @ -1,4 +1,14 @@ | ||||
| <page-header-wrapper [title]="'新增企业'"></page-header-wrapper> | ||||
| <!-- | ||||
|  * @Description  :  | ||||
|  * @Version      : 1.0 | ||||
|  * @Author       : Shiming | ||||
|  * @Date         : 2022-02-17 15:01:33 | ||||
|  * @LastEditors  : Shiming | ||||
|  * @LastEditTime : 2022-02-17 20:51:29 | ||||
|  * @FilePath     : \\tms-obc-web\\src\\app\\routes\\sys-setting\\components\\network-freight\\new\\new.component.html | ||||
|  * Copyright (C) 2022 huzhenhong. All rights reserved. | ||||
| --> | ||||
| <page-header-wrapper [title]="'新增网络货运人'"></page-header-wrapper> | ||||
| <nz-card> | ||||
|   <sf #sf1 [ui]="ui" [schema]="schema1" [button]="'none'"> | ||||
|     <ng-template sf-template="title1" let-me let-ui="ui" let-schema="schema"> | ||||
| @ -44,46 +54,8 @@ | ||||
|   </sf> | ||||
|  | ||||
|   <sf #sf [ui]="ui" [schema]="schema" [button]="'none'"> | ||||
|     <ng-template sf-template="title1" let-me let-ui="ui" let-schema="schema"> | ||||
|       <div class="form-title">企业开票信息</div> | ||||
|     </ng-template> | ||||
|     <ng-template sf-template="title99" let-me let-ui="ui" let-schema="schema"> | ||||
|       <div class="form-title">企业管理员信息</div> | ||||
|     </ng-template> | ||||
|  | ||||
|     <ng-template sf-template="tipsD" let-me let-ui="ui" let-schema="schema"> | ||||
|       <div class="pr"  style="z-index: 999;"> | ||||
|         <div>请上传该企业授权您成为本系统企业管理员的文件的高清照片,需加盖公司印章</div> | ||||
|         <div>上传后系统会自动识别并填写</div> | ||||
|         <div></div> | ||||
|         <div class="pa"><img height="112px" style="margin-top: 12px;z-index: 9999;" | ||||
|             (click)="service.showImg('./assets/images/usercenter/agree.png')" | ||||
|             src="./assets/images/usercenter/agree.png" /></div> | ||||
|       </div> | ||||
|     </ng-template> | ||||
|     <ng-template sf-template="tips" let-me let-ui="ui" let-schema="schema"> | ||||
|       <div class="pr"> | ||||
|         <div>请上传身份证原件的高清照片,若上传复印件,则需申请人签字;</div> | ||||
|         <div>上传后系统会自动识别并填写</div> | ||||
|       </div> | ||||
|     </ng-template> | ||||
|     <ng-template sf-template="tipsA" let-me let-ui="ui" let-schema="schema"> | ||||
|       <div class="pr"> | ||||
|         <dl class="tips"> | ||||
|           <dt>正面照(人像面)</dt> | ||||
|           <dd>示例</dd> | ||||
|         </dl> | ||||
|         <div class="pa"><img width="190" src="./assets/images/usercenter/certificate-demo-front.png" /></div> | ||||
|       </div> | ||||
|     </ng-template> | ||||
|     <ng-template sf-template="tipsB" let-me let-ui="ui" let-schema="schema"> | ||||
|       <div class="pr"> | ||||
|         <dl class="tips"> | ||||
|           <dt>背面照(国徽面)</dt> | ||||
|           <dd>示例</dd> | ||||
|         </dl> | ||||
|         <div class="pa"><img width="190" src="./assets/images/usercenter/certificate-demo-back.png" /></div> | ||||
|       </div> | ||||
|       <div class="form-title">其他信息</div> | ||||
|     </ng-template> | ||||
|   </sf> | ||||
|  | ||||
|  | ||||
| @ -13,7 +13,8 @@ import { | ||||
| } from '@delon/form'; | ||||
| import { NzUploadFile } from 'ng-zorro-antd/upload'; | ||||
| import { of } from 'rxjs'; | ||||
| import { UsermanageService } from 'src/app/routes/usercenter/services/usercenter.service'; | ||||
| import { SystemService } from '../../../services/system.service'; | ||||
|  | ||||
|  | ||||
| const IMAGECONFIG = { | ||||
|   previewFile: (file: NzUploadFile) => of(file.url), | ||||
| @ -76,7 +77,7 @@ export class NetworkFreightNewComponent implements OnInit { | ||||
|     } | ||||
|   }; | ||||
|  | ||||
|   constructor(private router: Router, public service: UsermanageService) {} | ||||
|   constructor(private router: Router, public service: SystemService) {} | ||||
|   ngOnInit() {} | ||||
|  | ||||
|   submitForm() { | ||||
| @ -99,42 +100,22 @@ export class NetworkFreightNewComponent implements OnInit { | ||||
|         return; | ||||
|       } | ||||
|     } | ||||
|     const validStartTime = new Date(this.sf1.value.legalPersonIdentityDTO.validStartTime); | ||||
|     if (this.sf1.value.legalPersonIdentityDTO.validEndTime) { | ||||
|       const validEndTime = new Date(this.sf1.value.legalPersonIdentityDTO.validEndTime); | ||||
|       if (validStartTime.getTime() > validEndTime.getTime()) { | ||||
|         this.service.msgSrv.warning('法人证件有效截止日期小于开始日期'); | ||||
|         return; | ||||
|       } | ||||
|     } | ||||
|     const sfVlaue = this.sf.value; | ||||
|     const params = {}; | ||||
|     const sfVlaue = this.sf1.value; | ||||
|     const params: any = {}; | ||||
|     Object.assign( | ||||
|       params, | ||||
|       { ...this.sf1.value }, | ||||
|       { ...this.sf.value }, | ||||
|       { | ||||
|         enterpriseAddressCode: this.sf1.value.enterpriseAddressCode[2], | ||||
|         oftenUsedServices: sfVlaue.oftenUsedServices, | ||||
|         registerAddress: sfVlaue.registerAddress, | ||||
|         registerPhone: sfVlaue.registerPhone, | ||||
|         creditPhoto: sfVlaue.creditPhoto, | ||||
|         creditPhotoWatermark: sfVlaue.creditPhotoWatermark, | ||||
|         promotersTelephone: sfVlaue.promotersTelephone, | ||||
|         networkTransporter: sfVlaue.networkTransporter, | ||||
|         adminUserInfo: { | ||||
|           certificateNumber: sfVlaue.certificateNumber, | ||||
|           certificatePhotoBack: sfVlaue.certificatePhotoBack, | ||||
|           certificatePhotoBackWatermark: sfVlaue.certificatePhotoBackWatermark, | ||||
|           certificatePhotoFront: sfVlaue.certificatePhotoFront, | ||||
|           certificatePhotoFrontWatermark: sfVlaue.certificatePhotoFrontWatermark, | ||||
|           name: sfVlaue.name | ||||
|         } | ||||
|         ...this.sf.value , | ||||
|         enterpriseInfoDTO: this.sf1.value | ||||
|       } | ||||
|     ); | ||||
|     this.service.request(this.service.$api_save_enterprise_admin, params).subscribe(res => { | ||||
|     console.log(params); | ||||
|     console.log(this.sf.value); | ||||
|     console.log(this.sf1.value); | ||||
|     params.enterpriseInfoDTO.enterpriseAddressCode = this.sf1.value?.enterpriseAddressCode?.[2]; | ||||
|     this.service.request(this.service.$api_networkTransporter_save, params).subscribe(res => { | ||||
|       if (res) { | ||||
|         this.service.msgSrv.success('企业新增成功'); | ||||
|         this.service.msgSrv.success('网络货运人新增成功'); | ||||
|         this.goBack(); | ||||
|       } | ||||
|     }); | ||||
| @ -167,18 +148,6 @@ export class NetworkFreightNewComponent implements OnInit { | ||||
|               this.sf1.setValue('/legalPersonIdentityDTO/certificateNumber', res.number); | ||||
|             } | ||||
|           } | ||||
|           if (isFront === 'back') { | ||||
|             // 背面 | ||||
|             if (res.validFrom) { | ||||
|               this.sf1.setValue('/legalPersonIdentityDTO/validStartTime', res.validFrom); | ||||
|             } | ||||
|             if (res.validTo) { | ||||
|               this.sf1.setValue('/legalPersonIdentityDTO/validEndTime', res.validTo); | ||||
|               this.sf1.setValue('/legalPersonIdentityDTO/isLoingDate', false); | ||||
|             } else { | ||||
|               this.sf1.setValue('/legalPersonIdentityDTO/isLoingDate', true); | ||||
|             } | ||||
|           } | ||||
|         } | ||||
|         // 企业管理员证件照 | ||||
|         if (type === 0) { | ||||
| @ -206,9 +175,6 @@ export class NetworkFreightNewComponent implements OnInit { | ||||
|         if (res.name) { | ||||
|           this.sf1.setValue('/enterpriseName', res.name); | ||||
|         } | ||||
|         if (res.type) { | ||||
|           this.sf1.setValue('/enterpriseType', res.type); | ||||
|         } | ||||
|         if (res.addressRegionCodes) { | ||||
|           this.sf1.setValue('/enterpriseAddressCode', res.addressRegionCodes); | ||||
|         } | ||||
| @ -260,6 +226,19 @@ export class NetworkFreightNewComponent implements OnInit { | ||||
|             } | ||||
|           } as SFUploadWidgetSchema | ||||
|         }, | ||||
|         enterpriseName: { | ||||
|           title: '公司名称', | ||||
|           type: 'string', | ||||
|           minLength: 1, | ||||
|           maxLength: 100, | ||||
|           ui: { | ||||
|             grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|             placeholder: '请输入公司名称', | ||||
|             errors: { | ||||
|               required: '请输入公司名称' | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         unifiedSocialCreditCode: { | ||||
|           title: '统一社会信用代码', | ||||
|           type: 'string', | ||||
| @ -275,30 +254,18 @@ export class NetworkFreightNewComponent implements OnInit { | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         enterpriseName: { | ||||
|           title: '公司名称', | ||||
|         certificateType2: { | ||||
|           type: 'string', | ||||
|           minLength: 1, | ||||
|           maxLength: 100, | ||||
|           title: '行业', | ||||
|           enum: [ | ||||
|             { label: '大陆身份证', value: 0 }, | ||||
|             { label: '港澳居民通行证', value: 1 }, | ||||
|             { label: '香港居民通行证', value: 2 } | ||||
|           ], | ||||
|           default: 0, | ||||
|           ui: { | ||||
|             grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|             placeholder: '请输入公司名称', | ||||
|             errors: { | ||||
|               required: '请输入公司名称' | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         enterpriseType: { | ||||
|           title: '公司类型', | ||||
|           type: 'string', | ||||
|           minLength: 1, | ||||
|           maxLength: 30, | ||||
|           ui: { | ||||
|             grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|             placeholder: '请输入公司类型', | ||||
|             errors: { | ||||
|               required: '请输入公司类型' | ||||
|             } | ||||
|             widget: 'select' | ||||
|           } | ||||
|         }, | ||||
|         enterpriseAddressCode: { | ||||
| @ -353,6 +320,20 @@ export class NetworkFreightNewComponent implements OnInit { | ||||
|             precision: 0 | ||||
|           } | ||||
|         }, | ||||
|         staffNumber: { | ||||
|           title: '从业人数', | ||||
|           type: 'number', | ||||
|           minimum: 1, | ||||
|           maximum: 99999999999999999999, | ||||
|           ui: { | ||||
|             grid: { xxl: 13, xl: 18, lg: 22, md: 22 }, | ||||
|             placeholder: '请输入从业人数', | ||||
|             errors: { | ||||
|               required: '请输入从业人数' | ||||
|             }, | ||||
|             precision: 0 | ||||
|           } | ||||
|         }, | ||||
|         enterpriseRegistrationTime: { | ||||
|           title: '成立日期', | ||||
|           type: 'string', | ||||
| @ -364,11 +345,7 @@ export class NetworkFreightNewComponent implements OnInit { | ||||
|             } | ||||
|           } as SFDateWidgetSchema | ||||
|         }, | ||||
|         blank1: { | ||||
|           type: 'string', | ||||
|           ui: { widget: 'text', grid: { xxl: 11, xl: 6, md: 0, sm: 0 }, class: 'input-back' }, | ||||
|           default: ' ' | ||||
|         }, | ||||
|         | ||||
|         operatingStartTime: { | ||||
|           title: '营业期限', | ||||
|           type: 'string', | ||||
| @ -434,6 +411,19 @@ export class NetworkFreightNewComponent implements OnInit { | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         taxStatus: { | ||||
|           title: '纳税状态', | ||||
|           type: 'string', | ||||
|           minLength: 1, | ||||
|           maxLength: 30, | ||||
|           ui: { | ||||
|             grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|             placeholder: '请输入纳税状态', | ||||
|             errors: { | ||||
|               required: '请输入纳税状态' | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|  | ||||
|         legalPersonIdentityDTO: { | ||||
|           type: 'object', | ||||
| @ -505,62 +495,24 @@ export class NetworkFreightNewComponent implements OnInit { | ||||
|                 grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|                 placeholder: '请输入法定代表人证件号' | ||||
|               } | ||||
|             }, | ||||
|             validStartTime: { | ||||
|               title: '法人证件有效开始日期', | ||||
|               type: 'string', | ||||
|               ui: { | ||||
|                 grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|                 widget: 'date', | ||||
|                 format: 'yyyy-MM-dd', | ||||
|                 placeholder: '请选择', | ||||
|                 errors: { | ||||
|                   required: '请选择开始日期' | ||||
|                 } | ||||
|               } as SFDateWidgetSchema | ||||
|             }, | ||||
|             validEndTime: { | ||||
|               title: '法人证件有效截止日期', | ||||
|               type: 'string', | ||||
|               ui: { | ||||
|                 grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|                 widget: 'date', | ||||
|                 format: 'yyyy-MM-dd', | ||||
|                 placeholder: '请选择', | ||||
|                 errors: { | ||||
|                   required: '请选择截止日期' | ||||
|                 }, | ||||
|                 change: i => { | ||||
|                   this.sf1?.setValue('/legalPersonIdentityDTO/isLoingDate', false); | ||||
|                 } | ||||
|               } as SFDateWidgetSchema | ||||
|             }, | ||||
|             isLoingDate: { | ||||
|               title: '长期', | ||||
|               type: 'boolean', | ||||
|               ui: { | ||||
|                 spanLabelFixed: 100, | ||||
|                 grid: { span: 6 }, | ||||
|                 class: 'input-back', | ||||
|                 widget: 'checkbox', | ||||
|                 change: i => this.sf1?.setValue('/legalPersonIdentityDTO/validEndTime', null) | ||||
|               } as SFCheckboxWidgetSchema | ||||
|             } | ||||
|           }, | ||||
|           required: ['certificatePhotoFront', 'certificatePhotoBack', 'name', 'certificateType', 'certificateNumber', 'validStartTime'] | ||||
|           required: ['certificatePhotoFront', 'certificatePhotoBack', 'name', 'certificateType', 'certificateNumber',] | ||||
|         } | ||||
|       }, | ||||
|       required: [ | ||||
|         'licensePhotoWatermark', | ||||
|         'unifiedSocialCreditCode', | ||||
|         'enterpriseName', | ||||
|         'enterpriseType', | ||||
|         'enterpriseAddressCode', | ||||
|         'enterpriseAddress', | ||||
|         'registrationCapital', | ||||
|         'enterpriseRegistrationTime', | ||||
|         'operatingStartTime', | ||||
|         'businessScope' | ||||
|         'businessScope', | ||||
|         'taxStatus', | ||||
|         'staffNumber', | ||||
|         'taxAuthority' | ||||
|       ] | ||||
|     }; | ||||
|   } | ||||
| @ -568,170 +520,26 @@ export class NetworkFreightNewComponent implements OnInit { | ||||
|   private initOthersSF(): SFSchema { | ||||
|     return { | ||||
|       properties: { | ||||
|         title1: { title: '', type: 'string', ui: { widget: 'custom' } }, | ||||
|         createBank: { | ||||
|           title: '开户银行', | ||||
|           type: 'string', | ||||
|           ui: { grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, placeholder: '请输入银行账号' } | ||||
|         }, | ||||
|         bankAccount: { | ||||
|           title: '银行账号', | ||||
|           type: 'string', | ||||
|           ui: { grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, placeholder: '请输入银行账号' } | ||||
|         }, | ||||
|         registerAddress: { | ||||
|           title: ' 注册地址', | ||||
|           type: 'string', | ||||
|           ui: { grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, placeholder: '请输入注册地址' } | ||||
|         }, | ||||
|         registerPhone: { | ||||
|           title: ' 注册电话', | ||||
|           type: 'string', | ||||
|           format: 'mobile', | ||||
|           minLength: 1, | ||||
|           maxLength: 11, | ||||
|           ui: { | ||||
|             grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|             placeholder: '请输入注册电话', | ||||
|             errors: { required: '请输入注册电话', format: '手机号格式错误' } | ||||
|           } | ||||
|         }, | ||||
|  | ||||
|         title99: { title: '', type: 'string', ui: { widget: 'custom' } }, | ||||
|         adminMobile: { | ||||
|           title: ' 企业管理员手机号', | ||||
|         website: { | ||||
|           title: '平台网址', | ||||
|           type: 'string', | ||||
|           minLength: 1, | ||||
|           format: 'mobile', | ||||
|           maxLength: 11, | ||||
|           maxLength: 70, | ||||
|           ui: { | ||||
|             grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|             placeholder: '请输入企业管理员手机号', | ||||
|             errors: { required: '请输入企业管理员手机号', format: '手机号格式错误' } | ||||
|             placeholder: '请输入平台网址' | ||||
|           } | ||||
|         }, | ||||
|         tipsA: { | ||||
|           title: '企业管理员证件照', | ||||
|         costRate: { | ||||
|           title: '成本费率', | ||||
|           type: 'string', | ||||
|           ui: { | ||||
|             widget: 'custom' | ||||
|           } | ||||
|         }, | ||||
|         certificatePhotoFront: { title: '', type: 'string', ui: { hidden: true } }, | ||||
|         certificatePhotoBack: { title: '', type: 'string', ui: { hidden: true } }, | ||||
|         certificatePhotoFrontWatermark: { | ||||
|           type: 'string', | ||||
|           title: '', | ||||
|           ui: { | ||||
|             ...IMAGECONFIG, | ||||
|             descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过5M', | ||||
|             change: args => { | ||||
|               if (args.type === 'success') { | ||||
|                 this.sf.setValue('/certificatePhotoFront', args.fileList[0].response.data.fullFilePath); | ||||
|                 this.checkIdCard(args.fileList[0].response.data.fullFilePath, 'front', 0); | ||||
|               } | ||||
|             } | ||||
|           } as SFUploadWidgetSchema | ||||
|         }, | ||||
|         tipsB: { | ||||
|           title: '', | ||||
|           type: 'string', | ||||
|           ui: { | ||||
|             widget: 'custom', | ||||
|             offsetControl: 6 | ||||
|           } | ||||
|         }, | ||||
|         certificatePhotoBackWatermark: { | ||||
|           type: 'string', | ||||
|           title: '', | ||||
|           ui: { | ||||
|             ...IMAGECONFIG, | ||||
|             descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过5M', | ||||
|             change: args => { | ||||
|               if (args.type === 'success') { | ||||
|                 this.sf.setValue('/certificatePhotoBack', args.fileList[0].response.data.fullFilePath); | ||||
|               } | ||||
|             } | ||||
|           } as SFUploadWidgetSchema | ||||
|         }, | ||||
|         name: { | ||||
|           title: '企业管理员姓名', | ||||
|           type: 'string', | ||||
|           maxLength: 8, | ||||
|           ui: { | ||||
|             grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|             placeholder: '请输入企业管理员姓名' | ||||
|             placeholder: '请输入成本费率' | ||||
|           } | ||||
|         }, | ||||
|         certificateNumber: { | ||||
|           title: '企业管理员身份证号', | ||||
|           type: 'string', | ||||
|           format: 'id-card', | ||||
|           minLength: 1, | ||||
|           maxLength: 18, | ||||
|           ui: { | ||||
|             grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|             placeholder: '请输入企业管理员身份证号' | ||||
|           } | ||||
|         }, | ||||
|         tipsD: { title: '企业授权函', type: 'string', ui: { widget: 'custom' }, default: 1 }, | ||||
|         creditPhoto: { title: '', type: 'string', ui: { hidden: true } }, | ||||
|         creditPhotoWatermark: { | ||||
|           type: 'string', | ||||
|           title: '', | ||||
|           ui: { | ||||
|             ...IMAGECONFIG, | ||||
|             descriptionI18n: '图片支持jpg、jpeg、png、gif格式,大小不超过5M', | ||||
|             change: args => { | ||||
|               if (args.type === 'success') { | ||||
|                 this.sf.setValue('/creditPhoto', args.fileList[0].response.data.fullFilePath); | ||||
|               } | ||||
|             } | ||||
|           } as SFUploadWidgetSchema | ||||
|         }, | ||||
|         oftenUsedServices: { | ||||
|           type: 'string', | ||||
|           title: '常用服务', | ||||
|           enum: [ | ||||
|             { label: '整车发货', value: 10 }, | ||||
|             { label: '大宗发货', value: 20 } | ||||
|           ], | ||||
|           default: '', | ||||
|           ui: { | ||||
|             grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|             widget: 'select', | ||||
|             placeholder: '请选择', | ||||
|             visibleIf: { | ||||
|               expand: (value: boolean) => value | ||||
|             } | ||||
|           } | ||||
|         }, | ||||
|         promotersTelephone: { | ||||
|           title: '推广业务员手机号', | ||||
|           type: 'string', | ||||
|           minLength: 1, | ||||
|           format: 'mobile', | ||||
|           maxLength: 11, | ||||
|           ui: { | ||||
|             grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|             placeholder: '请输入推广业务员手机号', | ||||
|             errors: { required: '请输入推广业务员手机号', format: '手机号格式错误' } | ||||
|           } | ||||
|         }, | ||||
|         networkTransporter: { | ||||
|           type: 'string', | ||||
|           title: '网络货运人', | ||||
|           ui: { | ||||
|             grid: { xxl: 13, xl: 18, lg: 24, md: 24 }, | ||||
|             widget: 'select', | ||||
|             placeholder: '请选择', | ||||
|             allowClear: true, | ||||
|             asyncData: () => this.service.getNetworkFreightForwarder() | ||||
|           }, | ||||
|           default: '' | ||||
|         } | ||||
|       }, | ||||
|       required: ['createBank', 'bankAccount', 'adminMobile', 'name', 'certificateNumber', 'tipsD', 'creditPhoto', 'networkTransporter'] | ||||
|       required: ['website', 'bankAccount'] | ||||
|     }; | ||||
|   } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user