🐛 修复车务非必填-1展示,并完善总单调度与运单表单体验
调度页限制上一段到达后才可调度;司机候选项点击展开;车务多模块-1显示为空;同步配载/总单编辑与导入相关优化。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -298,19 +298,41 @@ export default {
|
||||
if (values.vehicleNo) {
|
||||
values.vehicleNo = values.vehicleNo.trim().toUpperCase();
|
||||
}
|
||||
// 非必填数量未填写时不要提交 -1;费用必填,-1 转 null 后由校验拦截
|
||||
values.tireQuantity = this.normalizeOptionalAmount(values.tireQuantity);
|
||||
values.replacementCost = this.normalizeOptionalAmount(values.replacementCost);
|
||||
values.handler = this.normalizeOptionalText(values.handler);
|
||||
values.tireBrand = this.normalizeOptionalText(values.tireBrand);
|
||||
values.replacementDescription = this.normalizeOptionalText(values.replacementDescription);
|
||||
values.remark = this.normalizeOptionalText(values.remark);
|
||||
values.attachments = this.stringifyAttachments(values.attachments);
|
||||
return values;
|
||||
},
|
||||
normalizeOptionalAmount(value) {
|
||||
if (value === undefined || value === null || value === '' || Number(value) === -1) {
|
||||
return null;
|
||||
}
|
||||
return value;
|
||||
},
|
||||
normalizeOptionalText(value) {
|
||||
if (value === undefined || value === null) return null;
|
||||
const text = String(value).trim();
|
||||
return !text || text === '-1' ? null : text;
|
||||
},
|
||||
validateRow(row) {
|
||||
if (Number(row.replacementCost) < 0) {
|
||||
const replacementCost = this.normalizeOptionalAmount(row.replacementCost);
|
||||
const tireQuantity = this.normalizeOptionalAmount(row.tireQuantity);
|
||||
if (replacementCost === null) {
|
||||
this.$message.warning('请输入换胎费用');
|
||||
return false;
|
||||
}
|
||||
if (Number(replacementCost) < 0) {
|
||||
this.$message.warning('换胎费用不能小于 0');
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
row.tireQuantity !== undefined &&
|
||||
row.tireQuantity !== null &&
|
||||
row.tireQuantity !== '' &&
|
||||
(!Number.isInteger(Number(row.tireQuantity)) || Number(row.tireQuantity) <= 0)
|
||||
tireQuantity !== null &&
|
||||
(!Number.isInteger(Number(tireQuantity)) || Number(tireQuantity) <= 0)
|
||||
) {
|
||||
this.$message.warning('换胎数量必须为正整数');
|
||||
return false;
|
||||
@@ -391,9 +413,16 @@ export default {
|
||||
}
|
||||
if (['edit', 'view'].includes(type)) {
|
||||
getDetail(this.form.id).then(res => {
|
||||
const detail = res.data.data;
|
||||
detail.attachments = this.parseAttachments(detail.attachments);
|
||||
this.form = detail;
|
||||
const detail = res.data.data;
|
||||
detail.attachments = this.parseAttachments(detail.attachments);
|
||||
detail.tireQuantity = this.normalizeOptionalAmount(detail.tireQuantity);
|
||||
detail.replacementCost = this.normalizeOptionalAmount(detail.replacementCost);
|
||||
detail.handler = this.normalizeOptionalText(detail.handler) || '';
|
||||
detail.tireBrand = this.normalizeOptionalText(detail.tireBrand) || '';
|
||||
detail.replacementDescription =
|
||||
this.normalizeOptionalText(detail.replacementDescription) || '';
|
||||
detail.remark = this.normalizeOptionalText(detail.remark) || '';
|
||||
this.form = detail;
|
||||
this.vehicleOptions = [];
|
||||
this.loadVehicleOptions(this.form.vehicleNo || '');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user