From 0dab1ffa79d413baa181623f5da4a420f5001cf5 Mon Sep 17 00:00:00 2001 From: xuliangzhan <xlz26296x@163.com> Date: Mon, 2 Dec 2024 10:36:29 +0800 Subject: [PATCH] releases 3.11.15 --- package.json | 2 +- packages/table/module/export/mixin.ts | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index a0baf6da0c..b65b979639 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vxe-table", - "version": "3.11.14", + "version": "3.11.15", "description": "一个基于 vue 的 PC 端表格组件,支持增删改查、虚拟树、拖拽排序,懒加载、快捷菜单、数据校验、树形结构、打印、导入导出、自定义模板、渲染器、JSON 配置式...", "scripts": { "update": "npm install --legacy-peer-deps", diff --git a/packages/table/module/export/mixin.ts b/packages/table/module/export/mixin.ts index 8473551c36..0181870702 100644 --- a/packages/table/module/export/mixin.ts +++ b/packages/table/module/export/mixin.ts @@ -66,7 +66,7 @@ function toBooleanValue (cellValue: any) { return XEUtils.isBoolean(cellValue) ? (cellValue ? 'TRUE' : 'FALSE') : cellValue } -function getLabelData ($xetable: any, opts: any, columns: any[], datas: any[]) { +function getBodyLabelData ($xetable: any, opts: any, columns: any[], datas: any[]) { const { isAllExpand, mode } = opts const { treeConfig, treeOpts, radioOpts, checkboxOpts, columnOpts } = $xetable const childrenField = treeOpts.children || treeOpts.childrenField @@ -152,15 +152,18 @@ function getLabelData ($xetable: any, opts: any, columns: any[], datas: any[]) { columns.forEach((column, $columnIndex) => { let cellValue = '' const renderOpts = column.editRender || column.cellRender - let exportLabelMethod = column.exportMethod - if (!exportLabelMethod && renderOpts && renderOpts.name) { + let bodyExportMethod = column.exportMethod + if (!bodyExportMethod && renderOpts && renderOpts.name) { const compConf = renderer.get(renderOpts.name) if (compConf) { - exportLabelMethod = compConf.tableExportMethod || compConf.exportMethod || (compConf as any).cellExportMethod + bodyExportMethod = compConf.tableExportMethod || compConf.exportMethod || (compConf as any).cellExportMethod } } - if (exportLabelMethod) { - cellValue = exportLabelMethod({ $table: $xetable, row, column, options: opts }) + if (!bodyExportMethod) { + bodyExportMethod = columnOpts.exportMethod + } + if (bodyExportMethod) { + cellValue = bodyExportMethod({ $table: $xetable, row, column, options: opts }) } else { switch (column.type) { case 'seq': { @@ -207,7 +210,7 @@ function getExportData ($xetable: any, opts: any) { if (dataFilterMethod) { datas = datas.filter((row: any, index: any) => dataFilterMethod({ row, $rowIndex: index })) } - return getLabelData($xetable, opts, columns, datas) + return getBodyLabelData($xetable, opts, columns, datas) } function getBooleanValue (cellValue: any) {