diff --git a/pc-cattle-transportation/src/api/slaughter.js b/pc-cattle-transportation/src/api/slaughter.js index 9018691..e4d94ad 100644 --- a/pc-cattle-transportation/src/api/slaughter.js +++ b/pc-cattle-transportation/src/api/slaughter.js @@ -85,3 +85,42 @@ export function slaughterEntryDetail(id) { }); } +// 屠宰记录 +export function slaughterRecordList(data) { + return request({ + url: '/slaughter/record/list', + method: 'POST', + data, + }); +} + +export function slaughterRecordAdd(data) { + return request({ + url: '/slaughter/record/add', + method: 'POST', + data, + }); +} + +export function slaughterRecordEdit(data) { + return request({ + url: '/slaughter/record/edit', + method: 'POST', + data, + }); +} + +export function slaughterRecordDel(id) { + return request({ + url: `/slaughter/record/delete?id=${id}`, + method: 'GET', + }); +} + +export function slaughterRecordDetail(id) { + return request({ + url: `/slaughter/record/detail?id=${id}`, + method: 'GET', + }); +} + diff --git a/pc-cattle-transportation/src/router/index.ts b/pc-cattle-transportation/src/router/index.ts index 4f2ea6c..e7fc998 100644 --- a/pc-cattle-transportation/src/router/index.ts +++ b/pc-cattle-transportation/src/router/index.ts @@ -357,6 +357,16 @@ export const constantRoutes: Array = [ }, component: () => import('~/views/slaughter/entry.vue'), }, + { + path: 'record', + name: 'record', + meta: { + title: '屠宰记录', + keepAlive: true, + requireAuth: true, + }, + component: () => import('~/views/slaughter/record.vue'), + }, ], }, { diff --git a/pc-cattle-transportation/src/views/shipping/createDeliveryDialog.vue b/pc-cattle-transportation/src/views/shipping/createDeliveryDialog.vue index aedbe0b..b39385a 100644 --- a/pc-cattle-transportation/src/views/shipping/createDeliveryDialog.vue +++ b/pc-cattle-transportation/src/views/shipping/createDeliveryDialog.vue @@ -904,6 +904,28 @@ const videoLists = reactive( }, {}) ); +// 字段名称到中文名称的映射(用于错误提示) +const photoFieldNames = { + quarantineTickeyUrl: '检疫票', + poundListImg: '发车纸质磅单(双章)', + emptyVehicleFrontPhoto: '车辆空磅上磅车头照片', + loadedVehicleFrontPhoto: '车辆过重磅车头照片', + loadedVehicleWeightPhoto: '车辆重磅侧方照片', + driverIdCardPhoto: '驾驶员手持身份证站车头照片', + destinationPoundListImg: '落地纸质磅单(双章)', + destinationVehicleFrontPhoto: '落地车辆车头照片', +}; + +const videoFieldNames = { + entruckWeightVideo: '装车过磅视频', + emptyWeightVideo: '空车过磅视频', + cattleLoadingVideo: '装牛视频', + controlSlotVideo: '控槽视频', + cattleLoadingCircleVideo: '装完牛绕车一圈视频', + unloadCattleVideo: '卸牛视频', + destinationWeightVideo: '落地过磅视频', +}; + // 车牌号校验(已移除正则验证,直接传递字符串) // const validatePlateNumber = (rule, value, callback) => { // const plateReg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-Z0-9]{5}[A-Z0-9挂学警港澳]$/; @@ -1715,6 +1737,88 @@ const handleSubmit = () => { return; } + // 检查图片上传状态 + const failedPhotos = []; + const uploadingPhotos = []; + photoFields.forEach((field) => { + const list = photoLists[field] || []; + // 检查是否有正在上传中的文件 + const hasUploading = list.some((file) => file.status === 'uploading'); + if (hasUploading) { + uploadingPhotos.push(photoFieldNames[field] || field); + } + // 检查是否有文件但没有成功上传 + const hasUnsuccessfulUpload = list.some((file) => { + // 如果文件状态是 'fail',说明上传失败 + if (file.status === 'fail') { + return true; + } + // 如果文件存在但没有 url,或者 url 为空,说明上传失败 + // 排除正在上传中的文件(status === 'uploading') + if (file.status !== 'uploading' && (!file.url || file.url.trim() === '')) { + return true; + } + return false; + }); + if (hasUnsuccessfulUpload) { + failedPhotos.push(photoFieldNames[field] || field); + } + }); + + // 检查视频上传状态 + const failedVideos = []; + const uploadingVideos = []; + videoFields.forEach((field) => { + const list = videoLists[field] || []; + // 检查是否有正在上传中的文件 + const hasUploading = list.some((file) => file.status === 'uploading'); + if (hasUploading) { + uploadingVideos.push(videoFieldNames[field] || field); + } + // 检查是否有文件但没有成功上传 + const hasUnsuccessfulUpload = list.some((file) => { + // 如果文件状态是 'fail',说明上传失败 + if (file.status === 'fail') { + return true; + } + // 如果文件存在但没有 url,或者 url 为空,说明上传失败 + // 排除正在上传中的文件(status === 'uploading') + if (file.status !== 'uploading' && (!file.url || file.url.trim() === '')) { + return true; + } + return false; + }); + if (hasUnsuccessfulUpload) { + failedVideos.push(videoFieldNames[field] || field); + } + }); + + // 如果有正在上传中的文件,提示用户等待 + if (uploadingPhotos.length > 0 || uploadingVideos.length > 0) { + let errorMsg = '请等待以下文件上传完成后再提交:\n'; + if (uploadingPhotos.length > 0) { + errorMsg += `图片:${uploadingPhotos.join('、')}\n`; + } + if (uploadingVideos.length > 0) { + errorMsg += `视频:${uploadingVideos.join('、')}`; + } + ElMessage.warning(errorMsg); + return; + } + + // 如果有上传失败的文件,提示用户 + if (failedPhotos.length > 0 || failedVideos.length > 0) { + let errorMsg = '请确保以下文件上传成功后再提交:\n'; + if (failedPhotos.length > 0) { + errorMsg += `图片:${failedPhotos.join('、')}\n`; + } + if (failedVideos.length > 0) { + errorMsg += `视频:${failedVideos.join('、')}`; + } + ElMessage.error(errorMsg); + return; + } + // 提交前,将多文件列表拼接到表单字段 photoFields.forEach((field) => { const urls = photoLists[field].map((f) => f.url).filter(Boolean).slice(0, 2); diff --git a/pc-cattle-transportation/src/views/slaughter/entry.vue b/pc-cattle-transportation/src/views/slaughter/entry.vue index 8d7ff6e..79beeb9 100644 --- a/pc-cattle-transportation/src/views/slaughter/entry.vue +++ b/pc-cattle-transportation/src/views/slaughter/entry.vue @@ -6,20 +6,28 @@
+ - - + + + + - - + - + diff --git a/pc-cattle-transportation/src/views/warehouse/warehouseOutDialog.vue b/pc-cattle-transportation/src/views/warehouse/warehouseOutDialog.vue index b9da28a..04ed408 100644 --- a/pc-cattle-transportation/src/views/warehouse/warehouseOutDialog.vue +++ b/pc-cattle-transportation/src/views/warehouse/warehouseOutDialog.vue @@ -27,23 +27,120 @@ - - - - - + + + + + + +
+ + 添加进仓记录 + + + + + + + + + + + + + + + + + + + + + +
+ 总出仓数量:{{ getTotalOutCount() }} +
+
@@ -137,9 +234,13 @@ v-model="ruleForm.cattleCount" :min="1" :max="9999" - placeholder="请输入牛只数量" + placeholder="请输入牛只数量(自动计算)" style="width: 100%" + :disabled="true" /> +
+ 由关联的进仓记录自动计算 +
@@ -263,11 +364,11 @@