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

优化getColSpanJson

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