@@ -809,7 +559,6 @@ import {
submit,
remove,
changeStatus,
- auditCertification,
getExpiryStat,
recognitionTransportCertificates,
recognizeBaiduOcr,
@@ -818,6 +567,7 @@ import { getDeptTree } from '@/api/system/dept';
import organizationSearch from '@/mixins/organization-search';
import { exportBlob } from '@/api/common';
import { getToken, isAdministrator } from '@/utils/auth';
+import { certStatusTag } from '@/utils/cert-audit';
import { getUploadHeaders } from '@/utils/upload';
import { downloadXls } from '@/utils/util';
import ImageUploadField from '@/components/image-upload-field/main.vue';
@@ -828,8 +578,10 @@ const emptyForm = () => ({
organizationName: '',
useDepartment: '',
plateNo: '',
+ ownerName: '',
plateColor: '',
vehicleType: '',
+ vin: '',
outerLength: undefined,
outerWidth: undefined,
outerHeight: undefined,
@@ -895,10 +647,6 @@ export default {
vehicleBox: false,
vehicleLedgerBox: false,
ledgerVehicle: {},
- certificationAuditBox: false,
- certificationAuditForm: {},
- certificationRejectReason: '',
- showRejectReason: false,
readonly: false,
vehicleForm: emptyForm(),
vehicleCertificateUploads: {},
@@ -922,6 +670,8 @@ export default {
{ validator: this.validatePlateNo, trigger: 'change' },
],
vehicleType: [{ required: true, message: '请选择车辆类型', trigger: 'change' }],
+ ownerName: [{ required: true, message: '请输入所有人', trigger: 'blur' }],
+ vin: [{ validator: this.validateVin, trigger: 'blur' }],
approvedLoadKg: [{ required: true, message: '请输入核定载质量', trigger: 'blur' }],
businessRelation: [{ required: true, message: '请选择业务关系', trigger: 'change' }],
energyType: [{ required: true, message: '请选择能源类型', trigger: 'change' }],
@@ -1055,6 +805,24 @@ export default {
}
callback();
},
+ // 车辆识别代号(车架号)为选填:留空放行,填了就必须是 17 位
+ validateVin(rule, value, callback) {
+ const vin = String(value || '')
+ .trim()
+ .toUpperCase();
+ if (!vin) {
+ callback();
+ return;
+ }
+ if (!/^[A-HJ-NPR-Z0-9]{17}$/.test(vin)) {
+ callback(new Error('车架号必须是17位字母数字(不含 I、O、Q)'));
+ return;
+ }
+ if (this.vehicleForm.vin !== vin) {
+ this.vehicleForm.vin = vin;
+ }
+ callback();
+ },
validateAnnualReviewEndDate(rule, value, callback) {
if (this.vehicleForm.annualReviewLongTerm !== 1 && !value) {
callback(new Error('请选择道路运输年审有效期'));
@@ -1107,49 +875,6 @@ export default {
this.ledgerVehicle = { ...row };
this.vehicleLedgerBox = true;
},
- openCertificationAudit(row) {
- getDetail(row.id).then(res => {
- this.certificationAuditForm = { ...(res.data.data || {}) };
- this.certificationRejectReason = '';
- this.showRejectReason = false;
- this.certificationAuditBox = true;
- });
- },
- auditValue(prop) {
- // 长期有效字段:勾选后显示「长期有效」,避免与未填写的「-」混淆
- const longTermMap = {
- drivingLicenseEndDate: 'drivingLicenseLongTerm',
- roadTransportCertEndDate: 'roadTransportCertLongTerm',
- annualReviewEndDate: 'annualReviewLongTerm',
- compulsoryScrapDate: 'compulsoryScrapLongTerm',
- };
- const longTermProp = longTermMap[prop];
- if (longTermProp && this.certificationAuditForm[longTermProp] === 1) {
- return '长期有效';
- }
- const value = this.certificationAuditForm[prop];
- return value === undefined || value === null || value === '' ? '-' : value;
- },
- auditValueWithUnit(prop, unit) {
- const value = this.auditValue(prop);
- return value === '-' ? value : `${value}${unit}`;
- },
- handleCertificationApprove() {
- auditCertification(this.certificationAuditForm.id, 1).then(() => {
- this.$message.success('认证已通过');
- this.certificationAuditBox = false;
- this.onLoad(this.page);
- });
- },
- handleCertificationReject() {
- if (!this.showRejectReason) { this.showRejectReason = true; return; }
- if (!this.certificationRejectReason.trim()) { this.$message.warning('请输入认证驳回原因'); return; }
- auditCertification(this.certificationAuditForm.id, 2, this.certificationRejectReason).then(() => {
- this.$message.success('认证已驳回');
- this.certificationAuditBox = false;
- this.onLoad(this.page);
- });
- },
resetVehicle() {
this.vehicleForm = emptyForm();
this.vehicleCertificateUploads = {};
@@ -1648,26 +1373,11 @@ export default {
}
return '';
},
+ // 认证状态展示的是「最新一次提交的状态」缓存,不代表该车当前是否已认证
+ // (是否已认证由生效快照指针决定,即曾审核通过即永久保持)。
+ // 证书是否临近到期另有列表顶部的到期标签与日期列标色展示,不在这里推断。
getCertificationStatus(row) {
- if (row.certificationStatus === 0) return { label: '认证中', type: 'warning' };
- if (row.certificationStatus === 1) return { label: '已认证', type: 'success' };
- if (row.certificationStatus === 2) return { label: '已驳回', type: 'danger' };
- const today = this.$dayjs().startOf('day');
- const certificateDates = [
- [row.drivingLicenseEndDate, row.drivingLicenseLongTerm],
- [row.roadTransportCertEndDate, row.roadTransportCertLongTerm],
- ];
- if (certificateDates.some(([date, longTerm]) => longTerm !== 1 && !date)) {
- return { label: '未认证', type: 'info' };
- }
- if (
- certificateDates.some(
- ([date, longTerm]) => longTerm !== 1 && this.$dayjs(date).isBefore(today, 'day')
- )
- ) {
- return { label: '已过期', type: 'danger' };
- }
- return { label: '已认证', type: 'success' };
+ return certStatusTag(row.certificationStatus);
},
},
};
@@ -1695,9 +1405,7 @@ export default {
}
}
-// 车辆认证审核弹窗:与编辑弹窗一致,灰底 + section-card 白卡分组
-.certification-audit,
-.certification-audit__reason,
+// 编辑弹窗:灰底 + section-card 白卡分组
.vehicle-form {
:deep(.el-form-item__label) {
height: auto;
@@ -1723,60 +1431,10 @@ export default {
line-height: 18px;
margin-right: 4px;
}
-}
-.certification-audit {
- :deep(.el-form-item__label) {
- flex: 0 0 calc(4em + 12px) !important;
- width: calc(4em + 12px) !important;
- max-width: calc(4em + 12px);
- }
-}
-
-.certification-audit__reason {
:deep(.el-form-item__label) {
flex: 0 0 calc(4em + 24px) !important;
width: calc(4em + 24px) !important;
- max-width: calc(4em + 24px);
- }
-}
-
-.vehicle-form {
- :deep(.el-form-item__label) {
- flex: 0 0 calc(4em + 24px) !important;
- width: calc(4em + 24px) !important;
- }
-}
-
-.certification-audit {
- &__value {
- display: block;
- color: #303133;
- word-break: break-all;
- }
-
- // 外廓尺寸长/宽/高组合,排版复用编辑弹窗的 dimension-group
- .dimension-group {
- display: grid;
- grid-template-columns: repeat(3, minmax(0, 1fr));
- gap: 8px;
- align-items: center;
- }
-
- .dimension-group__item {
- display: flex;
- align-items: center;
- gap: 8px;
- min-width: 0;
- }
-
- .dimension-group__label {
- flex-shrink: 0;
- color: #303133;
- }
-
- &__reason {
- margin-top: 12px;
}
}