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

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

@@ -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 函数