applications/task-work-order/src/views/orderView/orderDataManage/dataObjection/FormDiaLog.vue
@@ -504,24 +504,69 @@ attachmentDetailsList.value = results.map(res => res.data.data).filter(Boolean) } // 处理附件下载 async function handleDownloadAttach() { if (attachmentDetailsList.value.length === 0) { ElMessage.warning('没有可下载的附件') return } const handleDownloadAttach = async () => { if (!attachmentDetailsList.value || attachmentDetailsList.value.length === 0) { ElMessage.warning('没有可下载的附件') return } // 遍历所有附件并下载 attachmentDetailsList.value.forEach(attach => { if (attach.link) { const link = document.createElement('a') link.href = attach.link link.download = attach.originalName || attach.name link.style.display = 'none' document.body.appendChild(link) link.click() document.body.removeChild(link) } }) // 顺序下载每个附件 for (let i = 0; i < attachmentDetailsList.value.length; i++) { const attach = attachmentDetailsList.value[i] if (!attach.link) { console.warn(`附件 ${attach.originalName || attach.name} 链接无效,跳过`) continue } try { // 显示当前下载的文件信息 const currentFileName = attach.originalName || attach.name || `附件_${i + 1}` const response = await fetch(attach.link) const blob = await response.blob() const url = window.URL.createObjectURL(blob) const a = document.createElement('a') a.href = url // 设置文件名:优先使用 originalName let fileName = attach.originalName || attach.name || `附件_${i + 1}` // 确保有扩展名 if (fileName && !fileName.includes('.')) { const contentType = response.headers.get('content-type') if (contentType && contentType.includes('zip')) { fileName += '.zip' } else if (contentType && contentType.includes('rar')) { fileName += '.rar' } else { fileName += '.zip' } } a.download = fileName a.style.display = 'none' document.body.appendChild(a) a.click() // 清理 setTimeout(() => { window.URL.revokeObjectURL(url) document.body.removeChild(a) }, 100) // 文件间延迟(除了最后一个) if (i < attachmentDetailsList.value.length - 1) { await new Promise(resolve => setTimeout(resolve, 1000)) } } catch (error) { console.error(`下载失败: ${attach.originalName || attach.name}`, error) } } } applications/task-work-order/src/views/orderView/orderDataManage/supplyAdd/ApplyViewDialog.vue
@@ -236,32 +236,52 @@ ElMessage.error(error?.message || '文件上传失败,请重试') } // 查看文件 const viewFile = file => { if (file.link) { window.open(file.link, '_blank') } else { ElMessage.warning('文件链接无效') } } // 从表格下载文件 - 使用 fetch API const downloadFileFromTable = async (file) => { if (!file.fileUrl) { ElMessage.warning('文件链接无效') return } // 从表格下载文件 const downloadFileFromTable = file => { if (file.fileUrl) { // 创建一个隐藏的a标签来触发下载 const a = document.createElement('a') a.href = file.fileUrl a.download = file.fileOriginalName || '下载附件' document.body.appendChild(a) a.click() document.body.removeChild(a) } else { ElMessage.warning('文件链接无效') } try { const response = await fetch(file.fileUrl) const blob = await response.blob() const url = window.URL.createObjectURL(blob) const a = document.createElement('a') a.href = url // 获取原始文件名,处理中文和特殊字符 const originalName = file.fileOriginalName || 'download-file.zip' // 确保文件名有正确的扩展名 let fileName = originalName if (!fileName.includes('.')) { // 从 Content-Type 推断扩展名 const contentType = response.headers.get('content-type') if (contentType === 'application/zip') { fileName += '.zip' } else if (contentType === 'application/x-rar-compressed') { fileName += '.rar' } } a.download = fileName a.style.display = 'none' document.body.appendChild(a) a.click() // 清理 setTimeout(() => { window.URL.revokeObjectURL(url) document.body.removeChild(a) }, 100) } catch (error) { console.error('下载失败:', error) } } // 下载所有文件 const downloadAllFiles = () => { const downloadAllFiles =async () => { if (!tableData.value || tableData.value.length === 0) { ElMessage.warning('没有可下载的文件') return @@ -273,22 +293,56 @@ ElMessage.warning('所有文件链接均无效') return } ElMessage.success(`开始下载${validFiles.length}个文件`) // 依次下载每个文件(添加延迟以避免浏览器限制) validFiles.forEach((file, index) => { setTimeout(() => { if (file.fileUrl) { const a = document.createElement('a') a.href = file.fileUrl a.download = file.fileOriginalName || `下载附件_${index + 1}` document.body.appendChild(a) a.click() document.body.removeChild(a) } }, index * 300) // 300ms delay between downloads }) // 顺序下载每个文件 for (let i = 0; i < validFiles.length; i++) { const file = validFiles[i] try { const response = await fetch(file.fileUrl) const blob = await response.blob() const url = window.URL.createObjectURL(blob) const a = document.createElement('a') a.href = url // 设置文件名,优先使用原始文件名 let fileName = file.fileOriginalName || `附件_${i + 1}` // 确保文件名有扩展名 if (!fileName.includes('.')) { const contentType = response.headers.get('content-type') if (contentType === 'application/zip') { fileName += '.zip' } else if (contentType === 'application/x-rar-compressed') { fileName += '.rar' } else if (contentType === 'application/x-7z-compressed') { fileName += '.7z' } else { fileName += '.zip' } } a.download = fileName a.style.display = 'none' document.body.appendChild(a) a.click() // 清理资源 setTimeout(() => { window.URL.revokeObjectURL(url) document.body.removeChild(a) }, 100) // 文件间添加延迟(除了最后一个文件) if (i < validFiles.length - 1) { await new Promise(resolve => setTimeout(resolve, 500)) } } catch (error) { console.error(`文件下载失败: ${file.fileOriginalName || '未知文件'}`, error) // 继续下载下一个文件 } } } // 根据部门ID获取部门名称 @@ -362,9 +416,6 @@ // 拒绝申请 const rejectTheApplication = () => { // if (uploadedFiles.value.length === 0) { // return ElMessage.warning('请上传数据') // } // 打开拒绝申请弹框 rejectionDialogVisible.value = true } applications/task-work-order/src/views/orderView/organizational/agenciesManagement/index.vue
@@ -107,9 +107,8 @@ <el-form class="gd-dialog-form" ref="importFormRef" :model="importParams" :rules="importRules" label-width="140px"> <el-form-item label="导出模板"> <el-button color="#F2F3F5" type="primary" :loading="templateExportLoading" :disabled="templateExportLoading" @click="handleExportTemplate" > 点击导出 @@ -125,7 +124,7 @@ <template #footer> <el-button color="#F2F3F5" @click="isShowImportView = false">取消</el-button> <el-button class="" color="#4C34FF" :loading="importSubmitting" :disabled="importSubmitting" applications/task-work-order/src/views/orderView/organizational/zoningManagement/index.vue
@@ -103,10 +103,11 @@ > <el-form class="gd-dialog-form" ref="importFormRef" :model="importParams" :rules="importRules" label-width="140px"> <el-form-item label="导出模板"> <!-- :loading="templateExportLoading" :disabled="templateExportLoading" --> <el-button type="primary" :loading="templateExportLoading" :disabled="templateExportLoading" color="#F2F3F5" @click="handleExportTemplate" > 点击导出 @@ -122,7 +123,6 @@ <template #footer> <el-button color="#F2F3F5" @click="isShowImportView = false">取消</el-button> <el-button class="" color="#4C34FF" :loading="importSubmitting" :disabled="importSubmitting"