This commit is contained in:
wangshiming
2022-04-27 19:42:26 +08:00
parent 07c60aa3b4
commit 63175bd00d
2 changed files with 165 additions and 157 deletions

View File

@ -4,7 +4,7 @@
* @Author : Shiming
* @Date : 2022-03-14 14:17:38
* @LastEditors : Shiming
* @LastEditTime : 2022-03-25 16:22:32
* @LastEditTime : 2022-04-27 19:39:30
* @FilePath : \\tms-obc-web\\src\\app\\routes\\vehicle\\components\\list\\carauth\\carauth.component.html
* Copyright (C) 2022 huzhenhong. All rights reserved.
-->
@ -38,6 +38,9 @@
<ng-template sf-template="agreeImg" let-me let-ui="ui" let-schema="schema">
<img height="104" src="/assets/images/vehicle/agreement.png" class="borderImg" />
</ng-template>
<div #aaa style="position: absolute; top: 87.5%; left: 21%; opacity: 0; ">
<div style="color: #0c77e7;" (click)='view()'>点击查看行政区域代码</div>
</div>
</sf>
<img class="drivercard borderImg" height="104" src="/assets/images/vehicle/car.png" />

View File

@ -2,7 +2,7 @@ import { Placeholder } from '@angular/compiler/src/i18n/i18n_ast';
import { Component, OnInit, ViewChild } from '@angular/core';
import { apiConf } from '@conf/api.conf';
import { cacheConf } from '@conf/cache.conf';
import { SFUISchema, SFSchema, SFUploadWidgetSchema, SFComponent, SFSelectWidgetSchema } from '@delon/form';
import { SFUISchema, SFSchema, SFUploadWidgetSchema, SFComponent, SFSelectWidgetSchema, SFTextWidgetSchema } from '@delon/form';
import { _HttpClient } from '@delon/theme';
import { EACacheService, EAEnvironmentService } from '@shared';
import { NzModalRef } from 'ng-zorro-antd/modal';
@ -17,6 +17,7 @@ import { VehicleService } from '../../../services/vehicle.service';
})
export class CarSettleCarauthComponent implements OnInit {
@ViewChild('sf', { static: false }) sf!: SFComponent;
@ViewChild('aaa', { static: false }) aaa!:any;
record: any = {};
i: any;
ui: SFUISchema = {};
@ -25,39 +26,39 @@ export class CarSettleCarauthComponent implements OnInit {
showJopFlag = false;
companyData: any = {};
detailData: any = {};
carNo = ''
carNo = '';
private titles = `
根据监管要求:总质量 4.5 吨及以下普通货 运车辆的,可填车籍地 6 位行政<div style="col: red">区域代码</div> 000000。
`
根据监管要求:总质量 4.5 吨及以下普通货 运车辆的,可填车籍地 6 位行政区域代码+000000。
`;
constructor(
private modal: NzModalRef,
public service: VehicleService,
private envSrv: EAEnvironmentService,
private eaCacheSrv: EACacheService,
) { }
private eaCacheSrv: EACacheService
) {}
ngOnInit(): void {
this.initData()
this.initSF()
this.initData();
this.initSF();
}
initData() {
if (this.i.id) {
this.companyData = this.eaCacheSrv.get(cacheConf.env)
this.companyData = this.eaCacheSrv.get(cacheConf.env);
const params = {
id: this.i.id,
}
id: this.i.id
};
this.service.request(this.service.$api_shipperCarGet, params).subscribe(res => {
this.detailData = res
this.detailData.isSelf = res.isSelf ? 1 : 0
this.detailData.isTrailer = res.isTrailer ? 1 : 0
this.detailData = res;
this.detailData.isSelf = res.isSelf ? 1 : 0;
this.detailData.isTrailer = res.isTrailer ? 1 : 0;
this.detailData.carFrontPhotoWatermark = [
{
uid: -1,
name: 'LOGO',
status: 'done',
url: this.detailData.carFrontPhotoWatermark,
response: this.detailData.carFrontPhotoWatermark,
},
response: this.detailData.carFrontPhotoWatermark
}
];
this.detailData.carProtocalWatermark = [
{
@ -65,8 +66,8 @@ export class CarSettleCarauthComponent implements OnInit {
name: 'LOGO',
status: 'done',
url: this.detailData.carProtocalWatermark,
response: this.detailData.carProtocalWatermark,
},
response: this.detailData.carProtocalWatermark
}
];
this.detailData.certificatePhotoFrontWatermark = [
{
@ -74,8 +75,8 @@ export class CarSettleCarauthComponent implements OnInit {
name: 'LOGO',
status: 'done',
url: this.detailData.certificatePhotoFrontWatermark,
response: this.detailData.certificatePhotoFrontWatermark,
},
response: this.detailData.certificatePhotoFrontWatermark
}
];
this.detailData.certificatePhotoBackWatermark = [
{
@ -83,8 +84,8 @@ export class CarSettleCarauthComponent implements OnInit {
name: 'LOGO',
status: 'done',
url: this.detailData.certificatePhotoBackWatermark,
response: this.detailData.certificatePhotoBackWatermark,
},
response: this.detailData.certificatePhotoBackWatermark
}
];
this.detailData.roadTransportPhotoWatermark = [
{
@ -92,10 +93,10 @@ export class CarSettleCarauthComponent implements OnInit {
name: 'LOGO',
status: 'done',
url: this.detailData.roadTransportPhotoWatermark,
response: this.detailData.roadTransportPhotoWatermark,
},
response: this.detailData.roadTransportPhotoWatermark
}
];
})
});
}
}
initSF() {
@ -114,7 +115,7 @@ export class CarSettleCarauthComponent implements OnInit {
widget: 'upload',
descriptionI18n: '请上传车头照照片支持JPG、PNG格式文件小于5M。',
data: {
appId: this.envSrv.env.appId,
appId: this.envSrv.env.appId
},
name: 'multipartFile',
multiple: false,
@ -129,9 +130,9 @@ export class CarSettleCarauthComponent implements OnInit {
status: 'done',
url: args.file.response.data.fullFileWatermarkPath,
response: {
url: args.file.response.data.fullFileWatermarkPath,
},
},
url: args.file.response.data.fullFileWatermarkPath
}
}
];
this.sf?.setValue('/carFrontPhotoWatermark', avatar);
this.detailData.carFrontPhoto = args.file.response.data.fullFilePath;
@ -146,12 +147,12 @@ export class CarSettleCarauthComponent implements OnInit {
observer.complete();
return;
}
console.log(_fileList)
console.log(_fileList);
observer.next(isLt2M);
observer.complete();
});
},
}
// previewFile: (file: NzUploadFile) => of(
// file?.response?.data?.fullFilePath
// ),
@ -162,8 +163,8 @@ export class CarSettleCarauthComponent implements OnInit {
maxLength: 9,
type: 'string',
ui: {
placeholder: '请输入',
},
placeholder: '请输入'
}
},
carNoColor: {
title: '车牌颜色',
@ -172,16 +173,16 @@ export class CarSettleCarauthComponent implements OnInit {
widget: 'dict-select',
params: { dictKey: 'car:color' },
placeholder: '请选择车牌颜色',
containsAllLabel:false,
} as SFSelectWidgetSchema,
containsAllLabel: false
} as SFSelectWidgetSchema
},
carModel: {
title: '车型',
type: 'string',
readOnly: true,
ui: {
placeholder:'请上传行驶证自动带出'
},
placeholder: '请上传行驶证自动带出'
}
},
carEnergyType: {
title: '车辆能源类型',
@ -190,8 +191,8 @@ export class CarSettleCarauthComponent implements OnInit {
widget: 'dict-select',
params: { dictKey: 'car:energy:type' },
placeholder: '请选择车辆能源类型',
containsAllLabel:false,
},
containsAllLabel: false
}
},
carLength: {
title: '车长',
@ -200,8 +201,8 @@ export class CarSettleCarauthComponent implements OnInit {
widget: 'dict-select',
params: { dictKey: 'car:length' },
placeholder: '请选择车长',
containsAllLabel:false,
} as SFSelectWidgetSchema,
containsAllLabel: false
} as SFSelectWidgetSchema
},
carLoad: {
title: '核定载质量',
@ -210,10 +211,10 @@ export class CarSettleCarauthComponent implements OnInit {
ui: {
placeholder: '请输入',
addOnAfter: '吨',
change: (val: any) =>{
const value = val.replace(/\D/g,'')
this.sf.setValue('/carLoad', value)
},
change: (val: any) => {
const value = val.replace(/\D/g, '');
this.sf.setValue('/carLoad', value);
}
}
},
isSelf: {
@ -221,11 +222,11 @@ export class CarSettleCarauthComponent implements OnInit {
type: 'string',
enum: [
{ label: '否', value: 0 },
{ label: '是', value: 1 },
{ label: '是', value: 1 }
],
ui: {
widget: 'select',
placeholder: '请选择',
placeholder: '请选择'
}
},
isTrailer: {
@ -233,11 +234,11 @@ export class CarSettleCarauthComponent implements OnInit {
type: 'string',
enum: [
{ label: '否', value: 0 },
{ label: '是', value: 1 },
{ label: '是', value: 1 }
],
ui: {
widget: 'select',
placeholder: '请选择',
placeholder: '请选择'
}
},
carProtocalWatermark: {
@ -253,7 +254,7 @@ export class CarSettleCarauthComponent implements OnInit {
widget: 'upload',
descriptionI18n: '请上传挂靠协议支持JPG、PNG格式文件小于5M。',
data: {
appId: this.envSrv.env.appId,
appId: this.envSrv.env.appId
},
name: 'multipartFile',
multiple: false,
@ -267,12 +268,12 @@ export class CarSettleCarauthComponent implements OnInit {
status: 'done',
url: args.file.response.data.fullFileWatermarkPath,
response: {
url: args.file.response.data.fullFileWatermarkPath,
},
},
url: args.file.response.data.fullFileWatermarkPath
}
}
];
this.sf?.setValue('/carProtocalWatermark', avatar);
this.detailData.certificatePhotoFront = args.file.response.data.fullFilePath
this.detailData.certificatePhotoFront = args.file.response.data.fullFilePath;
}
},
beforeUpload: (file: any, _fileList: any) => {
@ -287,7 +288,7 @@ export class CarSettleCarauthComponent implements OnInit {
observer.complete();
});
},
previewFile: (file: NzUploadFile) => of(file.url),
previewFile: (file: NzUploadFile) => of(file.url)
}
},
agreeImg: {
@ -295,24 +296,24 @@ export class CarSettleCarauthComponent implements OnInit {
type: 'boolean',
// enum: [{ label: '长期', value: true }],
ui: {
widget: 'custom',
widget: 'custom'
}
},
titleA: {
title: '行驶证信息(必填)',
type: 'string',
ui: {
widget: 'text',
widget: 'text'
},
default: '照片上传后会自动识别文字并填充下列内容栏',
default: '照片上传后会自动识别文字并填充下列内容栏'
},
tipsA: {
title: '',
type: 'string',
ui: {
widget: 'custom',
offsetControl: 6,
},
offsetControl: 6
}
},
certificatePhotoFrontWatermark: {
type: 'string',
@ -327,7 +328,7 @@ export class CarSettleCarauthComponent implements OnInit {
widget: 'upload',
descriptionI18n: '请上传行驶证首页照片支持JPG、PNG格式文件小于5M。照片信息缺失、拼凑、过度PS、模糊不清都不会通过审核。',
data: {
appId: this.envSrv.env.appId,
appId: this.envSrv.env.appId
},
name: 'multipartFile',
multiple: false,
@ -341,15 +342,15 @@ export class CarSettleCarauthComponent implements OnInit {
status: 'done',
url: args.file.response.data.fullFileWatermarkPath,
response: {
url: args.file.response.data.fullFileWatermarkPath,
},
},
url: args.file.response.data.fullFileWatermarkPath
}
}
];
this.sf?.setValue('/certificatePhotoFrontWatermark', avatar);
this.detailData.certificatePhotoFront = args.file.response.data.fullFilePath
this.detailData.certificatePhotoFront = args.file.response.data.fullFilePath;
this.checkCarCard(args.file.response.data.fullFilePath, 'front');
} else {
this.detailData.certificatePhotoFront = ''
this.detailData.certificatePhotoFront = '';
}
},
beforeUpload: (file: any, _fileList: any) => {
@ -363,7 +364,7 @@ export class CarSettleCarauthComponent implements OnInit {
observer.next(isLt2M);
observer.complete();
});
},
}
// previewFile: (file: NzUploadFile) => of(file.url),
}
},
@ -372,8 +373,8 @@ export class CarSettleCarauthComponent implements OnInit {
type: 'string',
ui: {
widget: 'custom',
offsetControl: 6,
},
offsetControl: 6
}
},
certificatePhotoBackWatermark: {
type: 'string',
@ -388,7 +389,7 @@ export class CarSettleCarauthComponent implements OnInit {
widget: 'upload',
descriptionI18n: '请上传行驶证副业照片支持JPG、PNG格式文件小于5M。',
data: {
appId: this.envSrv.env.appId,
appId: this.envSrv.env.appId
},
name: 'multipartFile',
multiple: false,
@ -402,15 +403,15 @@ export class CarSettleCarauthComponent implements OnInit {
status: 'done',
url: args.file.response.data.fullFileWatermarkPath,
response: {
url: args.file.response.data.fullFileWatermarkPath,
},
},
url: args.file.response.data.fullFileWatermarkPath
}
}
];
this.sf?.setValue('/certificatePhotoBackWatermark', avatar);
this.detailData.certificatePhotoBack = args.file.response.data.fullFilePath
this.detailData.certificatePhotoBack = args.file.response.data.fullFilePath;
this.checkCarCard(args.file.response.data.fullFilePath, 'back');
} else {
this.detailData.certificatePhotoBack = ''
this.detailData.certificatePhotoBack = '';
}
},
beforeUpload: (file: any, _fileList: any) => {
@ -424,7 +425,7 @@ export class CarSettleCarauthComponent implements OnInit {
observer.next(isLt2M);
observer.complete();
});
},
}
// previewFile: (file: NzUploadFile) => of(file.url),
}
},
@ -433,16 +434,16 @@ export class CarSettleCarauthComponent implements OnInit {
type: 'string',
format: 'date',
ui: {
placeholder: '请输入',
},
placeholder: '请输入'
}
},
driverLicenseGetTime: {
title: '行驶证发证日期',
type: 'string',
format: 'date',
ui: {
placeholder: '请输入',
},
placeholder: '请输入'
}
},
driverLicenseEndTime: {
title: '行驶证到期日期',
@ -450,65 +451,64 @@ export class CarSettleCarauthComponent implements OnInit {
format: 'date',
maxLength: 30,
ui: {
placeholder: '请输入',
},
placeholder: '请输入'
}
},
driverLicenseSigningOrg: {
title: '行驶证签发机关',
type: 'string',
maxLength: 30,
ui: {
placeholder: '请输入',
},
placeholder: '请输入'
}
},
carDistinguishCode: {
title: '车辆识别代码',
type: 'string',
maxLength: 30,
ui: {
placeholder: '请输入',
},
placeholder: '请输入'
}
},
useNature: {
title: '使用性质',
type: 'string',
maxLength: 30,
ui: {
placeholder: '请输入',
},
placeholder: '请输入'
}
},
curbWeight: {
title: '整备质量',
type: 'string',
ui: {
placeholder: '请输入',
addOnAfter: '吨',
},
addOnAfter: '吨'
}
},
carTotalLoad: {
title: '总质量',
type: 'string',
ui: {
addOnAfter: '吨',
placeholder: '请输入',
},
placeholder: '请输入'
}
},
carOwner: {
title: '所有人',
type: 'string',
maxLength: 30,
ui: {
placeholder: '请输入',
},
placeholder: '请输入'
}
},
titleB: {
title: '道运证(选填)',
type: 'string',
ui: {
widget: 'text',
widget: 'text'
},
default: '照片上传后会自动识别文字并填充下列内容栏',
default: '照片上传后会自动识别文字并填充下列内容栏'
},
roadTransportPhotoWatermark: {
type: 'string',
@ -523,7 +523,7 @@ export class CarSettleCarauthComponent implements OnInit {
widget: 'upload',
descriptionI18n: '请上传道运证照片支持JPG、PNG格式文件小于5M。蓝牌绿牌车辆可不用传道运证',
data: {
appId: this.envSrv.env.appId,
appId: this.envSrv.env.appId
},
name: 'multipartFile',
multiple: false,
@ -537,15 +537,15 @@ export class CarSettleCarauthComponent implements OnInit {
status: 'done',
url: args.file.response.data.fullFileWatermarkPath,
response: {
url: args.file.response.data.fullFileWatermarkPath,
},
},
url: args.file.response.data.fullFileWatermarkPath
}
}
];
this.sf?.setValue('/roadTransportPhotoWatermark', avatar);
this.detailData.roadTransportPhoto = args.file.response.data.fullFilePath
this.detailData.roadTransportPhoto = args.file.response.data.fullFilePath;
this.checkTransCard(args.file.response.data.fullFilePath);
} else {
this.detailData.roadTransportPhoto = ''
this.detailData.roadTransportPhoto = '';
}
},
beforeUpload: (file: any, _fileList: any) => {
@ -559,7 +559,7 @@ export class CarSettleCarauthComponent implements OnInit {
observer.next(isLt2M);
observer.complete();
});
},
}
// previewFile: (file: NzUploadFile) => of(file.url),
}
},
@ -568,7 +568,7 @@ export class CarSettleCarauthComponent implements OnInit {
type: 'boolean',
// enum: [{ label: '长期', value: true }],
ui: {
widget: 'custom',
widget: 'custom'
}
},
roadTransportNo: {
@ -579,35 +579,38 @@ export class CarSettleCarauthComponent implements OnInit {
// widget: this.detailData.commitFlag !== 0 ? 'text' : '',
placeholder: '请输入',
optionalHelp: {
i18n: this.titles,
},
},
i18n: this.titles
}
}
},
'': { type: 'number', ui: { widget: 'text',
html: this.aaa,
defaultText: '点击查看行政区域代码' } as SFTextWidgetSchema },
roadTransportLicenceNo: {
title: '经营许可证号',
type: 'string',
maxLength: 30,
ui: {
// widget: this.detailData.commitFlag !== 0 ? 'text' : '',
placeholder: '请输入',
},
placeholder: '请输入'
}
},
roadTransportStartTime: {
title: '发证日期',
type: 'string',
format: 'date',
ui: {
placeholder: '请输入',
},
placeholder: '请输入'
}
},
roadTransportEndTime: {
title: '有效期至',
type: 'string',
format: 'date',
ui: {
placeholder: '请输入',
},
},
placeholder: '请输入'
}
}
},
required: [
'carFrontPhotoWatermark',
@ -630,61 +633,60 @@ export class CarSettleCarauthComponent implements OnInit {
'curbWeight',
'carTotalLoad',
'carOwner'
],
]
};
this.ui = {
'*': {
spanLabelFixed: 180,
grid: { span: 18 },
width: 600,
width: 600
},
$title1: {
spanLabelFixed: 0,
spanLabelFixed: 0
},
$title2: {
spanLabelFixed: 0,
spanLabelFixed: 0
},
$title3: {
spanLabelFixed: 0,
spanLabelFixed: 0
},
$isTrailer:{
grid: { span: 24 },
$isTrailer: {
grid: { span: 24 }
},
$carProtocalWatermark: {
grid: { span:12 },
grid: { span: 12 }
},
$agreeImg: {
grid: { span: 4 },
class: 'setCustom'
},
$titleB:{
grid: { span: 24 },
$titleB: {
grid: { span: 24 }
},
$roadTransportPhotoWatermark: {
grid: { span: 12 },
grid: { span: 12 }
},
$roadImg: {
grid: { span: 4 },
class: 'setCustom'
},
}
};
}
// 道路运输证识别
checkTransCard(imgurl: any) {
const params = {
transportationLicenseUrl: imgurl,
transportationLicenseUrl: imgurl
};
this.service.request(this.service.$api_recognizeTransportationLicense, params).subscribe((res: any) => {
if (res) {
this.sf.setValue('/roadTransportNo', res.number);
this.sf.setValue('/roadTransportLicenceNo', res.businessCertificate);
this.sf.setValue('/roadTransportStartTime', res.issueDate);
if(this.carNo === '') {
this.carNo = res.number
} else if(this.carNo && res.vehicleNumber.indexOf(this.carNo) === -1) {
this.service.msgSrv.warning('请上传同一认证车辆的相关证件')
if (this.carNo === '') {
this.carNo = res.number;
} else if (this.carNo && res.vehicleNumber.indexOf(this.carNo) === -1) {
this.service.msgSrv.warning('请上传同一认证车辆的相关证件');
}
}
});
@ -693,11 +695,12 @@ export class CarSettleCarauthComponent implements OnInit {
checkCarCard(imgurl: any, side: any) {
const params = {
vehicleLicenseUrl: imgurl,
side,
side
};
this.service.request(this.service.$api_recognizeVehicleLicense, params).subscribe((res: any) => {
if (res) {
if (side === 'front') { // 正面
if (side === 'front') {
// 正面
this.sf.setValue('/driverLicenseRegisterTime', res.registerDate);
this.sf.setValue('/carNo', res.number);
this.sf.setValue('/driverLicenseGetTime', res.issueDate);
@ -707,15 +710,14 @@ export class CarSettleCarauthComponent implements OnInit {
this.sf.setValue('/useNature', res.useCharacter);
this.sf.setValue('/carModel', res?.vehicleType);
this.sf.setValue('/carTotalLoad', res?.grossMass.slice(0, -2) % 1000);
} else {
this.sf.setValue('/curbWeight', res.unladenMass.slice(0, -2) % 1000);
this.sf.setValue('/carLoad', res.approvedLoad.slice(0, -2) % 1000);
}
if(this.carNo === '') {
this.carNo = res.number
} else if(this.carNo && this.carNo !== res.number) {
this.service.msgSrv.warning('请上传同一认证车辆的相关证件')
if (this.carNo === '') {
this.carNo = res.number;
} else if (this.carNo && this.carNo !== res.number) {
this.service.msgSrv.warning('请上传同一认证车辆的相关证件');
}
}
});
@ -725,10 +727,10 @@ export class CarSettleCarauthComponent implements OnInit {
this.modal.close(true);
}
showExample() {
this.showCardFlag = !this.showCardFlag
this.showCardFlag = !this.showCardFlag;
}
showJopExample() {
this.showJopFlag = !this.showJopFlag
this.showJopFlag = !this.showJopFlag;
}
submitForm() {
const params: any = {
@ -736,20 +738,23 @@ export class CarSettleCarauthComponent implements OnInit {
...this.sf.value,
bindType: this.i.bindType
};
params.carFrontPhoto = this.detailData.carFrontPhoto
params.carProtocal = this.detailData.carProtocal
params.certificatePhotoFront = this.detailData.certificatePhotoFront
params.certificatePhotoBack = this.detailData.certificatePhotoBack
params.roadTransportPhoto = this.detailData.roadTransportPhoto
delete params.titleA
delete params.titleB
params.carFrontPhoto = this.detailData.carFrontPhoto;
params.carProtocal = this.detailData.carProtocal;
params.certificatePhotoFront = this.detailData.certificatePhotoFront;
params.certificatePhotoBack = this.detailData.certificatePhotoBack;
params.roadTransportPhoto = this.detailData.roadTransportPhoto;
delete params.titleA;
delete params.titleB;
console.log(params);
this.service.request(this.service.$api_saveUpdateShipperCar, params).subscribe((res: any) => {
if (res) {
this.service.msgSrv.success('添加成功')
this.modal.close(true)
this.service.msgSrv.success('添加成功');
this.modal.close(true);
}
})
});
}
view() {
window.open('http://www.mca.gov.cn/article/sj/xzqh/1980/')
}
}