🐛 修复车务非必填-1展示,并完善总单调度与运单表单体验
调度页限制上一段到达后才可调度;司机候选项点击展开;车务多模块-1显示为空;同步配载/总单编辑与导入相关优化。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -381,8 +381,26 @@ export default {
|
||||
if (values.policyNo) {
|
||||
values.policyNo = values.policyNo.trim();
|
||||
}
|
||||
// 非必填项未填写时不要提交 -1 占位值
|
||||
values.insuredAmount = this.normalizeOptionalAmount(values.insuredAmount);
|
||||
values.premium = this.normalizeOptionalAmount(values.premium);
|
||||
values.invoiceNo = this.normalizeOptionalText(values.invoiceNo);
|
||||
values.invoiceDate = this.normalizeOptionalText(values.invoiceDate);
|
||||
values.remark = this.normalizeOptionalText(values.remark);
|
||||
values.policyFile = this.normalizeOptionalText(values.policyFile);
|
||||
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;
|
||||
},
|
||||
normalizeDecimalInput(prop, value) {
|
||||
const sanitized = String(value ?? '').replace(/[^\d.]/g, '');
|
||||
const [integerPart, ...decimalParts] = sanitized.split('.');
|
||||
@@ -398,8 +416,18 @@ export default {
|
||||
this.$message.warning('结束日期不能早于开始日期');
|
||||
return false;
|
||||
}
|
||||
if (Number(row.insuredAmount) < 0 || Number(row.premium) < 0) {
|
||||
this.$message.warning('保额、保费不能小于 0');
|
||||
const insuredAmount = this.normalizeOptionalAmount(row.insuredAmount);
|
||||
const premium = this.normalizeOptionalAmount(row.premium);
|
||||
if (insuredAmount !== null && Number(insuredAmount) < 0) {
|
||||
this.$message.warning('保额不能小于 0');
|
||||
return false;
|
||||
}
|
||||
if (premium === null) {
|
||||
this.$message.warning('请输入保费');
|
||||
return false;
|
||||
}
|
||||
if (Number(premium) < 0) {
|
||||
this.$message.warning('保费不能小于 0');
|
||||
return false;
|
||||
}
|
||||
if (row.remark && row.remark.length > 200) {
|
||||
@@ -479,15 +507,25 @@ export default {
|
||||
this.vehicleOptions = [];
|
||||
this.loadVehicleOptions('');
|
||||
this.form.vehicleType = '车辆';
|
||||
this.form.insuredAmount = '';
|
||||
this.form.invoiceNo = '';
|
||||
this.form.invoiceDate = '';
|
||||
this.form.remark = '';
|
||||
this.initOcrTemplateOptions('车辆', true);
|
||||
}
|
||||
if (['edit', 'view'].includes(type)) {
|
||||
this.isDetailLoading = true;
|
||||
getDetail(this.form.id)
|
||||
.then(res => {
|
||||
const detail = res.data.data || {};
|
||||
this.form = {
|
||||
...res.data.data,
|
||||
vehicleType: res.data.data.vehicleType || '车辆',
|
||||
...detail,
|
||||
vehicleType: detail.vehicleType || '车辆',
|
||||
insuredAmount: this.normalizeOptionalAmount(detail.insuredAmount),
|
||||
premium: this.normalizeOptionalAmount(detail.premium),
|
||||
invoiceNo: this.normalizeOptionalText(detail.invoiceNo) || '',
|
||||
invoiceDate: this.normalizeOptionalText(detail.invoiceDate) || '',
|
||||
remark: this.normalizeOptionalText(detail.remark) || '',
|
||||
};
|
||||
this.vehicleOptions = [];
|
||||
this.loadVehicleOptions(this.form.vehicleNo || '');
|
||||
|
||||
Reference in New Issue
Block a user