From 0ef47a49fa6dce546be2d0f23b4949734e6a0cf9 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Thu, 29 Jan 2026 18:31:55 +0800
Subject: [PATCH] Merge branch 'master' of http://139.196.74.78:10010/r/jagzwxm/ja_web

---
 applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue |   85 ++++++++++++++++++++++++------------------
 1 files changed, 48 insertions(+), 37 deletions(-)

diff --git a/applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue b/applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue
index 4c99877..c6c9dce 100644
--- a/applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue
+++ b/applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue
@@ -82,10 +82,9 @@
 		</div>
 		<el-dialog
 			class="gd-dialog"
-			append-to-body
 			v-model="isShowEditView"
 			:title="titleTxt"
-			:width="pxToRem(800)"
+			:width="pxToRem(500)"
 			:close-on-click-modal="false"
 			:destroy-on-close="true"
 			@close="handleClose"
@@ -111,10 +110,12 @@
 					</el-select>
 				</el-form-item>
 				<el-form-item label="上传文件" prop="link" v-if="titleTxt === '上传巡查报告'">
-					{{ uploadName }}
 					<el-upload class="avatar-uploader" action="" :show-file-list="false" :before-upload="onUploadFileBefore">
 						<el-button size="small" type="primary">点击上传</el-button>
 					</el-upload>
+					<div class="upload-tip">
+						{{ uploadName }}
+					</div>
 				</el-form-item>
 			</el-form>
 			<!-- </div> -->
@@ -311,43 +312,53 @@
 		ElMessage.warning('请选择要下载的文件')
 		return
 	}
-	if (selectedFiles.value.length === 1) {
-		selectedFiles.value.forEach((file, index) => {
-			// setTimeout(() => {
-			if (file.link) {
-				const a = document.createElement('a')
-				a.href = file.link
-				a.download = file.originalName || `attachment_${index + 1}`
-				document.body.appendChild(a)
-				a.click()
-				document.body.removeChild(a)
-			}
-			// }, index * 300) // 300ms delay between downloads
-		})
-	} else {
-		// 批量下载
-		try {
-			console.log(selectedFiles.value, '9999')
-			loadingData = ElLoading.service({ background: 'rgba(0, 0, 0, 0.5)', text: '打包中,请稍等...' })
-			const fileIds = selectedFiles.value.map(i => i.id)
-			// const res = await getDownloadStatusApi({ type: 'dpsjzx' })
-			// if (!['CANCELLED', 'COMPLETED'].includes(res.data.data?.status || 'COMPLETED')) {
-			// 	return ElMessage.warning('还有正在处理的')
-			// }
-			console.log(fileIds, '7777')
+	// if (selectedFiles.value.length === 1) {
+	// 	selectedFiles.value.forEach(async (file, index) => {
+	// 		if (file.link) {
+	// 			try {
+	// 				// 使用 fetch 获取 blob 数据来强制下载,避免浏览器打开文件
+	// 				const response = await fetch(file.link)
+	// 				if (!response.ok) {
+	// 					throw new Error(`Failed to fetch file: ${response.status}`)
+	// 				}
+	// 				const blob = await response.blob()
+	// 				const url = URL.createObjectURL(blob)
+	// 				const a = document.createElement('a')
+	// 				a.href = url
+	// 				a.download = file.originalName || `attachment_${index + 1}`
+	// 				document.body.appendChild(a)
+	// 				a.click()
+	// 				document.body.removeChild(a)
+	// 				// 释放 URL 对象
+	// 				setTimeout(() => URL.revokeObjectURL(url), 100)
+	// 				ElMessage.success('下载成功')
+	// 			} catch (error) {
+	// 				console.error('Download error:', error)
+	// 				ElMessage.error(`下载文件 ${file.originalName} 失败: ${error.message}`)
+	// 			}
+	// 		}
+	// 	})
+	// } else {
+			try {
+			const fileIds = selectedFiles.value.map(i => i.id).join(',')
 			await fjDownloadByByteApi({ attachIds: fileIds }).then(res => {
-				if (res.data.code === 200) {
+			const blob = res.data
+			const url = URL.createObjectURL(blob)
+			const a = document.createElement('a')
+			a.href = url
+			a.download = `巡查报告.zip`
+			document.body.appendChild(a)
+			a.click()
+			document.body.removeChild(a)
+			URL.revokeObjectURL(url)
 					ElMessage.success('下载成功')
-				} else {
-					ElMessage.error(res.msg || '下载失败')
-				}
-			})
-		} catch (e) {
-		} finally {
-			loadingData.close()
-		}
+				})
+			} catch (e) {
+			} finally {
+				// loadingData.close()
+			}
 
-	}
+	// }
 }
 
 // 文档上传

--
Gitblit v1.9.3