1、完善项目
2、完善合同 3、完善费用项 4、司机管理对接OCR 5、完善运输计划 6、完善临时额度
This commit is contained in:
@@ -406,7 +406,10 @@
|
||||
:headers="uploadHeaders"
|
||||
large
|
||||
class-prefix="vehicle"
|
||||
@success="url => setImage('drivingLicenseImage', url)"
|
||||
@success="
|
||||
(url, file) =>
|
||||
handleVehicleCertificateUploadSuccess('drivingLicenseImage', url, file)
|
||||
"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -418,7 +421,10 @@
|
||||
:headers="uploadHeaders"
|
||||
large
|
||||
class-prefix="vehicle"
|
||||
@success="url => setImage('drivingLicenseMainBack', url)"
|
||||
@success="
|
||||
(url, file) =>
|
||||
handleVehicleCertificateUploadSuccess('drivingLicenseMainBack', url, file)
|
||||
"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -430,7 +436,10 @@
|
||||
:headers="uploadHeaders"
|
||||
large
|
||||
class-prefix="vehicle"
|
||||
@success="url => setImage('drivingLicenseViceFront', url)"
|
||||
@success="
|
||||
(url, file) =>
|
||||
handleVehicleCertificateUploadSuccess('drivingLicenseViceFront', url, file)
|
||||
"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -444,7 +453,10 @@
|
||||
:headers="uploadHeaders"
|
||||
large
|
||||
class-prefix="vehicle"
|
||||
@success="url => setImage('drivingLicenseViceBack', url)"
|
||||
@success="
|
||||
(url, file) =>
|
||||
handleVehicleCertificateUploadSuccess('drivingLicenseViceBack', url, file)
|
||||
"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
@@ -468,7 +480,10 @@
|
||||
:headers="uploadHeaders"
|
||||
large
|
||||
class-prefix="vehicle"
|
||||
@success="url => setImage('registrationImage', url)"
|
||||
@success="
|
||||
(url, file) =>
|
||||
handleVehicleCertificateUploadSuccess('registrationImage', url, file)
|
||||
"
|
||||
/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -486,6 +501,7 @@
|
||||
<script>
|
||||
import { mapGetters } from 'vuex';
|
||||
import NProgress from 'nprogress';
|
||||
import { ElLoading } from 'element-plus';
|
||||
import { option } from '@/option/transportCapacity/transport-vehicle';
|
||||
import {
|
||||
getList,
|
||||
@@ -494,10 +510,12 @@ import {
|
||||
remove,
|
||||
changeStatus,
|
||||
getExpiryStat,
|
||||
recognitionTransportCertificates,
|
||||
} from '@/api/transportCapacity/transport-vehicle';
|
||||
import { getDeptTree } from '@/api/system/dept';
|
||||
import { exportBlob } from '@/api/common';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { getUploadHeaders } from '@/utils/upload';
|
||||
import { downloadXls } from '@/utils/util';
|
||||
import ImageUploadField from '@/components/image-upload-field/main.vue';
|
||||
|
||||
@@ -608,10 +626,8 @@ export default {
|
||||
vehicleBox: false,
|
||||
readonly: false,
|
||||
vehicleForm: emptyForm(),
|
||||
uploadHeaders: {
|
||||
'Blade-Auth': `bearer ${getToken()}`,
|
||||
'Blade-Requested-With': 'BladeHttpRequest',
|
||||
},
|
||||
vehicleCertificateUploads: {},
|
||||
uploadHeaders: getUploadHeaders(),
|
||||
organizationOptions: [],
|
||||
plateProvinceOptions,
|
||||
plateColorOptions,
|
||||
@@ -733,6 +749,7 @@ export default {
|
||||
},
|
||||
resetVehicle() {
|
||||
this.vehicleForm = emptyForm();
|
||||
this.vehicleCertificateUploads = {};
|
||||
this.readonly = false;
|
||||
this.submitLoading = false;
|
||||
this.$refs.vehicleForm?.clearValidate();
|
||||
@@ -741,6 +758,116 @@ export default {
|
||||
this.vehicleForm[prop] = url;
|
||||
this.$refs.vehicleForm?.validateField(prop);
|
||||
},
|
||||
handleVehicleCertificateUploadSuccess(prop, url, file = {}) {
|
||||
this.setImage(prop, url);
|
||||
this.vehicleCertificateUploads[prop] = this.getUploadRecognitionKey(file, url);
|
||||
this.recognizeVehicleCertificates();
|
||||
},
|
||||
recognizeVehicleCertificates() {
|
||||
const objectKeys = [
|
||||
this.vehicleCertificateUploads.drivingLicenseImage || this.vehicleForm.drivingLicenseImage,
|
||||
this.vehicleCertificateUploads.drivingLicenseMainBack ||
|
||||
this.vehicleForm.drivingLicenseMainBack,
|
||||
this.vehicleCertificateUploads.drivingLicenseViceFront ||
|
||||
this.vehicleForm.drivingLicenseViceFront,
|
||||
this.vehicleCertificateUploads.drivingLicenseViceBack ||
|
||||
this.vehicleForm.drivingLicenseViceBack,
|
||||
this.vehicleCertificateUploads.registrationImage || this.vehicleForm.registrationImage,
|
||||
].filter(Boolean);
|
||||
if (!objectKeys.length) {
|
||||
this.$message.warning('车辆资质图片上传成功,未获取到图片地址,无法自动识别');
|
||||
return;
|
||||
}
|
||||
const loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '车辆资质识别中',
|
||||
background: 'rgba(255, 255, 255, 0.7)',
|
||||
});
|
||||
recognitionTransportCertificates(objectKeys)
|
||||
.then(res => {
|
||||
this.applyVehicleCertificateRecognition(res.data.data || {});
|
||||
this.$message.success('车辆资质识别完成');
|
||||
})
|
||||
.catch(() => {
|
||||
this.$message.warning('车辆资质图片上传成功,自动识别失败,请手动填写车辆资质信息');
|
||||
})
|
||||
.finally(() => {
|
||||
loading.close();
|
||||
});
|
||||
},
|
||||
applyVehicleCertificateRecognition(data = {}) {
|
||||
const plateNo = data.drivingPlateNo || data.vehicleLicensePlateNo || '';
|
||||
const vehicleType = data.vehicleLicenseVehicleType || data.vehicleType || '';
|
||||
const drivingLicenseNo =
|
||||
data.vehicleLicenseFileNo || data.drivingLicenseNo || data.fileNo || '';
|
||||
const drivingLicenseEndDate =
|
||||
data.vehicleLicenseInspectionValidDate ||
|
||||
data.drivingLicenseEndDate ||
|
||||
data.vehicleLicenseValidDateEnd ||
|
||||
'';
|
||||
const registrationDate =
|
||||
data.vehicleLicenseRegisterDate || data.registrationDate || data.dateRegister || '';
|
||||
const registrationNo = data.registrationNo || data.vehicleLicenseNo || '';
|
||||
if (plateNo) {
|
||||
this.vehicleForm.plateNo = plateNo;
|
||||
this.splitPlateNo();
|
||||
this.syncPlateNo(false);
|
||||
}
|
||||
if (vehicleType) {
|
||||
this.vehicleForm.vehicleType = this.normalizeVehicleType(vehicleType);
|
||||
}
|
||||
if (drivingLicenseNo) {
|
||||
this.vehicleForm.drivingLicenseNo = drivingLicenseNo;
|
||||
}
|
||||
if (drivingLicenseEndDate) {
|
||||
this.vehicleForm.drivingLicenseEndDate = this.normalizeDate(drivingLicenseEndDate);
|
||||
this.vehicleForm.drivingLicenseLongTerm = 0;
|
||||
}
|
||||
if (registrationDate) {
|
||||
this.vehicleForm.registrationDate = this.normalizeDate(registrationDate);
|
||||
}
|
||||
if (registrationNo) {
|
||||
this.vehicleForm.registrationNo = registrationNo;
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
[
|
||||
'plateNo',
|
||||
'vehicleType',
|
||||
'drivingLicenseNo',
|
||||
'drivingLicenseEndDate',
|
||||
'registrationNo',
|
||||
].forEach(prop => {
|
||||
this.$refs.vehicleForm?.validateField(prop);
|
||||
});
|
||||
});
|
||||
},
|
||||
getUploadRecognitionKey(file = {}, url = '') {
|
||||
return (
|
||||
file.objectKey ||
|
||||
file.key ||
|
||||
file.fileName ||
|
||||
file.name ||
|
||||
file.link ||
|
||||
file.url ||
|
||||
file.domain ||
|
||||
url ||
|
||||
''
|
||||
);
|
||||
},
|
||||
normalizeDate(value = '') {
|
||||
const dateValue = String(value || '').trim();
|
||||
const match = dateValue.match(/^(\d{4})[-/.年](\d{1,2})[-/.月](\d{1,2})日?$/);
|
||||
if (!match) return dateValue;
|
||||
const [, year, month, day] = match;
|
||||
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`;
|
||||
},
|
||||
normalizeVehicleType(value = '') {
|
||||
const vehicleType = String(value || '').trim();
|
||||
const option = this.vehicleTypeOptions.find(
|
||||
item => item.value === vehicleType || item.label === vehicleType
|
||||
);
|
||||
return option ? option.value : vehicleType;
|
||||
},
|
||||
handlePlateBodyInput(value) {
|
||||
this.vehicleForm.plateNoBody = String(value || '').toUpperCase();
|
||||
this.syncPlateNo();
|
||||
|
||||
Reference in New Issue
Block a user