|
@@ -29,6 +29,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
grp_lines = grpPageInfo[JV.PROP_GRP_LINES];
|
|
|
}
|
|
|
let autoHeightAmt = 0;
|
|
|
+ let accAmtForAutoHeight = 0;
|
|
|
let private_addAutoHeightPageValue = function (vi) {
|
|
|
let couldBreak = false, startIdx = 0;
|
|
|
let ttlValAmt = 0;
|
|
@@ -43,42 +44,48 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
for (let subValIdx = startIdx; subValIdx < ttlValAmt; subValIdx++) {
|
|
|
vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_AUTO_HEIGHT, sortedSequence[startRecIdx + vi], subValIdx, ttlValAmt]);
|
|
|
autoHeightAmt++;
|
|
|
+ accAmtForAutoHeight++;
|
|
|
if (autoHeightAmt >= maxRecPerPage) {
|
|
|
nextPageAutoHeightRecAmt = (subValIdx + 1) % ttlValAmt;
|
|
|
couldBreak = true;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ accAmtForAutoHeight--;
|
|
|
+ return couldBreak;
|
|
|
+ }
|
|
|
+ let private_inner_add_grp_rec = function(vi) {
|
|
|
+ let hasFullGrp = true, couldBreak = false;
|
|
|
+ for (let i = 0; i < grp_lines; i++) {
|
|
|
+ if ( ((vi + insertedGrpAmt * grp_lines) + i + 1) >= (maxRecPerPage - preAmt)) {
|
|
|
+ for (let j = i; j < grp_lines; j++) {
|
|
|
+ grpPageInfo[JV.PROP_PRE_ADD_GRP_REC_INFO].push(j);
|
|
|
+ }
|
|
|
+ //准备要跳出去了
|
|
|
+ hasFullGrp = false;
|
|
|
+ break;
|
|
|
+ } else {
|
|
|
+ vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_GROUP, grpPageInfo[JV.PROP_SEG_GRP_IDX], i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //3. 进位下一个group信息所在位置
|
|
|
+ if (hasFullGrp) {
|
|
|
+ grpPageInfo[JV.PROP_INSERTED_GRP_REC]++;
|
|
|
+ insertedGrpAmt++;
|
|
|
+ grpPageInfo[JV.PROP_SEG_GRP_IDX]++;
|
|
|
+ } else {
|
|
|
+ couldBreak = true;
|
|
|
+ }
|
|
|
return couldBreak;
|
|
|
}
|
|
|
for (let vi = 0; (vi + insertedGrpAmt * grp_lines) < maxRecPerPage - preAmt; vi++) {
|
|
|
if (grpSequenceInfo && grpPageInfo) {
|
|
|
- if ((startRecIdx + vi) === grpSequenceInfo[grpPageInfo[JV.PROP_SEG_GRP_IDX]]) {
|
|
|
+ if ((startRecIdx + vi + accAmtForAutoHeight) === grpSequenceInfo[grpPageInfo[JV.PROP_SEG_GRP_IDX]]) {
|
|
|
//表示这里要插入grouping信息啦!
|
|
|
//1. 首先push正常的记录
|
|
|
vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, sortedSequence[startRecIdx + vi]]);
|
|
|
//2. 然后就要push grouping记录了
|
|
|
- let hasFullGrp = true;
|
|
|
- for (let i = 0; i < grp_lines; i++) {
|
|
|
- if ( ((vi + insertedGrpAmt * grp_lines) + i + 1) >= (maxRecPerPage - preAmt)) {
|
|
|
- for (let j = i; j < grp_lines; j++) {
|
|
|
- grpPageInfo[JV.PROP_PRE_ADD_GRP_REC_INFO].push(j);
|
|
|
- }
|
|
|
- //准备要跳出去了
|
|
|
- hasFullGrp = false;
|
|
|
- break;
|
|
|
- } else {
|
|
|
- vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_GROUP, grpPageInfo[JV.PROP_SEG_GRP_IDX], i]);
|
|
|
- }
|
|
|
- }
|
|
|
- //3. 进位下一个group信息所在位置
|
|
|
- if (hasFullGrp) {
|
|
|
- grpPageInfo[JV.PROP_INSERTED_GRP_REC]++;
|
|
|
- insertedGrpAmt++;
|
|
|
- grpPageInfo[JV.PROP_SEG_GRP_IDX]++;
|
|
|
- } else {
|
|
|
- break;
|
|
|
- }
|
|
|
+ if (private_inner_add_grp_rec(vi)) break;
|
|
|
} else {
|
|
|
if (segAutoHeightInfo && segAutoHeightInfo.length > 0) {
|
|
|
if (segAutoHeightInfo[segIdx].length > startRecIdx + vi) {
|
|
@@ -100,6 +107,9 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
if (segAutoHeightInfo[segIdx].length > startRecIdx + vi) {
|
|
|
let couldBreak = private_addAutoHeightPageValue(vi);
|
|
|
if (couldBreak) break;
|
|
|
+ // if ((startRecIdx + vi + accAmtForAutoHeight) === grpSequenceInfo[grpPageInfo[JV.PROP_SEG_GRP_IDX]] && accAmtForAutoHeight > 0) {
|
|
|
+ // if (private_inner_add_grp_rec(vi)) break;
|
|
|
+ // }
|
|
|
} else if (vIdx.length < maxRecPerPage) {
|
|
|
vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, JV.BLANK_VALUE_INDEX]);
|
|
|
}
|
|
@@ -422,7 +432,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
}
|
|
|
if (isMix) {
|
|
|
//先处理上半部分
|
|
|
- private_addPageValue(me.dispValueIdxLst, me.segments[segIdx], grpSeqInfo, counterRowRec, mixSplitPoint,me.page_seg_map, segIdx, pageIdx, grpPageInfo, false, null, 0);
|
|
|
+ prePageLeftAutoHeightRecAmt = private_addPageValue(me.dispValueIdxLst, me.segments[segIdx], grpSeqInfo, counterRowRec, mixSplitPoint,me.page_seg_map, segIdx, pageIdx, grpPageInfo, false, me.auto_height_info, prePageLeftAutoHeightRecAmt);
|
|
|
for (let dv of me.dispValueIdxLst[me.dispValueIdxLst.length - 1]) {
|
|
|
private_chk_handle_rec_amt(dv, false);
|
|
|
}
|
|
@@ -439,7 +449,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
}
|
|
|
me.dispValueIdxLst.splice(me.dispValueIdxLst.length - 1, 1);
|
|
|
} else if (isFollow) {
|
|
|
- private_addPageValue(me.dispValueIdxLst, followTabEx.segments[segIdx], null, counterRowRecEx, maxRowRec, me.page_seg_map, segIdx, pageIdx, null, true, null, 0);
|
|
|
+ prePageLeftAutoHeightRecAmt = private_addPageValue(me.dispValueIdxLst, followTabEx.segments[segIdx], null, counterRowRecEx, maxRowRec, me.page_seg_map, segIdx, pageIdx, null, true, me.auto_height_info, prePageLeftAutoHeightRecAmt);
|
|
|
for (let dv of me.dispValueIdxLst[me.dispValueIdxLst.length - 1]) {
|
|
|
private_chk_handle_rec_amt(dv, true);
|
|
|
}
|
|
@@ -472,9 +482,16 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
let ttlSegRecAmtNormal = me.segments[segIdx].length + grpRecAmt; //正常的segment下的数据长度累计(含grouping data)
|
|
|
let ttlSegRecAmt = (followTabEx)?(me.segments[segIdx].length + grpRecAmt + followTabEx.segments[segIdx].length + grpRecAmtEx):(me.segments[segIdx].length + grpRecAmt); //所有的segment下的数据长度累计(包括ex部分)
|
|
|
let adHocAutoHeightAmt = 0;
|
|
|
+ let adHocAutoHeightGrpStartIdx = 0;
|
|
|
if (me.auto_height_fields_idx.length > 0) {
|
|
|
for (let loop = 0; loop < me.auto_height_info[segIdx].length; loop++) {
|
|
|
adHocAutoHeightAmt += (me.auto_height_info[segIdx][loop] - 1);
|
|
|
+ if (me.group_node_info && me.group_node_info[segIdx]) {
|
|
|
+ if (me.group_node_info[segIdx][adHocAutoHeightGrpStartIdx] === loop) {
|
|
|
+ me.group_node_info[segIdx][adHocAutoHeightGrpStartIdx] = me.group_node_info[segIdx][adHocAutoHeightGrpStartIdx] + adHocAutoHeightAmt;
|
|
|
+ adHocAutoHeightGrpStartIdx++;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
ttlSegRecAmtNormal += adHocAutoHeightAmt;
|
|
|
ttlSegRecAmt += adHocAutoHeightAmt;
|
|
@@ -484,15 +501,29 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
if (currentRecAmt > 0) pageStatus[JV.STATUS_SEGMENT_START] = false;
|
|
|
if (pageIdx > 0) pageStatus[JV.STATUS_REPORT_START] = false;
|
|
|
//开始判断各种scenarios
|
|
|
+ adHocAutoHeightAmt = 0;
|
|
|
+ let recAmtForAdHocAutoHeight = 0;
|
|
|
+ if (me.auto_height_fields_idx.length > 0) {
|
|
|
+ adHocAutoHeightAmt -= prePageLeftAutoHeightRecAmt;
|
|
|
+ //for (let loop = currentRecAmt; loop < me.auto_height_info[segIdx].length; loop++) {
|
|
|
+ for (let loop = currentRecAmt; loop < currentRecAmt + maxRowRec; loop++) {
|
|
|
+ if (me.auto_height_info[segIdx].length > loop) {
|
|
|
+ adHocAutoHeightAmt += (me.auto_height_info[segIdx][loop] - 1);
|
|
|
+ recAmtForAdHocAutoHeight++;
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if ((ttlSegRecAmtNormal < ttlSegRecAmt) || (followTabEx != null)) {
|
|
|
//有流水拓展,并且是follow mode
|
|
|
- if (currentRecAmt + maxRowRec > ttlSegRecAmtNormal) {
|
|
|
- if (currentRecAmt >= ttlSegRecAmtNormal) {
|
|
|
+ if (currentRecAmt + adHocAutoHeightAmt + recAmtForAdHocAutoHeight + maxRowRec > ttlSegRecAmtNormal) {
|
|
|
+ if (currentRecAmt + adHocAutoHeightAmt + recAmtForAdHocAutoHeight >= ttlSegRecAmtNormal) {
|
|
|
//纯 followTabEx 数据
|
|
|
- if (currentRecAmt + maxRowRec >= ttlSegRecAmt) {
|
|
|
+ if (currentRecAmt + adHocAutoHeightAmt + recAmtForAdHocAutoHeight + maxRowRec >= ttlSegRecAmt) {
|
|
|
pageStatus[JV.STATUS_SEGMENT_END] = true;
|
|
|
private_resetBandArea();
|
|
|
- let hasAdHocRow = !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, ttlSegRecAmt, currentRecAmt, maxRowRec, me.isEx);
|
|
|
+ let hasAdHocRow = !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, ttlSegRecAmt, currentRecAmt + adHocAutoHeightAmt + recAmtForAdHocAutoHeight, maxRowRec, me.isEx);
|
|
|
if (hasAdHocRow) {
|
|
|
//add page info(pre segment end)
|
|
|
pageStatus[JV.STATUS_SEGMENT_END] = false;
|
|
@@ -506,10 +537,10 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
}
|
|
|
} else {
|
|
|
//混合数据
|
|
|
- if (currentRecAmt + maxRowRec >= ttlSegRecAmt) {
|
|
|
+ if (currentRecAmt + adHocAutoHeightAmt + recAmtForAdHocAutoHeight + maxRowRec >= ttlSegRecAmt) {
|
|
|
pageStatus[JV.STATUS_SEGMENT_END] = true;
|
|
|
private_resetBandArea();
|
|
|
- let hasAdHocRow = !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, ttlSegRecAmt, currentRecAmt, maxRowRec, me.isEx);
|
|
|
+ let hasAdHocRow = !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, ttlSegRecAmt, currentRecAmt + adHocAutoHeightAmt + recAmtForAdHocAutoHeight, maxRowRec, me.isEx);
|
|
|
if (hasAdHocRow) {
|
|
|
//add page info(pre segment end)
|
|
|
pageStatus[JV.STATUS_SEGMENT_END] = false;
|
|
@@ -517,7 +548,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
}
|
|
|
//add page info
|
|
|
pageStatus[JV.STATUS_SEGMENT_END] = true;
|
|
|
- if (currentRecAmt >= ttlSegRecAmtNormal) {
|
|
|
+ if (currentRecAmt + adHocAutoHeightAmt + recAmtForAdHocAutoHeight >= ttlSegRecAmtNormal) {
|
|
|
//纯 followTabEx 数据啦
|
|
|
private_addPage(segIdx, null, true, false, -1);
|
|
|
} else {
|
|
@@ -533,20 +564,6 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
}
|
|
|
} else {
|
|
|
//普通流水数据情况
|
|
|
- let adHocAutoHeightAmt = 0;
|
|
|
- let recAmtForAdHocAutoHeight = 0;
|
|
|
- if (me.auto_height_fields_idx.length > 0) {
|
|
|
- adHocAutoHeightAmt -= prePageLeftAutoHeightRecAmt;
|
|
|
- //for (let loop = currentRecAmt; loop < me.auto_height_info[segIdx].length; loop++) {
|
|
|
- for (let loop = currentRecAmt; loop < currentRecAmt + maxRowRec; loop++) {
|
|
|
- if (me.auto_height_info[segIdx].length > loop) {
|
|
|
- adHocAutoHeightAmt += (me.auto_height_info[segIdx][loop] - 1);
|
|
|
- recAmtForAdHocAutoHeight++;
|
|
|
- } else {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
if ((currentRecAmt + adHocAutoHeightAmt + recAmtForAdHocAutoHeight + maxRowRec >= ttlSegRecAmt)
|
|
|
&& (recAmtForAdHocAutoHeight + adHocAutoHeightAmt < 2 * maxRowRec) ) {
|
|
|
//备注: 理论上自动行高是没有上限的,有可能正常一页的数据可以拓展到3页及以上,在此极端情况下,必须做一些限制判断,否则会出现缺页情况。
|