优化导出

This commit is contained in:
xuliangzhan
2023-07-08 12:31:12 +08:00
parent 4cee79d80a
commit c33b5f8f94
2 changed files with 6 additions and 4 deletions

View File

@@ -117,6 +117,7 @@ function exportXLSX (params: InterceptorExportParams) {
const { $vxe, rowHeight, headerAlign: allHeaderAlign, align: allAlign, footerAlign: allFooterAlign } = $table
const { modal, t } = $vxe
const { message, sheetName, isHeader, isFooter, isMerge, isColgroup, original, useStyle, sheetMethod } = options
const _isCustomColumn: boolean = (options as any)._isCustomColumn
const showMsg = message !== false
const mergeCells = $table.getMergeCells()
const colList: any[] = []
@@ -162,7 +163,7 @@ function exportXLSX (params: InterceptorExportParams) {
beforeRowCount += colList.length
}
// 处理合并
if (isMerge) {
if (isMerge && !_isCustomColumn) {
mergeCells.forEach(mergeItem => {
const { row: mergeRowIndex, rowspan: mergeRowspan, col: mergeColIndex, colspan: mergeColspan } = mergeItem
sheetMerges.push({
@@ -185,7 +186,7 @@ function exportXLSX (params: InterceptorExportParams) {
const footers = getFooterData(options, footerData)
const mergeFooterItems = $table.getMergeFooterItems()
// 处理合并
if (isMerge) {
if (isMerge && !_isCustomColumn) {
mergeFooterItems.forEach(mergeItem => {
const { row: mergeRowIndex, rowspan: mergeRowspan, col: mergeColIndex, colspan: mergeColspan } = mergeItem
sheetMerges.push({
@@ -282,7 +283,8 @@ function exportXLSX (params: InterceptorExportParams) {
})
})
}
if (useStyle && sheetMethod) {
// 自定义处理
if (sheetMethod) {
const sParams = { options: options as any, workbook, worksheet: sheet, columns, colgroups, datas, $table }
sheetMethod(sParams)
}

View File

@@ -1,6 +1,6 @@
{
"name": "vxe-table-plugin-export-xlsx",
"version": "2.2.3",
"version": "2.2.4",
"description": "基于 vxe-table 的表格插件,支持导出 xlsx 格式",
"scripts": {
"lib": "gulp build"