采购申请中下载上传的文件
This commit is contained in:
@@ -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 函数
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
type="textarea" :placeholder="t('jfcomment.inputRemarkTip')">
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('jfcomment.signName')">
|
||||
<el-form-item :label="t('jfcomment.signName')" style="display: none">
|
||||
<sign-name ref="signNameRef" :currJob="data.currJob"></sign-name>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
// 兼容旧数据:使用文件路径下载
|
||||
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(只读/禁用提交) */
|
||||
|
||||
Reference in New Issue
Block a user