添加功能下载验收单

This commit is contained in:
xuqiuyun
2025-11-05 14:39:27 +08:00
parent eacb0453dd
commit 70d9db252a
11 changed files with 919 additions and 68 deletions

View File

@@ -224,17 +224,6 @@
/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="预估重量(kg)" prop="estimatedWeight">
<el-input-number
v-model="formData.estimatedWeight"
:min="0.01"
:precision="2"
placeholder="请输入预估重量"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
@@ -671,7 +660,6 @@ const formData = reactive({
endLat: '',
endLon: '',
cattleCount: 1,
estimatedWeight: null,
quarantineCertNo: '',
remark: '',
// 装车相关字段
@@ -746,7 +734,6 @@ const rules = {
startLocation: [{ required: true, message: '请输入起点地址', trigger: 'blur' }],
endLocation: [{ required: true, message: '请输入目的地地址', trigger: 'blur' }],
cattleCount: [{ required: true, message: '请输入牛只数量', trigger: 'blur' }],
estimatedWeight: [{ required: true, message: '请输入预估重量', trigger: 'blur' }],
};
// 计算耳标设备列表(包含体重输入)
@@ -817,7 +804,6 @@ const buildSubmitData = () => {
// 其他信息
cattleCount: formData.cattleCount,
estimatedWeight: formData.estimatedWeight,
quarantineCertNo: formData.quarantineCertNo,
remark: formData.remark,
@@ -850,12 +836,24 @@ const buildSubmitData = () => {
}
// 将所有undefined值转换为空字符串确保字段被提交
// 但是对于数值类型的字段如cattleCount保留null或原值不要转换为空字符串
Object.keys(data).forEach(key => {
if (data[key] === undefined) {
data[key] = '';
// 数值类型字段保留null其他字段转换为空字符串
if (key === 'cattleCount' ||
key === 'orderId' || key === 'shipperId' || key === 'buyerId' ||
key === 'driverId' || key === 'serverId') {
data[key] = null;
} else {
data[key] = '';
}
}
});
// 确保cattleCount不为空字符串如果是空字符串则转换为null
if (data.cattleCount === '') {
data.cattleCount = null;
}
return data;
};
@@ -955,6 +953,9 @@ const fillFormWithEditData = (editData) => {
formData.entruckWeight = delivery.entruckWeight || null;
formData.landingEntruckWeight = delivery.landingEntruckWeight || null;
// 牛只数量从ratedQuantity字段映射
formData.cattleCount = delivery.ratedQuantity || 1;
// 照片
formData.quarantineTickeyUrl = delivery.quarantineTickeyUrl || '';
formData.poundListImg = delivery.poundListImg || '';
@@ -1246,7 +1247,8 @@ const handleSubmit = () => {
// 判断是编辑还是新增
if (formData.editId) {
// 编辑模式:调用更新接口
// 将cattleCount映射为ratedQuantity后端DeliveryEditDto使用ratedQuantity字段
submitData.ratedQuantity = submitData.cattleCount;
submitData.deliveryId = formData.editId; // 添加deliveryId字段后端需要
res = await shippingApi.updateDeliveryInfo(submitData);
} else {