This commit is contained in:
2026-08-27 12:54:17 +08:00
parent 2c08d0c362
commit 3a262216c7
14 changed files with 181 additions and 143 deletions
+20 -1
View File
@@ -59,6 +59,13 @@
{{ row.vehicleNo }}
</el-button>
</template>
<template #vehicleTypeForm>
<span v-if="boxType === 'view'">{{ form.vehicleType || '' }}</span>
<el-radio-group v-else v-model="form.vehicleType" @change="handleVehicleTypeChange">
<el-radio value="车辆">车辆</el-radio>
<el-radio value="船舶">船舶</el-radio>
</el-radio-group>
</template>
<template #vehicleNoForm>
<el-autocomplete
v-model="form.vehicleNo"
@@ -102,7 +109,11 @@
</el-input>
</template>
<template #nextMaintenanceMileageForm>
<span
v-if="boxType === 'view' && isUnsetNextMaintenanceMileage(form.nextMaintenanceMileage)"
></span>
<el-input
v-else
v-model="form.nextMaintenanceMileage"
:disabled="boxType === 'view'"
inputmode="decimal"
@@ -116,7 +127,7 @@
<span>{{ formatMileage(row.mileage, row.mileageUnit) }}</span>
</template>
<template #nextMaintenanceMileage="{ row }">
<span>{{ formatMileage(row.nextMaintenanceMileage, row.mileageUnit) }}</span>
<span>{{ formatNextMaintenanceMileage(row.nextMaintenanceMileage, row.mileageUnit) }}</span>
</template>
<template #attachments="{ row }">
<span>{{ formatAttachments(row.attachments) }}</span>
@@ -227,6 +238,7 @@ export default {
{ label: '车辆', value: '车辆' },
{ label: '船舶', value: '船舶' },
],
formslot: true,
value: '车辆',
search: true,
span: 24,
@@ -546,6 +558,13 @@ export default {
if (value === undefined || value === null || value === '') return '';
return `${Math.max(Number(value), 0)} ${unit || '公里'}`;
},
isUnsetNextMaintenanceMileage(value) {
return Number(value) === -1;
},
formatNextMaintenanceMileage(value, unit) {
if (this.isUnsetNextMaintenanceMileage(value)) return '';
return this.formatMileage(value, unit);
},
formatAttachments(value) {
if (!value) return '';
if (Array.isArray(value)) return `${value.length}`;