mirror of
https://gitee.com/ssssssss-team/magic-boot.git
synced 2026-05-15 00:00:02 +08:00
用户增加导出、操作日志添加条件,导出、修复svg无法设置fill属性问题等
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import request from '@/scripts/request'
|
||||
import { ElMessageBox, ElNotification } from 'element-plus'
|
||||
import global from '@/scripts/global'
|
||||
import { utils, writeFile } from 'xlsx'
|
||||
|
||||
const common = {}
|
||||
|
||||
@@ -175,4 +176,12 @@ common.isComma = (value) => {
|
||||
return value.toString().indexOf(',') !== -1
|
||||
}
|
||||
|
||||
common.exportExcel = (options) => {
|
||||
options.suffix = options.suffix || 'xlsx'
|
||||
const workBook = utils.json_to_sheet(options.data);
|
||||
const wb = utils.book_new()
|
||||
utils.book_append_sheet(wb, workBook, 'sheet1');
|
||||
writeFile(wb, `${options.fileName}.${options.suffix || 'xlsx'}`);
|
||||
}
|
||||
|
||||
export default common
|
||||
|
||||
Reference in New Issue
Block a user