|
@@ -819,13 +819,85 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
}
|
|
|
return rst;
|
|
|
};
|
|
|
- JpcFlowTabResult.combinePageCells = function (rptTpl, pageCells) {
|
|
|
- let me = this;
|
|
|
- let FLOW_NODE_STR = me.isEx?JV.NODE_FLOW_INFO_EX:JV.NODE_FLOW_INFO;
|
|
|
- let tab = rptTpl[FLOW_NODE_STR][JV.NODE_FLOW_CONTENT];
|
|
|
- let tab_fields = tab[JV.PROP_FLOW_FIELDS];
|
|
|
- for (let tabField of tab_fields) {
|
|
|
- // tabField[JV.PROP_]
|
|
|
+ JpcFlowTabResult.combinePageCells = function (rstPageCells, verticalCombinePos, horizonCombinePos) {
|
|
|
+ // let me = this;
|
|
|
+ if (verticalCombinePos.length > 0 || horizonCombinePos.length > 1) {
|
|
|
+ let cacheObj = {vCache:{}, hCache: {}, hCacheStr: []};
|
|
|
+ let removeCellIds = [];
|
|
|
+ for (let vPosArr of verticalCombinePos) {
|
|
|
+ let pStr = "_" + vPosArr[0] + "_" + vPosArr[1];
|
|
|
+ cacheObj.vCache[pStr] = [];
|
|
|
+ }
|
|
|
+ //horizonCombinePos不需要预记
|
|
|
+ for (let idx = 0; idx < rstPageCells.length; idx++) {
|
|
|
+ let cell = rstPageCells[idx];
|
|
|
+ for (let vPosArr of verticalCombinePos) {
|
|
|
+ if (cell[JV.PROP_AREA][JV.PROP_LEFT] === vPosArr[0] && cell[JV.PROP_AREA][JV.PROP_RIGHT] === vPosArr[1]) {
|
|
|
+ cacheObj.vCache["_" + vPosArr[0] + "_" + vPosArr[1]].push(idx);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (let hPosArr of horizonCombinePos) {
|
|
|
+ if (cell[JV.PROP_AREA][JV.PROP_LEFT] === hPosArr[0] && cell[JV.PROP_AREA][JV.PROP_RIGHT] === hPosArr[1]) {
|
|
|
+ let hpStr = "_" + cell[JV.PROP_AREA][JV.PROP_TOP] + "_" + cell[JV.PROP_AREA][JV.PROP_BOTTOM];
|
|
|
+ if (cacheObj.hCacheStr.indexOf(hpStr) < 0) {
|
|
|
+ cacheObj.hCache[hpStr] = [];
|
|
|
+ cacheObj.hCacheStr.push(hpStr);
|
|
|
+ }
|
|
|
+ cacheObj.hCache[hpStr].push(idx);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (verticalCombinePos.length > 0) {
|
|
|
+ for (let vPosArr of verticalCombinePos) {
|
|
|
+ let pStr = "_" + vPosArr[0] + "_" + vPosArr[1];
|
|
|
+ //rstPageCells的结果已经是按顺序排列了,这里不用再排序
|
|
|
+ if (cacheObj.vCache[pStr] && cacheObj.vCache[pStr].length > 0) {
|
|
|
+ let preCell = rstPageCells[cacheObj.vCache[pStr][0]];
|
|
|
+ for (let cIdx = 1; cIdx < cacheObj.vCache[pStr].length; cIdx++) {
|
|
|
+ if (preCell.Value === "") {
|
|
|
+ preCell = rstPageCells[cacheObj.vCache[pStr][cIdx]];
|
|
|
+ } else {
|
|
|
+ if (preCell.Value === rstPageCells[cacheObj.vCache[pStr][cIdx]].Value) {
|
|
|
+ preCell[JV.PROP_AREA][JV.PROP_BOTTOM] = rstPageCells[cacheObj.vCache[pStr][cIdx]][JV.PROP_AREA][JV.PROP_BOTTOM];
|
|
|
+ removeCellIds.push(cacheObj.vCache[pStr][cIdx]);
|
|
|
+ } else {
|
|
|
+ preCell = rstPageCells[cacheObj.vCache[pStr][cIdx]];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (horizonCombinePos.length > 1) {
|
|
|
+ if (cacheObj.hCacheStr.length > 0) {
|
|
|
+ for (let hStr of cacheObj.hCacheStr) {
|
|
|
+ let preCell = rstPageCells[cacheObj.hCache[hStr][0]];
|
|
|
+ for (let cIdx = 1; cIdx < cacheObj.hCache[hStr].length; cIdx++) {
|
|
|
+ if (preCell.Value === "") {
|
|
|
+ preCell = rstPageCells[cacheObj.hCache[hStr][cIdx]];
|
|
|
+ } else {
|
|
|
+ if (preCell.Value === rstPageCells[cacheObj.hCache[hStr][cIdx]].Value) {
|
|
|
+ if (preCell[JV.PROP_AREA][JV.PROP_RIGHT] < rstPageCells[cacheObj.hCache[hStr][cIdx]][JV.PROP_AREA][JV.PROP_RIGHT]) {
|
|
|
+ preCell[JV.PROP_AREA][JV.PROP_RIGHT] = rstPageCells[cacheObj.hCache[hStr][cIdx]][JV.PROP_AREA][JV.PROP_RIGHT];
|
|
|
+ } else {
|
|
|
+ preCell[JV.PROP_AREA][JV.PROP_LEFT] = rstPageCells[cacheObj.hCache[hStr][cIdx]][JV.PROP_AREA][JV.PROP_LEFT];
|
|
|
+ }
|
|
|
+ removeCellIds.push(cacheObj.hCache[hStr][cIdx]);
|
|
|
+ } else {
|
|
|
+ preCell = rstPageCells[cacheObj.hCache[hStr][cIdx]];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (removeCellIds.length > 0) {
|
|
|
+ //这次真的要排序了
|
|
|
+ removeCellIds.sort(); //默认方式即可
|
|
|
+ for (let idx = removeCellIds.length - 1; idx >= 0; idx--) {
|
|
|
+ rstPageCells.splice(removeCellIds[idx], 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
JpcFlowTabResult.outputPreviewContent = function(rptTpl, bands, unitFactor, controls, pageStatus, maxRec) {
|
|
@@ -852,6 +924,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
let FLOW_NODE_STR = me.isEx?JV.NODE_FLOW_INFO_EX:JV.NODE_FLOW_INFO;
|
|
|
let tab = rptTpl[FLOW_NODE_STR][JV.NODE_FLOW_CONTENT];
|
|
|
let tabEx = (rptTpl[JV.NODE_FLOW_INFO_EX])?rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_CONTENT]:null;
|
|
|
+ let verticalCombinePos = [], horizonCombinePos = []; //合并特性用
|
|
|
let band = bands[tab[JV.PROP_BAND_NAME]];
|
|
|
if (band) {
|
|
|
let pageStatus = me.pageStatusLst[page - 1];
|
|
@@ -928,6 +1001,17 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if (rowIdx === 0 && tab_field[JV.PROP_COMBINE_TYPE] !== undefined && tab_field[JV.PROP_COMBINE_TYPE] !== null) {
|
|
|
+ let rstCellItem = rst[rst.length - 1];
|
|
|
+ let cbfPos = [];
|
|
|
+ cbfPos.push(rstCellItem[JV.PROP_AREA][JV.PROP_LEFT]);
|
|
|
+ cbfPos.push(rstCellItem[JV.PROP_AREA][JV.PROP_RIGHT]);
|
|
|
+ if (tab_field[JV.PROP_COMBINE_TYPE] === 'vertical') {
|
|
|
+ verticalCombinePos.push(cbfPos);
|
|
|
+ } else if (tab_field[JV.PROP_COMBINE_TYPE] === 'horizon') {
|
|
|
+ horizonCombinePos.push(cbfPos);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (contentValuesIdx[rowIdx][0] === JV.TYPE_FOLLOW_MODE) {
|
|
|
for (let idx_ex = 0; idx_ex < tab_fields_ex.length; idx_ex++) {
|
|
@@ -1015,6 +1099,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
for (let idIdx = eliminateCells.length - 1; idIdx >= 0; idIdx--) {
|
|
|
rst.splice(eliminateCells[idIdx], 1);
|
|
|
}
|
|
|
+ me.combinePageCells(rst, verticalCombinePos, horizonCombinePos);
|
|
|
return rst;
|
|
|
};
|
|
|
JpcFlowTabResult.outputColumn = function (rptTpl, dataObj, page, segIdx, bands, unitFactor, multiColIdx) {
|