采购申请中下载上传的文件

This commit is contained in:
吴红兵
2026-02-28 00:04:19 +08:00
parent e75cc1c0c6
commit f748fa9bb9
3 changed files with 26 additions and 7 deletions

View File

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