From a44fa906bd8b8fada59864816d54600c4ba4c7f3 Mon Sep 17 00:00:00 2001 From: Silent YANG Date: Fri, 28 Jun 2024 00:42:50 +0800 Subject: [PATCH] update --- src/views/list/search-table/index.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/views/list/search-table/index.vue b/src/views/list/search-table/index.vue index 8fb7d75..2b6c873 100644 --- a/src/views/list/search-table/index.vue +++ b/src/views/list/search-table/index.vue @@ -110,7 +110,7 @@ import { useAppStore } from '@/store'; import { MoveIcon } from 'tdesign-icons-vue-next'; import Chinese from 'chinese-s2t'; - import { read as xlsxRead, writeFile as xlsxWrite, utils as xlsxUtils } from "xlsx"; + import { read as xlsxRead, writeXLSX } from "xlsx"; import { useI18n } from 'vue-i18n'; const { t } = useI18n(); @@ -864,7 +864,13 @@ worksheet['T' + i].v = cstate.renderData[i - 2]?.scanlist.join(',') } } - xlsxWrite(workbook, 'K5Channel.xlsx'); + const blob = new Blob([writeXLSX(workbook, { type: 'buffer' })], { type: 'application/octet-stream' }); + const a = document.createElement('a'); + a.href = URL.createObjectURL(blob); + a.download = 'K5Channel.xlsx'; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); } const restoreExcelChannel = () => {