From a24122ecd743aeced3312cd598dbaf26691fca7b Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 12 Mar 2025 11:09:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20PCAP=E6=96=87=E4=BB=B6=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E4=B8=8B=E8=BD=BD=E7=9B=AE=E5=BD=95=E4=B8=BAZIP?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/locales/en-US.ts | 1 + src/i18n/locales/zh-CN.ts | 1 + src/views/traceManage/pcap/file.vue | 52 +++++++++++++++++++++++++++-- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 3b11a0fa..df52925a 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -1211,6 +1211,7 @@ export default { size: "Size", modifiedTime: "Modified Time", fileName: "File Name", + downTipZip: "Confirm downloading the directory [{fileName}] as a ZIP file?", downTip: "Confirm the download file name is [{fileName}] File?", downTipErr: "Failed to get file", dirCd: "Enter Dir", diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index 668da021..f507ed8e 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -1211,6 +1211,7 @@ export default { size: "文件大小", modifiedTime: "修改时间", fileName: "文件名称", + downTipZip: "确认将目录 【{fileName}】 下载为ZIP文件?", downTip: "确认下载文件名为 【{fileName}】 文件?", downTipErr: "文件获取失败", dirCd: "进入目录", diff --git a/src/views/traceManage/pcap/file.vue b/src/views/traceManage/pcap/file.vue index 6503ecc6..8a627141 100644 --- a/src/views/traceManage/pcap/file.vue +++ b/src/views/traceManage/pcap/file.vue @@ -5,7 +5,7 @@ import { SizeType } from 'ant-design-vue/es/config-provider'; import { ColumnsType } from 'ant-design-vue/es/table'; import { Modal, message } from 'ant-design-vue/es'; import { parseDateToStr } from '@/utils/date-utils'; -import { getNeFile, listNeFiles } from '@/api/tool/neFile'; +import { getNeDirZip, getNeFile, listNeFiles } from '@/api/tool/neFile'; import { RESULT_CODE_SUCCESS } from '@/constants/result-constants'; import ViewDrawer from '@/views/logManage/neFile/components/ViewDrawer.vue'; import useNeInfoStore from '@/store/modules/neinfo'; @@ -79,7 +79,7 @@ let tableColumns: ColumnsType = reactive([ if (!opt.value) return ''; return parseDateToStr(opt.value * 1000); }, - width: 150, + width: 200, }, { title: t('views.logManage.neFile.fileName'), @@ -168,6 +168,45 @@ function fnDownloadFile(row: Record) { }); } +/**信息文件下载 */ +function fnDownloadFileZIP(row: Record) { + if (downLoading.value) return; + Modal.confirm({ + title: t('common.tipTitle'), + content: t('views.logManage.neFile.downTipZip', { fileName: row.fileName }), + onOk() { + downLoading.value = true; + const hide = message.loading(t('common.loading'), 0); + getNeDirZip({ + neType: queryParams.neType, + neId: queryParams.neId, + path: `${queryParams.path}/${row.fileName}`, + delTemp: true, + }) + .then(res => { + if (res.code === RESULT_CODE_SUCCESS) { + message.success({ + content: t('common.msgSuccess', { + msg: t('common.downloadText'), + }), + duration: 2, + }); + saveAs(res.data, `${row.fileName}.zip`); + } else { + message.error({ + content: t('views.logManage.neFile.downTipErr'), + duration: 2, + }); + } + }) + .finally(() => { + hide(); + downLoading.value = false; + }); + }, + }); +} + /**tmp目录下,UPF标准版内部输出目录 */ let tmp = ref(false); @@ -404,6 +443,15 @@ onMounted(() => { {{ t('common.downloadText') }} + + + {{ t('common.downloadText') }} +