From 011940e004ac9800499b1eccf6c248604197fa0e Mon Sep 17 00:00:00 2001 From: fanluyan <754122931@qq.com> Date: Tue, 19 Dec 2023 15:34:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/htmlToExcel.js | 30 +++++++++++++++++++-- src/views/activityList/index.vue | 10 ++----- src/views/homePage/components/tableMain.vue | 5 ++-- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/utils/htmlToExcel.js b/src/utils/htmlToExcel.js index 5c6f951..25bdd68 100644 --- a/src/utils/htmlToExcel.js +++ b/src/utils/htmlToExcel.js @@ -9,8 +9,8 @@ const htmlToExcel = { const month = time.getMonth() + 1; const day = time.getDate(); const name = year + "-" + month + "-" + day; - - const wb = XLSX.utils.table_to_book(document.querySelector(dom)); + var xlsxParam = { raw: true }; //转换成excel时,使用原始的格式 + const wb = XLSX.utils.table_to_book(document.querySelector(dom), xlsxParam); /* 获取二进制字符串作为输出 */ const wbout = XLSX.write(wb, { bookType: "xlsx", @@ -30,3 +30,29 @@ const htmlToExcel = { }; export default htmlToExcel; +// import FileSaver from "file-saver"; +// import XLSX from "xlsx"; + +// const htmlToExcel = { +// getExcel(dom, title = "表格") { +// var excelTitle = title; +// var wb = XLSX.utils.table_to_book(document.querySelector(dom)); +// /* 获取二进制字符串作为输出 */ +// var wbout = XLSX.write(wb, { +// bookType: "xlsx", +// bookSST: true, +// type: "array", +// }); +// try { +// FileSaver.saveAs( +// new Blob([wbout], { type: "application/octet-stream" }), +// excelTitle + ".xlsx" +// ); +// } catch (e) { +// if (typeof console !== "undefined") console.log(e, wbout); +// } +// return wbout; +// }, +// }; + +// export default htmlToExcel; diff --git a/src/views/activityList/index.vue b/src/views/activityList/index.vue index cb8e546..a10ea9a 100644 --- a/src/views/activityList/index.vue +++ b/src/views/activityList/index.vue @@ -195,15 +195,9 @@ export default { message: "文件删除成功", type: "success", }); - this.getUpgradeList(); + this.getactivityList(); }) - .catch(() => { - this.$message({ - type: "info", - showClose: true, - message: "已取消删除", - }); - }); + .catch(() => {}); }) .catch((err) => {}); }, diff --git a/src/views/homePage/components/tableMain.vue b/src/views/homePage/components/tableMain.vue index e6c8d1b..a3ecf91 100644 --- a/src/views/homePage/components/tableMain.vue +++ b/src/views/homePage/components/tableMain.vue @@ -418,7 +418,7 @@