diff --git a/src/views/purchase/purchasingrequisition/DocAuditViewDialog.vue b/src/views/purchase/purchasingrequisition/DocAuditViewDialog.vue
index ee999fb..293b570 100644
--- a/src/views/purchase/purchasingrequisition/DocAuditViewDialog.vue
+++ b/src/views/purchase/purchasingrequisition/DocAuditViewDialog.vue
@@ -52,10 +52,9 @@
-
+
- 预览
- 下载
+ 下载
@@ -81,12 +80,6 @@
关闭
-
-
-
-
-
-
@@ -94,8 +87,9 @@
import { ref, computed } from 'vue';
import { DocumentChecked } from '@element-plus/icons-vue';
import { useMessage } from '/@/hooks/message';
-import { getObj, getDocList, previewFileById, downloadFileById } from '/@/api/purchase/purchasingrequisition';
+import { getObj, getDocList } from '/@/api/purchase/purchasingrequisition';
import { getFlowPurchaseDetail } from '/@/api/purchase/bidfile';
+import other from '/@/utils/other';
const FlowCommentTimeline = defineAsyncComponent(() => import('/@/views/jsonflow/comment/timeline.vue'));
@@ -114,9 +108,6 @@ const visible = ref(false);
const applyId = ref('');
const applyData = ref({});
const docList = ref([]);
-const previewVisible = ref(false);
-const previewTitle = ref('');
-const previewUrl = ref('');
const fileFlowJob = computed(() => {
if (!applyData.value.fileFlowInstId) return null;
@@ -154,7 +145,7 @@ const open = async (id: string, row?: any) => {
const docs = docsRes?.data || [];
if (Array.isArray(docs) && docs.length > 0) {
docList.value = docs.map((d: any) => ({
- id: d.id || d.fileId,
+ id: d.fileId, // 使用 fileId 关联 PurchasingFiles 表,用于下载
fileName: d.fileName || d.fileTitle || '招标文件',
fileUrl: d.fileUrl,
createTime: d.createTime,
@@ -170,41 +161,13 @@ const open = async (id: string, row?: any) => {
}
};
-const handlePreview = async (row: DocItem) => {
+const handleDownload = (row: DocItem) => {
if (!row.id) {
useMessage().warning('文件ID不存在');
return;
}
- try {
- const blob = await previewFileById(row.id);
- previewUrl.value = window.URL.createObjectURL(blob);
- previewTitle.value = row.fileName || '文件预览';
- previewVisible.value = true;
- } catch (e) {
- console.error('预览失败', e);
- useMessage().error('预览失败');
- }
-};
-
-const handleDownload = async (row: DocItem) => {
- if (!row.id) {
- useMessage().warning('文件ID不存在');
- return;
- }
- try {
- const blob = await downloadFileById(row.id);
- const url = window.URL.createObjectURL(blob);
- const link = document.createElement('a');
- link.href = url;
- link.download = row.fileName || '招标文件.pdf';
- document.body.appendChild(link);
- link.click();
- document.body.removeChild(link);
- window.URL.revokeObjectURL(url);
- } catch (e) {
- console.error('下载失败', e);
- useMessage().error('下载失败');
- }
+ const downloadUrl = '/purchase/purchasingfiles/downloadById?fileId=' + row.id;
+ other.downBlobFile(downloadUrl, {}, row.fileName || '招标文件');
};
const emit = defineEmits<{
@@ -249,17 +212,6 @@ defineExpose({
font-weight: 500;
}
-.preview-container {
- width: 100%;
- height: 75vh;
-}
-
-.preview-iframe {
- width: 100%;
- height: 100%;
- border: none;
-}
-
:deep(.el-card__header) {
padding: 12px 16px;
}