⚡ 配载货物信息分列数量单位,并修复车辆尺寸 -1 展示
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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