Merge branch 'developer' of ssh://code.cyweb.top:30033/scj/zhxy/v3/cloud-ui into developer

This commit is contained in:
guochunsi
2026-01-07 16:18:00 +08:00
5 changed files with 171 additions and 12 deletions

View File

@@ -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")
}

View File

@@ -82,7 +82,7 @@ import { list } from '/@/api/gen/datasource';
import { useMessage } from '/@/hooks/message';
import { useI18n } from 'vue-i18n';
import { validateNull } from '/@/utils/validate';
import BatchGenDialog from './BatchGenDialog.vue';
import BatchGenDialog from './batchGenDialog.vue';
import { ElMessage } from 'element-plus';
// 定义变量内容