From f748fa9bb9cf1e93f0aa2e4c56e4fc7b29159e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E7=BA=A2=E5=85=B5?= <374362909@qq.com> Date: Sat, 28 Feb 2026 00:04:19 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E7=94=B3=E8=AF=B7=E4=B8=AD?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E4=B8=8A=E4=BC=A0=E7=9A=84=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Upload/index.vue | 14 +++++++++++++- src/flow/components/handle-job/handle.vue | 2 +- src/views/finance/purchasingrequisition/add.vue | 17 ++++++++++++----- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/components/Upload/index.vue b/src/components/Upload/index.vue index 09ff0e4..c778943 100644 --- a/src/components/Upload/index.vue +++ b/src/components/Upload/index.vue @@ -376,7 +376,19 @@ const handleRemove = (file: { name?: string; id?: string; url?: string }) => { }; const handlePreview = (file: any) => { - other.downBlobFile(file.url, {}, file.name); + // 优先使用文件ID下载(采购附件使用 downloadById 接口) + if (file.id) { + // 判断是否是采购附件(通过 fileType 判断) + const downloadUrl = `/purchase/purchasingfiles/downloadById?fileId=${encodeURIComponent(file.id)}`; + other.downBlobFile(downloadUrl, {}, file.name || file.fileTitle || '文件'); + return; + } + // 兼容旧的URL下载方式 + if (file.url) { + other.downBlobFile(file.url, {}, file.name || file.fileTitle || '文件'); + return; + } + useMessage().warning('无法获取文件下载信息'); }; // 添加 handleExceed 函数 diff --git a/src/flow/components/handle-job/handle.vue b/src/flow/components/handle-job/handle.vue index cfe1c61..6061cd9 100644 --- a/src/flow/components/handle-job/handle.vue +++ b/src/flow/components/handle-job/handle.vue @@ -45,7 +45,7 @@ type="textarea" :placeholder="t('jfcomment.inputRemarkTip')"> - + diff --git a/src/views/finance/purchasingrequisition/add.vue b/src/views/finance/purchasingrequisition/add.vue index 8482b4c..417ac8b 100644 --- a/src/views/finance/purchasingrequisition/add.vue +++ b/src/views/finance/purchasingrequisition/add.vue @@ -1313,13 +1313,20 @@ function formatImplementFileTime(t?: string) { return isNaN(d.getTime()) ? t : d.toLocaleString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' }); } -function downloadImplementFile(file: { remark?: string; fileTitle?: string }) { - if (!file?.remark) { - useMessage().warning('无法获取文件路径'); +function downloadImplementFile(file: { id?: string; remark?: string; fileTitle?: string }) { + // 优先使用文件ID下载 + if (file?.id) { + const url = `/purchase/purchasingfiles/downloadById?fileId=${encodeURIComponent(file.id)}`; + other.downBlobFile(url, {}, file.fileTitle || '采购文件'); return; } - const url = `/purchase/purchasingfiles/download?fileName=${encodeURIComponent(file.remark)}&fileTitle=${encodeURIComponent(file.fileTitle || '采购文件')}`; - other.downBlobFile(url, {}, file.fileTitle || '采购文件'); + // 兼容旧数据:使用文件路径下载 + if (file?.remark) { + const url = `/purchase/purchasingfiles/download?fileName=${encodeURIComponent(file.remark)}&fileTitle=${encodeURIComponent(file.fileTitle || '采购文件')}`; + other.downBlobFile(url, {}, file.fileTitle || '采购文件'); + return; + } + useMessage().warning('无法获取文件信息'); } /** 流程嵌入时提供给 orderVue.currElTabIsView 的 methods(只读/禁用提交) */