招标文件

This commit is contained in:
吴红兵
2026-03-15 19:45:54 +08:00
parent 98799a2555
commit 01ef25b70a

View File

@@ -52,10 +52,9 @@
<el-table-column prop="uploadUserName" label="上传人" width="100" /> <el-table-column prop="uploadUserName" label="上传人" width="100" />
<el-table-column prop="createTime" label="上传时间" width="150" /> <el-table-column prop="createTime" label="上传时间" width="150" />
<el-table-column prop="comment" label="批注" width="150" show-overflow-tooltip /> <el-table-column prop="comment" label="批注" width="150" show-overflow-tooltip />
<el-table-column label="操作" width="120" align="center" fixed="right"> <el-table-column label="操作" width="80" align="center" fixed="right">
<template #default="scope"> <template #default="scope">
<el-button type="primary" link size="small" icon="View" @click="handlePreview(scope.row)">预览</el-button> <el-button type="primary" link size="small" icon="Download" @click="handleDownload(scope.row)">下载</el-button>
<el-button type="success" link size="small" icon="Download" @click="handleDownload(scope.row)">下载</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@@ -81,12 +80,6 @@
<template #footer> <template #footer>
<el-button @click="visible = false">关闭</el-button> <el-button @click="visible = false">关闭</el-button>
</template> </template>
<el-dialog v-model="previewVisible" :title="previewTitle" width="80%" top="5vh" destroy-on-close append-to-body>
<div class="preview-container">
<iframe v-if="previewUrl" :src="previewUrl" class="preview-iframe" />
</div>
</el-dialog>
</el-dialog> </el-dialog>
</template> </template>
@@ -94,8 +87,9 @@
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import { DocumentChecked } from '@element-plus/icons-vue'; import { DocumentChecked } from '@element-plus/icons-vue';
import { useMessage } from '/@/hooks/message'; 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 { getFlowPurchaseDetail } from '/@/api/purchase/bidfile';
import other from '/@/utils/other';
const FlowCommentTimeline = defineAsyncComponent(() => import('/@/views/jsonflow/comment/timeline.vue')); const FlowCommentTimeline = defineAsyncComponent(() => import('/@/views/jsonflow/comment/timeline.vue'));
@@ -114,9 +108,6 @@ const visible = ref(false);
const applyId = ref(''); const applyId = ref('');
const applyData = ref<any>({}); const applyData = ref<any>({});
const docList = ref<DocItem[]>([]); const docList = ref<DocItem[]>([]);
const previewVisible = ref(false);
const previewTitle = ref('');
const previewUrl = ref('');
const fileFlowJob = computed(() => { const fileFlowJob = computed(() => {
if (!applyData.value.fileFlowInstId) return null; if (!applyData.value.fileFlowInstId) return null;
@@ -154,7 +145,7 @@ const open = async (id: string, row?: any) => {
const docs = docsRes?.data || []; const docs = docsRes?.data || [];
if (Array.isArray(docs) && docs.length > 0) { if (Array.isArray(docs) && docs.length > 0) {
docList.value = docs.map((d: any) => ({ docList.value = docs.map((d: any) => ({
id: d.id || d.fileId, id: d.fileId, // 使用 fileId 关联 PurchasingFiles 表,用于下载
fileName: d.fileName || d.fileTitle || '招标文件', fileName: d.fileName || d.fileTitle || '招标文件',
fileUrl: d.fileUrl, fileUrl: d.fileUrl,
createTime: d.createTime, 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) { if (!row.id) {
useMessage().warning('文件ID不存在'); useMessage().warning('文件ID不存在');
return; return;
} }
try { const downloadUrl = '/purchase/purchasingfiles/downloadById?fileId=' + row.id;
const blob = await previewFileById(row.id); other.downBlobFile(downloadUrl, {}, row.fileName || '招标文件');
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 emit = defineEmits<{ const emit = defineEmits<{
@@ -249,17 +212,6 @@ defineExpose({
font-weight: 500; font-weight: 500;
} }
.preview-container {
width: 100%;
height: 75vh;
}
.preview-iframe {
width: 100%;
height: 100%;
border: none;
}
:deep(.el-card__header) { :deep(.el-card__header) {
padding: 12px 16px; padding: 12px 16px;
} }