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(只读/禁用提交) */