提交 8357a806 authored 作者: yaoxinguo's avatar yaoxinguo

优化getColSpanJson

上级 9598bcfc
...@@ -18,7 +18,9 @@ const apiUrl = queryOauthActionPath(); ...@@ -18,7 +18,9 @@ const apiUrl = queryOauthActionPath();
* 返回值 * 返回值
* rowSpanData 列合并数据,colSpanData行合并数据 * rowSpanData 列合并数据,colSpanData行合并数据
* */ * */
export function getSpanJson(mergeKey, data, eliminateRow = [], eliminateCol = []) { export function getSpanJson({
mergeKey, data, eliminateRow = [], eliminateCol = []
}) {
try { try {
return { return {
rowSpanData: getRowSpanJson(mergeKey, data, eliminateRow), rowSpanData: getRowSpanJson(mergeKey, data, eliminateRow),
...@@ -106,6 +108,8 @@ function getColSpanJson(cloumnNames, data, eliminateStr = []) { ...@@ -106,6 +108,8 @@ function getColSpanJson(cloumnNames, data, eliminateStr = []) {
colSpanJson[triggerColIndex][idx] = triggerColSum; colSpanJson[triggerColIndex][idx] = triggerColSum;
colSpanJson[keyItem][idx] = 0; colSpanJson[keyItem][idx] = 0;
triggerColIndex = null; triggerColIndex = null;
} else if(isCol && triggerColIndex !== null ) {
colSpanJson[keyItem][idx] = 0;
} else { } else {
colSpanJson[keyItem][idx] = colSum; colSpanJson[keyItem][idx] = colSum;
} }
...@@ -306,7 +310,8 @@ export function getColumnsSqlKeyRealize({ ...@@ -306,7 +310,8 @@ export function getColumnsSqlKeyRealize({
* fileName : 导出文件名 * fileName : 导出文件名
* ext : 导出后缀 目前xecl、dbf * ext : 导出后缀 目前xecl、dbf
* url : 接口地址 * url : 接口地址
* eliminateStr : 忽略合并的值 * eliminateRow : 列需要忽略合并的数据
* eliminateCol : 行需要忽略合并的数据
* 返回值 * 返回值
* */ * */
export function getColumnsDataRealize({ export function getColumnsDataRealize({
...@@ -317,10 +322,11 @@ export function getColumnsDataRealize({ ...@@ -317,10 +322,11 @@ export function getColumnsDataRealize({
defect = null, defect = null,
fileName = '导出文件', fileName = '导出文件',
ext = 'xlsx', ext = 'xlsx',
eliminateStr = [], eliminateRow = [],
eliminateCol = [],
}) { }) {
let { columnsList, columnsMerges, columnsKey, columnsHeight } = getColumns(columns); let { columnsList, columnsMerges, columnsKey, columnsHeight } = getColumns(columns);
let { colSpanData, rowSpanData } = getSpanJson(mergeKey, data, eliminateStr); let { colSpanData, rowSpanData } = getSpanJson({ mergeKey, data, eliminateRow, eliminateCol });
// 处理数据 // 处理数据
let bodyData = []; let bodyData = [];
let dataMerges = []; let dataMerges = [];
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论