From 3cf56a6b4c65590b602e87ed903ddd9aa1cbe5a9 Mon Sep 17 00:00:00 2001 From: zhoutianchi <1305666981@qq.com> Date: Tue, 6 Jan 2026 22:09:04 +0800 Subject: [PATCH] 1 --- package.json | 1 - src/excel/Export2Excel.js | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 7dc922b..936b248 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,6 @@ "driver.js": "^0.9.8", "echarts": "^5.4.1", "element-plus": "2.5.5", - "file-saver": "^2.0.5", "form-create-designer": "3.2.11-oem", "highlight.js": "^11.7.0", "html-to-image": "^1.11.13", diff --git a/src/excel/Export2Excel.js b/src/excel/Export2Excel.js index 33c6493..6babf2f 100644 --- a/src/excel/Export2Excel.js +++ b/src/excel/Export2Excel.js @@ -1,6 +1,6 @@ /* eslint-disable */ -import { saveAs } from 'file-saver' -import * as XLSX from 'xlsx' +// import { saveAs } from 'file-saver' +// import * as XLSX from 'xlsx' // 现代浏览器已原生支持 Blob,不需要 polyfill // 如果需要支持旧浏览器,可以取消下面的注释 // import '/@/excel/Blob.js' @@ -62,21 +62,21 @@ function sheet_from_array_of_arrays(data, opts) { if (range.e.c < C) range.e.c = C; var cell = {v: data[R][C]}; if (cell.v == null) continue; - var cell_ref = XLSX.utils.encode_cell({c: C, r: R}); + // var cell_ref = XLSX.utils.encode_cell({c: C, r: R}); if (typeof cell.v === 'number') cell.t = 'n'; else if (typeof cell.v === 'boolean') cell.t = 'b'; else if (cell.v instanceof Date) { - cell.t = 'n'; - cell.z = XLSX.SSF._table[14]; - cell.v = datenum(cell.v); + // cell.t = 'n'; + // cell.z = XLSX.SSF._table[14]; + // cell.v = datenum(cell.v); } else cell.t = 's'; ws[cell_ref] = cell; } } - if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range); + // if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range); return ws; } @@ -114,9 +114,9 @@ export function export_table_to_excel(id) { wb.SheetNames.push(ws_name); wb.Sheets[ws_name] = ws; - var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'}); + // var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'}); - saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), "test.xlsx") + // saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), "test.xlsx") } function formatJson(jsonData) { @@ -137,7 +137,7 @@ export function export_json_to_excel(th, jsonData, defaultTitle) { wb.SheetNames.push(ws_name); wb.Sheets[ws_name] = ws; - var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'}); + // var wbout = XLSX.write(wb, {bookType: 'xlsx', bookSST: false, type: 'binary'}); var title = defaultTitle || '列表' saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), title + ".xlsx") }