| | |
| | | })); |
| | | }; |
| | | |
| | | const buildSubmitFileItem = item => { |
| | | if (!item) return null; |
| | | |
| | | return { |
| | | id: item.id, |
| | | tempId: item.tempId, |
| | | tempFileId: item.tempFileId, |
| | | type: item.type, |
| | | url: item?.downloadUrl || item?.url || "", |
| | | downloadUrl: item?.downloadUrl || item?.url || "", |
| | | bucketFilename: item.bucketFilename, |
| | | originalFilename: item.originalFilename, |
| | | size: item.size, |
| | | byteSize: item.byteSize, |
| | | contentType: item.contentType, |
| | | }; |
| | | }; |
| | | |
| | | const buildGroupedFiles = list => { |
| | | return (list || []).map(buildSubmitFileItem).filter(Boolean); |
| | | }; |
| | | |
| | | const buildSubmitPayload = () => { |
| | | const { |
| | | createTime, |
| | | updateTime, |
| | | storageBlobDTO, |
| | | commonFileListBefore, |
| | | commonFileListAfter, |
| | | commonFileList, |
| | | __raw, |
| | | ...rest |
| | | } = currentTask.value || {}; |
| | | |
| | | const files = buildSubmitFiles(); |
| | | const tempFileIds = files |
| | | .map(item => item?.tempId ?? item?.tempFileId ?? item?.id) |
| | | .filter(Boolean); |
| | | |
| | | return { |
| | | ...rest, |
| | | hasException: hasException.value, |
| | | tempFileIds, |
| | | commonFileListBefore: buildGroupedFiles(beforeModelValue.value), |
| | | commonFileListAfter: buildGroupedFiles(afterModelValue.value), |
| | | commonFileList: buildGroupedFiles(issueModelValue.value), |
| | | }; |
| | | }; |
| | | |
| | | const submitUpload = async () => { |
| | | if (hasException.value === null) { |
| | | ElMessage.warning("请选择是否存在异常"); |
| | |
| | | }); |
| | | |
| | | try { |
| | | const tempFileIds = files |
| | | .map(item => item?.tempId ?? item?.tempFileId ?? item?.id) |
| | | .filter(Boolean); |
| | | |
| | | const payload = { |
| | | ...currentTask.value, |
| | | hasException: hasException.value, |
| | | storageBlobDTO: files, |
| | | tempFileIds, |
| | | commonFileListBefore: beforeModelValue.value, |
| | | commonFileListAfter: afterModelValue.value, |
| | | commonFileList: issueModelValue.value, |
| | | }; |
| | | const payload = buildSubmitPayload(); |
| | | |
| | | const result = await uploadInspectionTask(payload); |
| | | if (result?.code === 200 || result?.success) { |