From 00a005e65f766f156d17468b15fcf6f6422e3a3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E7=BA=A2=E5=85=B5?= <374362909@qq.com> Date: Sun, 8 Feb 2026 23:39:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=87=87=E8=B4=AD=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E6=96=87=E4=BB=B6=E5=BD=92=E6=A1=A3=E6=89=93=E5=8C=85?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/finance/purchasingrequisition.ts | 8 ++++++ .../finance/purchasingrequisition/index.vue | 26 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/api/finance/purchasingrequisition.ts b/src/api/finance/purchasingrequisition.ts index d9f9cb3..042bcb8 100644 --- a/src/api/finance/purchasingrequisition.ts +++ b/src/api/finance/purchasingrequisition.ts @@ -174,3 +174,11 @@ export function getDeptMembers() { }); } +/** + * 文件归档:按文件类型打包下载该申请单下所有附件的下载地址(GET 请求,浏览器直接下载 zip) + * @param purchaseId 采购申请ID + */ +export function getArchiveDownloadUrl(purchaseId: string | number) { + return `/purchase/purchasingfiles/archive?purchaseId=${encodeURIComponent(String(purchaseId))}`; +} + diff --git a/src/views/finance/purchasingrequisition/index.vue b/src/views/finance/purchasingrequisition/index.vue index 146364b..f3cc766 100644 --- a/src/views/finance/purchasingrequisition/index.vue +++ b/src/views/finance/purchasingrequisition/index.vue @@ -336,11 +336,12 @@ import { ref, reactive, defineAsyncComponent, onMounted } from 'vue' import { useRouter } from 'vue-router' import { BasicTableProps, useTable } from "/@/hooks/table"; -import { getPage, delObj, submitObj } from "/@/api/finance/purchasingrequisition"; +import { getPage, delObj, submitObj, getArchiveDownloadUrl } from "/@/api/finance/purchasingrequisition"; import { useMessage, useMessageBox } from "/@/hooks/message"; import { getDicts } from '/@/api/admin/dict'; import { getTree } from '/@/api/finance/purchasingcategory'; -import { List, Document, DocumentCopy, Search, Collection, Money, CircleCheck, InfoFilled, Calendar, OfficeBuilding, Warning, DocumentChecked, Edit, Delete, Upload } from '@element-plus/icons-vue' +import { List, Document, DocumentCopy, Search, Collection, Money, CircleCheck, InfoFilled, Calendar, OfficeBuilding, Warning, DocumentChecked, Edit, Delete, Upload, FolderOpened } from '@element-plus/icons-vue' +import other from '/@/utils/other' // 引入组件 const FormDialog = defineAsyncComponent(() => import('./form.vue')); @@ -536,6 +537,12 @@ const getActionMenuItems = (row: any) => { icon: Upload, visible: () => isTemp, }, + { + command: 'archive', + label: '文件归档', + icon: FolderOpened, + visible: () => true, + }, ]; }; @@ -557,9 +564,24 @@ const handleMoreCommand = (command: string, row: any) => { case 'implement': handleImplement(row); break; + case 'archive': + handleArchive(row); + break; } }; +/** 文件归档:按文件类型打包下载该申请单下所有附件 */ +const handleArchive = (row: any) => { + const id = row?.id ?? row?.purchaseId; + if (id == null || id === '') { + useMessage().warning('无法获取申请单ID'); + return; + } + const url = getArchiveDownloadUrl(id); + const fileName = `归档_${row?.purchaseNo || id}.zip`; + other.downBlobFile(url, {}, fileName); +}; + // 获取字典数据和品目树数据 const loadDictData = async () => { try {