fix bug
This commit is contained in:
@@ -106,22 +106,10 @@
|
||||
<span>{{ formatAttachments(row.attachments) }}</span>
|
||||
</template>
|
||||
<template #attachmentsForm>
|
||||
<vehicle-attachment-upload
|
||||
v-model="form.attachments"
|
||||
:readonly="boxType === 'view'"
|
||||
button-text="新增"
|
||||
button-icon="el-icon-plus"
|
||||
:show-tip="false"
|
||||
/>
|
||||
<vehicle-attachment-table v-model="form.attachments" :readonly="boxType === 'view'" />
|
||||
</template>
|
||||
<template #attachments-form>
|
||||
<vehicle-attachment-upload
|
||||
v-model="form.attachments"
|
||||
:readonly="boxType === 'view'"
|
||||
button-text="新增"
|
||||
button-icon="el-icon-plus"
|
||||
:show-tip="false"
|
||||
/>
|
||||
<vehicle-attachment-table v-model="form.attachments" :readonly="boxType === 'view'" />
|
||||
</template>
|
||||
</avue-crud>
|
||||
<el-dialog title="维修记录数据导入" append-to-body v-model="excelBox" width="555px">
|
||||
@@ -153,6 +141,7 @@ import { formatUpdateUserName } from '@/utils/audit';
|
||||
import { getToken } from '@/utils/auth';
|
||||
import { normalizeSearchRangeParams } from '@/utils/search-range';
|
||||
import AddressMapPicker from '@/components/address-map-picker/main.vue';
|
||||
import VehicleAttachmentTable from '@/components/vehicle-attachment-table/main.vue';
|
||||
import { mapGetters } from 'vuex';
|
||||
import NProgress from 'nprogress';
|
||||
import 'nprogress/nprogress.css';
|
||||
@@ -164,6 +153,7 @@ const createTimeRangeMap = {
|
||||
export default {
|
||||
components: {
|
||||
AddressMapPicker,
|
||||
VehicleAttachmentTable,
|
||||
},
|
||||
data() {
|
||||
const validateNonNegative = (rule, value, callback) => {
|
||||
@@ -362,6 +352,7 @@ export default {
|
||||
{
|
||||
label: '附件',
|
||||
prop: 'attachments',
|
||||
hide: true,
|
||||
span: 24,
|
||||
minWidth: 100,
|
||||
slot: true,
|
||||
@@ -542,9 +533,14 @@ export default {
|
||||
.catch(() => callback([]));
|
||||
},
|
||||
formatMileage(value, unit) {
|
||||
if (value === undefined || value === null || value === '') return '';
|
||||
if (this.normalizeMileageValue(value) === null) return '';
|
||||
return `${Math.max(Number(value), 0)} ${unit || '公里'}`;
|
||||
},
|
||||
normalizeMileageValue(value) {
|
||||
if (value === undefined || value === null || value === '' || Number(value) === -1)
|
||||
return null;
|
||||
return value;
|
||||
},
|
||||
formatAttachments(value) {
|
||||
if (!value) return '';
|
||||
if (Array.isArray(value)) return `${value.length} 个`;
|
||||
@@ -595,6 +591,7 @@ export default {
|
||||
const values = { ...row };
|
||||
values.vehicleType = values.vehicleType || '车辆';
|
||||
values.mileageUnit = values.vehicleType === '船舶' ? '海里' : '公里';
|
||||
values.mileage = this.normalizeMileageValue(values.mileage);
|
||||
if (values.vehicleNo) {
|
||||
values.vehicleNo =
|
||||
values.vehicleType === '船舶'
|
||||
@@ -676,6 +673,7 @@ export default {
|
||||
detail.attachments = this.parseAttachments(detail.attachments);
|
||||
detail.vehicleType = detail.vehicleType || '车辆';
|
||||
detail.mileageUnit = detail.vehicleType === '船舶' ? '海里' : '公里';
|
||||
detail.mileage = this.normalizeMileageValue(detail.mileage);
|
||||
this.form = detail;
|
||||
this.updateVehicleType(detail.vehicleType);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user