|
@@ -105,7 +105,7 @@
|
|
|
class="flex items-center w-full p-[10px] hover:bg-gray-100 rounded-6px"
|
|
class="flex items-center w-full p-[10px] hover:bg-gray-100 rounded-6px"
|
|
|
>
|
|
>
|
|
|
<!-- <el-tooltip :content="path"> -->
|
|
<!-- <el-tooltip :content="path"> -->
|
|
|
- <span class="flex-1 text-ellipsis overflow-hidden whitespace-nowrap">{{ path }}</span>
|
|
|
|
|
|
|
+ <span class="flex-1 text-ellipsis overflow-hidden whitespace-nowrap">{{ changedReportMap[currentReportId].attachmentName[index] || path }}</span>
|
|
|
<!-- </el-tooltip> -->
|
|
<!-- </el-tooltip> -->
|
|
|
<div class="ml-10px flex gap-[10px] cursor-pointer">
|
|
<div class="ml-10px flex gap-[10px] cursor-pointer">
|
|
|
<el-icon
|
|
<el-icon
|
|
@@ -239,8 +239,11 @@ const handleConfirm = () => {
|
|
|
const params = reportIds.map((item) => ({
|
|
const params = reportIds.map((item) => ({
|
|
|
reportId: item,
|
|
reportId: item,
|
|
|
attachment: changedReportMap.value[item].attachment.join(','),
|
|
attachment: changedReportMap.value[item].attachment.join(','),
|
|
|
|
|
+ attachmentName: changedReportMap.value[item].attachmentName.join(','),
|
|
|
image: changedReportMap.value[item].image.join(','),
|
|
image: changedReportMap.value[item].image.join(','),
|
|
|
- video: changedReportMap.value[item].video.join(',')
|
|
|
|
|
|
|
+ imageName: changedReportMap.value[item].imageName.join(','),
|
|
|
|
|
+ video: changedReportMap.value[item].video.join(','),
|
|
|
|
|
+ videoName: changedReportMap.value[item].videoName.join(',')
|
|
|
}))
|
|
}))
|
|
|
loading.value = true
|
|
loading.value = true
|
|
|
BoilerTaskOrderApi.reportItemUploadBatch({ items: params })
|
|
BoilerTaskOrderApi.reportItemUploadBatch({ items: params })
|
|
@@ -264,18 +267,22 @@ const uploadConfig = {
|
|
|
accept,
|
|
accept,
|
|
|
// limit: 1,
|
|
// limit: 1,
|
|
|
drag: true,
|
|
drag: true,
|
|
|
- onSuccess: (response: any) => {
|
|
|
|
|
|
|
+ onSuccess: (response: any, uploadFile: any) => {
|
|
|
console.log('response:', response)
|
|
console.log('response:', response)
|
|
|
if (response.code !== 0) return ElMessage.error(response.msg)
|
|
if (response.code !== 0) return ElMessage.error(response.msg)
|
|
|
ElMessage.success('附件上传成功')
|
|
ElMessage.success('附件上传成功')
|
|
|
// 根据文件类型,根据当前选中的报告id,添加到不同的数组中
|
|
// 根据文件类型,根据当前选中的报告id,添加到不同的数组中
|
|
|
const fileType = response.data.split('.').pop()?.toLowerCase()
|
|
const fileType = response.data.split('.').pop()?.toLowerCase()
|
|
|
|
|
+ const originalName = uploadFile?.name || response.data.substring(response.data.lastIndexOf('/') + 1)
|
|
|
if (['docx', 'pdf'].includes(fileType)) {
|
|
if (['docx', 'pdf'].includes(fileType)) {
|
|
|
changedReportMap.value[currentReportId.value].attachment.push(response.data)
|
|
changedReportMap.value[currentReportId.value].attachment.push(response.data)
|
|
|
|
|
+ changedReportMap.value[currentReportId.value].attachmentName.push(originalName)
|
|
|
} else if (['png', 'jpg', 'jpeg'].includes(fileType)) {
|
|
} else if (['png', 'jpg', 'jpeg'].includes(fileType)) {
|
|
|
changedReportMap.value[currentReportId.value].image.push(response.data)
|
|
changedReportMap.value[currentReportId.value].image.push(response.data)
|
|
|
|
|
+ changedReportMap.value[currentReportId.value].imageName.push(originalName)
|
|
|
} else if (['mp4'].includes(fileType)) {
|
|
} else if (['mp4'].includes(fileType)) {
|
|
|
changedReportMap.value[currentReportId.value].video.push(response.data)
|
|
changedReportMap.value[currentReportId.value].video.push(response.data)
|
|
|
|
|
+ changedReportMap.value[currentReportId.value].videoName.push(originalName)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onError: (error: Error, uploadFile: UploadFile, uploadFiles: UploadFiles): void => {
|
|
onError: (error: Error, uploadFile: UploadFile, uploadFiles: UploadFiles): void => {
|
|
@@ -305,16 +312,19 @@ const handleReportChange = (val) => {
|
|
|
if (val) setCurrentReportIdFile(props.reportList.find((item) => item.id === val))
|
|
if (val) setCurrentReportIdFile(props.reportList.find((item) => item.id === val))
|
|
|
}
|
|
}
|
|
|
const changedReportMap = ref<
|
|
const changedReportMap = ref<
|
|
|
- Record<string, { image: string[]; video: string[]; attachment: string[] }>
|
|
|
|
|
|
|
+ Record<string, { image: string[]; imageName: string[]; video: string[]; videoName: string[]; attachment: string[]; attachmentName: string[] }>
|
|
|
>({}) // 已经编辑过的报告的数据统计
|
|
>({}) // 已经编辑过的报告的数据统计
|
|
|
const setCurrentReportIdFile = (selectedItem) => {
|
|
const setCurrentReportIdFile = (selectedItem) => {
|
|
|
- const { id, image, video, attachment } = selectedItem
|
|
|
|
|
|
|
+ const { id, image, imageName, video, videoName, attachment, attachmentName } = selectedItem
|
|
|
currentReportId.value = filterReportList.value.find((item) => item.id === id)?.id || ''
|
|
currentReportId.value = filterReportList.value.find((item) => item.id === id)?.id || ''
|
|
|
if (!changedReportMap.value[id]) {
|
|
if (!changedReportMap.value[id]) {
|
|
|
changedReportMap.value[id] = {
|
|
changedReportMap.value[id] = {
|
|
|
image: image ? image.split(',') : [],
|
|
image: image ? image.split(',') : [],
|
|
|
|
|
+ imageName: imageName ? imageName.split(',') : [],
|
|
|
video: video ? video.split(',') : [],
|
|
video: video ? video.split(',') : [],
|
|
|
- attachment: attachment ? attachment.split(',') : []
|
|
|
|
|
|
|
+ videoName: videoName ? videoName.split(',') : [],
|
|
|
|
|
+ attachment: attachment ? attachment.split(',') : [],
|
|
|
|
|
+ attachmentName: attachmentName ? attachmentName.split(',') : []
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -326,10 +336,13 @@ const previewUrl = ref('')
|
|
|
const handleDelete = (index: number, type: 'image' | 'video' | 'attachment') => {
|
|
const handleDelete = (index: number, type: 'image' | 'video' | 'attachment') => {
|
|
|
if (type === 'image') {
|
|
if (type === 'image') {
|
|
|
changedReportMap.value[currentReportId.value].image.splice(index, 1)
|
|
changedReportMap.value[currentReportId.value].image.splice(index, 1)
|
|
|
|
|
+ changedReportMap.value[currentReportId.value].imageName.splice(index, 1)
|
|
|
} else if (type === 'video') {
|
|
} else if (type === 'video') {
|
|
|
changedReportMap.value[currentReportId.value].video.splice(index, 1)
|
|
changedReportMap.value[currentReportId.value].video.splice(index, 1)
|
|
|
|
|
+ changedReportMap.value[currentReportId.value].videoName.splice(index, 1)
|
|
|
} else {
|
|
} else {
|
|
|
changedReportMap.value[currentReportId.value].attachment.splice(index, 1)
|
|
changedReportMap.value[currentReportId.value].attachment.splice(index, 1)
|
|
|
|
|
+ changedReportMap.value[currentReportId.value].attachmentName.splice(index, 1)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
const handlePreview = (path: string, type: 'video' | 'image' | 'attachment') => {
|
|
const handlePreview = (path: string, type: 'video' | 'image' | 'attachment') => {
|