✨ 合同结算币种联动计费与运单计价单位,并完善合同与派车交互
结算币种驱动计费单价单位及运单/计划/总单计价单位;同步合同编号预览、部门前缀配置、派车备注与查看弹窗等交互优化。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -428,4 +428,43 @@ export default {
|
||||
.vehicle-dispatch-page :deep(.vehicle-dispatch-form-control) {
|
||||
width: 100%;
|
||||
}
|
||||
/* 查看弹窗保持与新增/编辑相同的表单样式,仅禁用控件 */
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-form-item) {
|
||||
background-color: transparent;
|
||||
}
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-input.is-disabled .el-input__wrapper) {
|
||||
box-shadow: 0 0 0 1px var(--el-disabled-border-color) inset;
|
||||
background-color: var(--el-disabled-bg-color);
|
||||
}
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-input.is-disabled .el-input__inner),
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-textarea.is-disabled .el-textarea__inner),
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-range-editor.is-disabled),
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-range-editor.is-disabled input) {
|
||||
color: var(--el-disabled-text-color);
|
||||
background-color: var(--el-disabled-bg-color);
|
||||
padding-left: 11px;
|
||||
box-shadow: 0 0 0 1px var(--el-disabled-border-color) inset;
|
||||
-webkit-text-fill-color: var(--el-disabled-text-color);
|
||||
}
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-select__wrapper.is-disabled) {
|
||||
background-color: var(--el-disabled-bg-color);
|
||||
box-shadow: 0 0 0 1px var(--el-disabled-border-color) inset !important;
|
||||
}
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-select__suffix),
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-input__suffix),
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-input__prefix) {
|
||||
display: inline-flex;
|
||||
}
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-input__inner),
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-textarea__inner) {
|
||||
border: none;
|
||||
}
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-cascader) {
|
||||
width: 100%;
|
||||
}
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-cascader .el-input.is-disabled .el-input__wrapper),
|
||||
.vehicle-dispatch-page :deep(.avue--detail .el-autocomplete .el-input.is-disabled .el-input__wrapper) {
|
||||
box-shadow: 0 0 0 1px var(--el-disabled-border-color) inset;
|
||||
background-color: var(--el-disabled-bg-color);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -985,7 +985,7 @@ export default {
|
||||
}
|
||||
this.applyDrivingLicenseValidity(inspectionValidity);
|
||||
if (registrationDate) {
|
||||
this.vehicleForm.registrationDate = this.normalizeDate(registrationDate);
|
||||
this.vehicleForm.registrationDate = this.normalizeDate(registrationDate, 'first');
|
||||
}
|
||||
if (registrationNo) {
|
||||
this.vehicleForm.registrationNo = String(registrationNo).replace(/\s/g, '');
|
||||
@@ -1000,6 +1000,7 @@ export default {
|
||||
'vehicleType',
|
||||
'drivingLicenseNo',
|
||||
'drivingLicenseEndDate',
|
||||
'registrationDate',
|
||||
'registrationNo',
|
||||
'approvedLoadKg',
|
||||
'outerLength',
|
||||
@@ -1057,9 +1058,9 @@ export default {
|
||||
this.vehicleForm.roadTransportCertEndDate = '';
|
||||
return;
|
||||
}
|
||||
const dateList = value.match(/\d{4}[-/.年]\d{1,2}[-/.月]\d{1,2}日?/g) || [];
|
||||
if (dateList.length) {
|
||||
this.vehicleForm.roadTransportCertEndDate = this.normalizeDate(dateList[dateList.length - 1]);
|
||||
const endDate = this.normalizeDate(value, 'last');
|
||||
if (endDate) {
|
||||
this.vehicleForm.roadTransportCertEndDate = endDate;
|
||||
this.vehicleForm.roadTransportCertLongTerm = 0;
|
||||
}
|
||||
},
|
||||
@@ -1071,9 +1072,9 @@ export default {
|
||||
this.vehicleForm.drivingLicenseEndDate = '';
|
||||
return;
|
||||
}
|
||||
const dateList = value.match(/\d{4}[-/.年]\d{1,2}[-/.月]\d{1,2}日?/g) || [];
|
||||
if (dateList.length) {
|
||||
this.vehicleForm.drivingLicenseEndDate = this.normalizeDate(dateList[dateList.length - 1]);
|
||||
const endDate = this.normalizeDate(value, 'last');
|
||||
if (endDate) {
|
||||
this.vehicleForm.drivingLicenseEndDate = endDate;
|
||||
this.vehicleForm.drivingLicenseLongTerm = 0;
|
||||
}
|
||||
},
|
||||
@@ -1150,11 +1151,11 @@ export default {
|
||||
this.vehicleForm.drivingLicenseNo = drivingLicenseNo;
|
||||
}
|
||||
if (drivingLicenseEndDate) {
|
||||
this.vehicleForm.drivingLicenseEndDate = this.normalizeDate(drivingLicenseEndDate);
|
||||
this.vehicleForm.drivingLicenseEndDate = this.normalizeDate(drivingLicenseEndDate, 'last');
|
||||
this.vehicleForm.drivingLicenseLongTerm = 0;
|
||||
}
|
||||
if (registrationDate) {
|
||||
this.vehicleForm.registrationDate = this.normalizeDate(registrationDate);
|
||||
this.vehicleForm.registrationDate = this.normalizeDate(registrationDate, 'first');
|
||||
}
|
||||
if (registrationNo) {
|
||||
this.vehicleForm.registrationNo = registrationNo;
|
||||
@@ -1165,18 +1166,60 @@ export default {
|
||||
'vehicleType',
|
||||
'drivingLicenseNo',
|
||||
'drivingLicenseEndDate',
|
||||
'registrationDate',
|
||||
'registrationNo',
|
||||
].forEach(prop => {
|
||||
this.$refs.vehicleForm?.validateField(prop);
|
||||
});
|
||||
});
|
||||
},
|
||||
normalizeDate(value = '') {
|
||||
/**
|
||||
* OCR 日期常为区间(如 2022-08-17至2024-01-05)或含无效日(如 01-65)。
|
||||
* 提取可解析的合法日期;prefer=first 取登记类起始日,prefer=last 取有效期截止日。
|
||||
*/
|
||||
normalizeDate(value = '', prefer = 'first') {
|
||||
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')}`;
|
||||
if (!dateValue) return '';
|
||||
const segments = dateValue.match(/\d{4}[-/.年]\d{1,2}[-/.月]\d{1,2}日?/g) || [];
|
||||
const sourceList = segments.length ? segments : [dateValue];
|
||||
const candidates = sourceList
|
||||
.map(item => {
|
||||
const match = String(item)
|
||||
.trim()
|
||||
.match(/^(\d{4})[-/.年](\d{1,2})[-/.月](\d{1,2})日?$/);
|
||||
if (!match) return '';
|
||||
const year = Number(match[1]);
|
||||
const month = Number(match[2]);
|
||||
const day = Number(match[3]);
|
||||
const date = new Date(year, month - 1, day);
|
||||
if (
|
||||
date.getFullYear() !== year ||
|
||||
date.getMonth() !== month - 1 ||
|
||||
date.getDate() !== day
|
||||
) {
|
||||
return '';
|
||||
}
|
||||
return `${String(year).padStart(4, '0')}-${String(month).padStart(2, '0')}-${String(day).padStart(2, '0')}`;
|
||||
})
|
||||
.filter(Boolean);
|
||||
if (!candidates.length) return '';
|
||||
return prefer === 'last' ? candidates[candidates.length - 1] : candidates[0];
|
||||
},
|
||||
normalizeVehicleDateFields(form = {}) {
|
||||
const dateFields = [
|
||||
['compulsoryScrapDate', 'first'],
|
||||
['drivingLicenseStartDate', 'first'],
|
||||
['drivingLicenseEndDate', 'last'],
|
||||
['roadTransportCertStartDate', 'first'],
|
||||
['roadTransportCertEndDate', 'last'],
|
||||
['annualReviewEndDate', 'last'],
|
||||
['registrationDate', 'first'],
|
||||
];
|
||||
dateFields.forEach(([prop, prefer]) => {
|
||||
if (form[prop] === undefined || form[prop] === null || form[prop] === '') return;
|
||||
form[prop] = this.normalizeDate(form[prop], prefer);
|
||||
});
|
||||
return form;
|
||||
},
|
||||
normalizeVehicleType(value = '') {
|
||||
const vehicleType = String(value || '').trim();
|
||||
@@ -1207,12 +1250,14 @@ export default {
|
||||
},
|
||||
handleSubmit() {
|
||||
this.syncPlateNo();
|
||||
this.normalizeVehicleDateFields(this.vehicleForm);
|
||||
this.$refs.vehicleForm.validate(valid => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
this.submitLoading = true;
|
||||
submit(this.vehicleForm)
|
||||
const payload = this.normalizeVehicleDateFields({ ...this.vehicleForm });
|
||||
submit(payload)
|
||||
.then(() => {
|
||||
this.$message.success('操作成功');
|
||||
this.vehicleBox = false;
|
||||
|
||||
Reference in New Issue
Block a user