|
|
@@ -322,7 +322,7 @@ JpcCrossTabSrv.prototype.createNew = function() {
|
|
|
// console.log('me.row_sum_fields_value_total');
|
|
|
// console.log(me.row_sum_fields_value_total);
|
|
|
};
|
|
|
- JpcCrossTabResult.preSetupPages = function(rptTpl, defProperties, option) {
|
|
|
+ JpcCrossTabResult.preSetupPages = function(rptTpl, defProperties, option, $CURRENT_RPT, dataObj, $CTX_HELPER) {
|
|
|
const me = this;
|
|
|
let rst = 0;
|
|
|
me.paging_option = option || JV.PAGING_OPTION_NORMAL;
|
|
|
@@ -336,10 +336,13 @@ JpcCrossTabSrv.prototype.createNew = function() {
|
|
|
const pageStatus = [true, true, false, true, false, false, false, false];
|
|
|
// 2. calculate the page info one by one
|
|
|
let bands = JpcBand.createNew(rptTpl, defProperties);
|
|
|
- function private_resetBandArea() {
|
|
|
+ function private_resetBandArea(segIdx) {
|
|
|
JpcBandHelper.setBandArea(bands, rptTpl, pageStatus);
|
|
|
maxRowRec = JpcCrossTabHelper.getMaxRowsPerPage(bands, rptTpl);
|
|
|
maxColRec = JpcCrossTabHelper.getMaxColsPerPage(bands, rptTpl);
|
|
|
+ const $CACHE_OBJ = { newColAmt: maxColRec };
|
|
|
+ me.resetCrossColsEvent(JV.RUN_TYPE_RESET_CROSS_COLUMNS, $CURRENT_RPT, dataObj, segIdx, maxColRec, $CACHE_OBJ, $CTX_HELPER);
|
|
|
+ maxColRec = $CACHE_OBJ.newColAmt;
|
|
|
}
|
|
|
JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW_EXT][JV.PROP_CROSS_FIELDS], null, me.row_extension_fields_idx);
|
|
|
JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl[JV.NODE_CROSS_INFO][JV.NODE_CROSS_ROW_SUM_EXT][JV.PROP_CROSS_FIELDS], null, me.row_sum_extension_fields_idx);
|
|
|
@@ -367,30 +370,30 @@ JpcCrossTabSrv.prototype.createNew = function() {
|
|
|
} else {
|
|
|
for (let segIdx = 0; segIdx < segCnt; segIdx++) {
|
|
|
// 2.1. seg level initialize
|
|
|
- private_resetBandArea();
|
|
|
+ private_resetBandArea(segIdx);
|
|
|
const orgMaxRowRec = maxRowRec;
|
|
|
const orgMaxColRec = maxColRec;
|
|
|
let rowSplitCnt = Math.ceil(1.0 * me.sortedRowSequence[segIdx].length / maxRowRec);
|
|
|
let colSplitCnt = Math.ceil(1.0 * me.sortedColSequence[segIdx].length / maxColRec);
|
|
|
pageStatus[JV.STATUS_CROSS_ROW_END] = true;
|
|
|
- private_resetBandArea();
|
|
|
+ private_resetBandArea(segIdx);
|
|
|
let hasAdHocRow = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_ROW_SUM, rptTpl, bands, me.sortedRowSequence, segIdx, (rowSplitCnt - 1) * orgMaxRowRec, maxRowRec);
|
|
|
if (hasAdHocRow) {
|
|
|
hasAdHocRow = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_ROW_EXT, rptTpl, bands, me.sortedRowSequence, segIdx, (rowSplitCnt - 1) * orgMaxRowRec, maxRowRec);
|
|
|
}
|
|
|
pageStatus[JV.STATUS_CROSS_ROW_END] = false;
|
|
|
pageStatus[JV.STATUS_CROSS_COL_END] = true;
|
|
|
- private_resetBandArea();
|
|
|
+ private_resetBandArea(segIdx);
|
|
|
const hasAdHocCol = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_COL_SUM, rptTpl, bands, me.sortedColSequence, segIdx, (colSplitCnt - 1) * orgMaxColRec, maxColRec);
|
|
|
pageStatus[JV.STATUS_CROSS_COL_END] = false;
|
|
|
- private_resetBandArea();
|
|
|
+ private_resetBandArea(segIdx);
|
|
|
if (hasAdHocRow) rowSplitCnt++;
|
|
|
if (hasAdHocCol) colSplitCnt++;
|
|
|
// 2.2
|
|
|
if (rptTpl[JV.NODE_MAIN_INFO][JV.NODE_PAGE_INFO][JV.PROP_CROSS_DISPLAY_ORDER] === JV.PAGE_ORIENTATION_H_FIRST) {
|
|
|
for (let rowIdx = 0; rowIdx < rowSplitCnt; rowIdx++) {
|
|
|
pageStatus[JV.STATUS_CROSS_ROW_END] = (rowIdx === (rowSplitCnt - 1));
|
|
|
- private_resetBandArea();
|
|
|
+ private_resetBandArea(segIdx);
|
|
|
counterRowRec = orgMaxRowRec * rowIdx;
|
|
|
let currentSortedRowSequence = me.sortedRowSequence;
|
|
|
let currentSortedContentSequence = me.sortedContentSequence;
|
|
|
@@ -404,7 +407,7 @@ JpcCrossTabSrv.prototype.createNew = function() {
|
|
|
let needOneMoreRptEnd = false;
|
|
|
if ((segIdx === segCnt - 1) && pageStatus[JV.STATUS_CROSS_ROW_END] && pageStatus[JV.STATUS_CROSS_COL_END]) {
|
|
|
pageStatus[JV.STATUS_REPORT_END] = true;
|
|
|
- private_resetBandArea();
|
|
|
+ private_resetBandArea(segIdx);
|
|
|
const hasAdHocColEnd = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_COL_SUM, rptTpl, bands, me.sortedColSequence, segIdx, (colSplitCnt - 1) * orgMaxColRec, maxColRec);
|
|
|
const hasAdHocRowEnd = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_ROW_SUM, rptTpl, bands, me.sortedRowSequence, segIdx, (rowSplitCnt - 1) * orgMaxRowRec, maxRowRec);
|
|
|
if (hasAdHocColEnd || hasAdHocRowEnd) {
|
|
|
@@ -412,7 +415,7 @@ JpcCrossTabSrv.prototype.createNew = function() {
|
|
|
pageStatus[JV.STATUS_REPORT_END] = false;
|
|
|
}
|
|
|
}
|
|
|
- private_resetBandArea();
|
|
|
+ private_resetBandArea(segIdx);
|
|
|
counterColRec = orgMaxColRec * colIdx;
|
|
|
let currentSortedColSequence = me.sortedColSequence;
|
|
|
if (hasAdHocCol && colIdx === (colSplitCnt - 1)) {
|
|
|
@@ -430,7 +433,7 @@ JpcCrossTabSrv.prototype.createNew = function() {
|
|
|
// 处理report end情况
|
|
|
if (needOneMoreRptEnd) {
|
|
|
pageStatus[JV.STATUS_REPORT_END] = true;
|
|
|
- private_resetBandArea();
|
|
|
+ private_resetBandArea(segIdx);
|
|
|
currentSortedColSequence = null;
|
|
|
currentSortedContentSequence = null;
|
|
|
counterColRec = 0;
|
|
|
@@ -447,7 +450,7 @@ JpcCrossTabSrv.prototype.createNew = function() {
|
|
|
} else {
|
|
|
for (let colIdx = 0; colIdx < colSplitCnt; colIdx++) {
|
|
|
pageStatus[JV.STATUS_CROSS_COL_END] = (colIdx === (colSplitCnt - 1));
|
|
|
- private_resetBandArea();
|
|
|
+ private_resetBandArea(segIdx);
|
|
|
counterColRec = orgMaxColRec * colIdx;
|
|
|
let currentSortedContentSequence = me.sortedContentSequence;
|
|
|
let currentSortedColSequence = me.sortedColSequence;
|
|
|
@@ -461,7 +464,7 @@ JpcCrossTabSrv.prototype.createNew = function() {
|
|
|
let needOneMoreRptEnd = false;
|
|
|
if ((segIdx === segCnt - 1) && pageStatus[JV.STATUS_CROSS_ROW_END] && pageStatus[JV.STATUS_CROSS_COL_END]) {
|
|
|
pageStatus[JV.STATUS_REPORT_END] = true;
|
|
|
- private_resetBandArea();
|
|
|
+ private_resetBandArea(segIdx);
|
|
|
const hasAdHocColEnd = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_COL_SUM, rptTpl, bands, me.sortedColSequence, segIdx, (colSplitCnt - 1) * orgMaxColRec, maxColRec);
|
|
|
const hasAdHocRowEnd = !JpcCrossTabHelper.chkTabEnd(JV.NODE_CROSS_ROW_SUM, rptTpl, bands, me.sortedRowSequence, segIdx, (rowSplitCnt - 1) * orgMaxRowRec, maxRowRec);
|
|
|
if (hasAdHocColEnd || hasAdHocRowEnd) {
|
|
|
@@ -469,7 +472,7 @@ JpcCrossTabSrv.prototype.createNew = function() {
|
|
|
pageStatus[JV.STATUS_REPORT_END] = false;
|
|
|
}
|
|
|
}
|
|
|
- private_resetBandArea();
|
|
|
+ private_resetBandArea(segIdx);
|
|
|
me.pageStatusLst.push(pageStatus.slice(0));
|
|
|
pageIdx++;
|
|
|
counterRowRec = orgMaxRowRec * rowIdx;
|
|
|
@@ -487,7 +490,7 @@ JpcCrossTabSrv.prototype.createNew = function() {
|
|
|
// 处理report end情况
|
|
|
if (needOneMoreRptEnd) {
|
|
|
pageStatus[JV.STATUS_REPORT_END] = true;
|
|
|
- private_resetBandArea();
|
|
|
+ private_resetBandArea(segIdx);
|
|
|
currentSortedRowSequence = null;
|
|
|
currentSortedContentSequence = null;
|
|
|
counterRowRec = 0;
|
|
|
@@ -594,7 +597,7 @@ JpcCrossTabSrv.prototype.createNew = function() {
|
|
|
}
|
|
|
return rst;
|
|
|
};
|
|
|
- JpcCrossTabResult.outputAsSimpleJSONPage = function(rptTpl, dataObj, page, bands, controls, fonts, $CURRENT_RPT, customizeCfg) {
|
|
|
+ JpcCrossTabResult.outputAsSimpleJSONPage = function(rptTpl, dataObj, page, bands, controls, fonts, $CURRENT_RPT, customizeCfg, $CTX_HELPER) {
|
|
|
const me = this;
|
|
|
let rst = [];
|
|
|
const tabRstLst = [];
|
|
|
@@ -675,6 +678,24 @@ JpcCrossTabSrv.prototype.createNew = function() {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
+ JpcCrossTabResult.resetCrossColsEvent = function($RUN_TYPE, $CURRENT_RPT, $CURRENT_DATA, $SEG_IDX, $ORG_COLS, $CACHE_OBJ, $CTX_HELPER) {
|
|
|
+ if ($CURRENT_RPT.formulas) {
|
|
|
+ for (let execFmlIdx = 0; execFmlIdx < $CURRENT_RPT.formulas.length; execFmlIdx++) {
|
|
|
+ if ($CURRENT_RPT.formulas[execFmlIdx][JV.PROP_RUN_TYPE] === $RUN_TYPE) {
|
|
|
+ const expression = $CURRENT_RPT.formulas[execFmlIdx][JV.PROP_EXPRESSION];
|
|
|
+ if (expression) {
|
|
|
+ const $ME = $CURRENT_RPT.formulas[execFmlIdx];
|
|
|
+ const $JE = JE;
|
|
|
+ try {
|
|
|
+ eval(expression);
|
|
|
+ } catch (ex) {
|
|
|
+ console.log(ex);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
JpcCrossTabResult.outputRowTabCommon = function(rptTpl, dataObj, page, bands, tabStr, rowFieldsIdxArr, unitFactor, controls, $CURRENT_RPT, customizeCfg) {
|
|
|
const me = this;
|
|
|
const rst = [];
|