From f941f89adf8c6e6580dfc018520c37de12ca9c4c Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Thu, 29 Jan 2026 17:33:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
applications/task-work-order/src/views/orderView/orderManage/inspectionReport/index.vue | 79 ++++++++++++++++++++++-----------------
1 files changed, 44 insertions(+), 35 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 ed177e1..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"
@@ -313,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: '打包中,请稍等...' })
+ // 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(',')
- // const res = await getDownloadStatusApi({ type: 'dpsjzx' })
- // if (!['CANCELLED', 'COMPLETED'].includes(res.data.data?.status || 'COMPLETED')) {
- // return ElMessage.warning('还有正在处理的')
- // }
- console.log(fileIds, '7777')
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