⚡ 配载货物信息分列数量单位,并修复车辆尺寸 -1 展示
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -27,10 +27,10 @@
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="外廓尺寸(mm)">{{ dimensions }}</el-descriptions-item>
|
||||
<el-descriptions-item label="核定载质量(KG)">{{
|
||||
vehicleDetail.approvedLoadKg ?? '-'
|
||||
optionalNumberText(vehicleDetail.approvedLoadKg)
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="准牵引总质量(KG)">{{
|
||||
vehicleDetail.tractionMassKg ?? '-'
|
||||
optionalNumberText(vehicleDetail.tractionMassKg)
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="行驶证档案编号">{{
|
||||
vehicleDetail.drivingLicenseNo || '-'
|
||||
@@ -302,10 +302,29 @@ export default {
|
||||
const v = this.vehicleDetail;
|
||||
return (
|
||||
[v.outerLength, v.outerWidth, v.outerHeight]
|
||||
.filter(item => item !== null && item !== undefined && item !== '')
|
||||
.filter(
|
||||
item =>
|
||||
item !== null &&
|
||||
item !== undefined &&
|
||||
item !== '' &&
|
||||
Number(item) !== -1 &&
|
||||
String(item) !== '-1'
|
||||
)
|
||||
.join('×') || '-'
|
||||
);
|
||||
},
|
||||
optionalNumberText(value) {
|
||||
if (
|
||||
value === null ||
|
||||
value === undefined ||
|
||||
value === '' ||
|
||||
Number(value) === -1 ||
|
||||
String(value) === '-1'
|
||||
) {
|
||||
return '-';
|
||||
}
|
||||
return value;
|
||||
},
|
||||
plateColorType() {
|
||||
return (
|
||||
{ 黄牌: 'warning', 蓝牌: 'primary', 绿牌: 'success' }[this.vehicleDetail.plateColor] ||
|
||||
|
||||
@@ -863,6 +863,7 @@ export default {
|
||||
...emptyForm(),
|
||||
...(res.data.data || {}),
|
||||
};
|
||||
this.normalizeOptionalNumberFields(this.vehicleForm);
|
||||
if (!this.vehicleForm.useDepartment) {
|
||||
this.vehicleForm.useDepartment = this.getCurrentOrganizationName();
|
||||
}
|
||||
@@ -1284,6 +1285,7 @@ export default {
|
||||
}
|
||||
this.submitLoading = true;
|
||||
const payload = this.normalizeVehicleDateFields({ ...this.vehicleForm });
|
||||
this.normalizeOptionalNumberFields(payload, null);
|
||||
submit(payload)
|
||||
.then(() => {
|
||||
this.$message.success('操作成功');
|
||||
@@ -1295,6 +1297,24 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 可选数字字段:空串 / -1(BladeX null 占位)归一为 emptyValue,避免查看时显示 -1
|
||||
*/
|
||||
normalizeOptionalNumberFields(form = {}, emptyValue = undefined) {
|
||||
['outerLength', 'outerWidth', 'outerHeight', 'tractionMassKg'].forEach(key => {
|
||||
const value = form[key];
|
||||
if (
|
||||
value === undefined ||
|
||||
value === null ||
|
||||
value === '' ||
|
||||
Number(value) === -1 ||
|
||||
String(value) === '-1'
|
||||
) {
|
||||
form[key] = emptyValue;
|
||||
}
|
||||
});
|
||||
return form;
|
||||
},
|
||||
handleStatus(row) {
|
||||
const status = row.status === 1 ? 2 : 1;
|
||||
const text = status === 1 ? '启用' : '停用';
|
||||
|
||||
Reference in New Issue
Block a user