Browse Source

处理交叉表末页

TonyKang 3 years ago
parent
commit
e687732d2c
1 changed files with 42 additions and 0 deletions
  1. 42 0
      app/reports/rpt_component/jpc_cross_tab.js

+ 42 - 0
app/reports/rpt_component/jpc_cross_tab.js

@@ -388,8 +388,16 @@ JpcCrossTabSrv.prototype.createNew = function() {
                         }
                         for (let colIdx = 0; colIdx < colSplitCnt; colIdx++) {
                             pageStatus[JV.STATUS_CROSS_COL_END] = (colIdx === (colSplitCnt - 1));
+                            let needOneMoreRptEnd = false;
                             if (pageStatus[JV.STATUS_CROSS_ROW_END] && pageStatus[JV.STATUS_CROSS_COL_END]) {
                                 pageStatus[JV.STATUS_REPORT_END] = true;
+                                private_resetBandArea();
+                                let hasAdHocColEnd = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_COL_SUM, rptTpl, bands, me.sortedColSequence, segIdx, (colSplitCnt - 1) * orgMaxColRec, maxColRec);
+                                let hasAdHocRowEnd = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_ROW_SUM, rptTpl, bands, me.sortedRowSequence, segIdx, (rowSplitCnt - 1) * orgMaxRowRec, maxRowRec);
+                                if (hasAdHocColEnd || hasAdHocRowEnd) {
+                                    needOneMoreRptEnd = true;
+                                    pageStatus[JV.STATUS_REPORT_END] = false;
+                                }
                             }
                             private_resetBandArea();
                             counterColRec = orgMaxColRec * colIdx;
@@ -404,6 +412,19 @@ JpcCrossTabSrv.prototype.createNew = function() {
                             private_addTabValue(me.dispValueIdxLst_Row, currentSortedRowSequence, segIdx, counterRowRec, maxRowRec, me.dispSerialIdxLst_Row, me.col_sum_fields_value_total, me.dispSumValueLst_Col);
                             private_addTabValue(me.dispValueIdxLst_Col, currentSortedColSequence, segIdx, counterColRec, maxColRec, null, me.row_sum_fields_value_total, me.dispSumValueLst_Row);
                             private_addContentValue(me.dispValueIdxLst_Content, currentSortedContentSequence, segIdx, counterRowRec, maxRowRec, counterColRec, maxColRec, me.page_seg_map, pageIdx);
+                            // 处理report end情况
+                            if (needOneMoreRptEnd) {
+                                pageStatus[JV.STATUS_REPORT_END] = true;
+                                private_resetBandArea();
+                                currentSortedColSequence = null;
+                                currentSortedContentSequence = null;
+                                counterColRec = 0;
+                                me.pageStatusLst.push(pageStatus.slice(0));
+                                pageIdx++;
+                                private_addTabValue(me.dispValueIdxLst_Row, currentSortedRowSequence, segIdx, counterRowRec, maxRowRec, me.dispSerialIdxLst_Row, me.col_sum_fields_value_total, me.dispSumValueLst_Col);
+                                private_addTabValue(me.dispValueIdxLst_Col, currentSortedColSequence, segIdx, counterColRec, maxColRec, null, me.row_sum_fields_value_total, me.dispSumValueLst_Row);
+                                private_addContentValue(me.dispValueIdxLst_Content, currentSortedContentSequence, segIdx, counterRowRec, maxRowRec, counterColRec, maxColRec, me.page_seg_map, pageIdx);
+                            }
                         }
                     }
                 } else {
@@ -420,8 +441,16 @@ JpcCrossTabSrv.prototype.createNew = function() {
                         }
                         for (let rowIdx = 0; rowIdx < rowSplitCnt; rowIdx++) {
                             pageStatus[JV.STATUS_CROSS_ROW_END] = (rowIdx === (rowSplitCnt - 1));
+                            let needOneMoreRptEnd = false;
                             if (pageStatus[JV.STATUS_CROSS_ROW_END] && pageStatus[JV.STATUS_CROSS_COL_END]) {
                                 pageStatus[JV.STATUS_REPORT_END] = true;
+                                private_resetBandArea();
+                                let hasAdHocColEnd = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_COL_SUM, rptTpl, bands, me.sortedColSequence, segIdx, (colSplitCnt - 1) * orgMaxColRec, maxColRec);
+                                let hasAdHocRowEnd = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_ROW_SUM, rptTpl, bands, me.sortedRowSequence, segIdx, (rowSplitCnt - 1) * orgMaxRowRec, maxRowRec);
+                                if (hasAdHocColEnd || hasAdHocRowEnd) {
+                                    needOneMoreRptEnd = true;
+                                    pageStatus[JV.STATUS_REPORT_END] = false;
+                                }
                             }
                             private_resetBandArea();
                             me.pageStatusLst.push(pageStatus.slice(0));
@@ -436,6 +465,19 @@ JpcCrossTabSrv.prototype.createNew = function() {
                             private_addTabValue(me.dispValueIdxLst_Row, currentSortedRowSequence, segIdx, counterRowRec, maxRowRec, me.dispSerialIdxLst_Row, me.col_sum_fields_value_total, me.dispSumValueLst_Col);
                             private_addTabValue(me.dispValueIdxLst_Col, currentSortedColSequence, segIdx, counterColRec, maxColRec, null, me.row_sum_fields_value_total, me.dispSumValueLst_Row);
                             private_addContentValue(me.dispValueIdxLst_Content, currentSortedContentSequence, segIdx, counterRowRec, maxRowRec, counterColRec, maxColRec, me.page_seg_map, pageIdx);
+                            // 处理report end情况
+                            if (needOneMoreRptEnd) {
+                                pageStatus[JV.STATUS_REPORT_END] = true;
+                                private_resetBandArea();
+                                currentSortedRowSequence = null;
+                                currentSortedContentSequence = null;
+                                counterRowRec = 0;
+                                me.pageStatusLst.push(pageStatus.slice(0));
+                                pageIdx++;
+                                private_addTabValue(me.dispValueIdxLst_Row, currentSortedRowSequence, segIdx, counterRowRec, maxRowRec, me.dispSerialIdxLst_Row, me.col_sum_fields_value_total, me.dispSumValueLst_Col);
+                                private_addTabValue(me.dispValueIdxLst_Col, currentSortedColSequence, segIdx, counterColRec, maxColRec, null, me.row_sum_fields_value_total, me.dispSumValueLst_Row);
+                                private_addContentValue(me.dispValueIdxLst_Content, currentSortedContentSequence, segIdx, counterRowRec, maxRowRec, counterColRec, maxColRec, me.page_seg_map, pageIdx);
+                            }
                         }
                     }
                 }