修改测试问题
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { buildExportBaseName, type ExportFileNameOptions } from '@/utils/echartMethod'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { nextTick } from 'vue'
|
||||
import { exportExcel } from '@/views/system/reportForms/export.js'
|
||||
@@ -12,6 +13,10 @@ export function parseLuckysheetSheets(sheets: any[]) {
|
||||
/* ignore invalid json */
|
||||
}
|
||||
}
|
||||
if (!item.config) item.config = {}
|
||||
if (item.row == null) item.row = 36
|
||||
if (item.column == null) item.column = 18
|
||||
if (!item.data) item.data = []
|
||||
item.celldata?.forEach((cell: any) => {
|
||||
if (item.data?.[cell.r]?.[cell.c]?.v != null) {
|
||||
item.data[cell.r][cell.c] = cell.v
|
||||
@@ -47,10 +52,15 @@ export function renderLuckysheetReport(
|
||||
sheets: any[],
|
||||
options: Record<string, any> = {}
|
||||
) {
|
||||
if (!Array.isArray(sheets) || sheets.length === 0) {
|
||||
destroyLuckysheet()
|
||||
return
|
||||
}
|
||||
parseLuckysheetSheets(sheets)
|
||||
destroyLuckysheet()
|
||||
nextTick(() => {
|
||||
requestAnimationFrame(() => {
|
||||
if (!document.getElementById(container)) return
|
||||
luckysheet.create({
|
||||
container,
|
||||
...DEFAULT_REPORT_OPTIONS,
|
||||
@@ -62,7 +72,7 @@ export function renderLuckysheetReport(
|
||||
}
|
||||
|
||||
/** 安全导出 Luckysheet,无数据时提示并返回 false */
|
||||
export function exportLuckysheetFile(filename: string, hasData = true): boolean {
|
||||
export function exportLuckysheetFile(filenameOrOptions: string | ExportFileNameOptions, hasData = true): boolean {
|
||||
if (!hasData) {
|
||||
ElMessage.warning('暂无数据')
|
||||
return false
|
||||
@@ -77,6 +87,8 @@ export function exportLuckysheetFile(filename: string, hasData = true): boolean
|
||||
ElMessage.warning('暂无数据')
|
||||
return false
|
||||
}
|
||||
const filename =
|
||||
typeof filenameOrOptions === 'string' ? filenameOrOptions : buildExportBaseName(filenameOrOptions)
|
||||
exportExcel(sheets, filename)
|
||||
ElMessage.success('生成成功')
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user