|
@@ -28,6 +28,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
JpcFlowTabResult.initialize = function(isEx) {
|
|
|
let me = this;
|
|
|
me.isEx = isEx;
|
|
|
+ me.paging_option = JV.PAGING_OPTION_NORMAL;
|
|
|
me.segments = [];
|
|
|
me.dispValueIdxLst = [];
|
|
|
me.page_seg_map = [];
|
|
@@ -73,69 +74,107 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
|
|
|
}
|
|
|
};
|
|
|
- JpcFlowTabResult.preSetupPages = function (rptTpl, dataOjb, defProperties) {
|
|
|
- let rst = 0, me = this, counterRowRec = 0, maxRowRec = 1, pageIdx = 0;
|
|
|
+ JpcFlowTabResult.preSetupPages = function (rptTpl, dataOjb, defProperties, option) {
|
|
|
+ let me = this, rst = 1, counterRowRec = 0, maxRowRec = 1, pageIdx = 0;
|
|
|
+ me.paging_option = option||JV.PAGING_OPTION_NORMAL;
|
|
|
let CURRENT_FLOW_INFO = (me.isEx)?JV.NODE_FLOW_INFO_EX:JV.NODE_FLOW_INFO;
|
|
|
JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl[CURRENT_FLOW_INFO][JV.NODE_FLOW_CONTENT][JV.PROP_FLOW_FIELDS], null, me.disp_fields_idx, me.isEx);
|
|
|
- let bands = JpcBand.createNew(rptTpl, defProperties);
|
|
|
- let pageStatus = [true, true, false, false, false, false, false, false];
|
|
|
- if (me.isEx) {
|
|
|
- pageStatus[JV.STATUS_REPORT_START] = false;
|
|
|
- }
|
|
|
- if (rptTpl[CURRENT_FLOW_INFO][JV.PROP_MULTI_COLUMN]) {
|
|
|
- me.multiCols = 1 * rptTpl[CURRENT_FLOW_INFO][JV.PROP_MULTI_COLUMN];
|
|
|
- }
|
|
|
- function private_resetBandArea() {
|
|
|
- JpcBandHelper.setBandArea(bands, rptTpl, pageStatus, !me.isEx, me.isEx);
|
|
|
- maxRowRec = JpcFlowTabHelper.getMaxRowsPerPage(bands, rptTpl);
|
|
|
- }
|
|
|
- for (let segIdx = 0; segIdx < me.segments.length; segIdx++) {
|
|
|
- private_resetBandArea();
|
|
|
- let orgMaxRowRec = maxRowRec;
|
|
|
- let rowSplitCnt = Math.ceil(1.0 * me.segments[segIdx].length / orgMaxRowRec);
|
|
|
- pageStatus[JV.STATUS_SEGMENT_END] = true;
|
|
|
- private_resetBandArea();
|
|
|
- let hasAdHocRow = !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, me.segments, segIdx, (rowSplitCnt - 1) * orgMaxRowRec, maxRowRec);
|
|
|
- if (hasAdHocRow) rowSplitCnt++;
|
|
|
- if (rowSplitCnt % me.multiCols > 0) {
|
|
|
- rowSplitCnt++
|
|
|
- }
|
|
|
- for (let rowIdx = 0; rowIdx < rowSplitCnt; rowIdx++) {
|
|
|
- pageStatus[JV.STATUS_SEGMENT_END] = rowIdx == (rowSplitCnt - 1)?true:false;
|
|
|
- if (pageIdx > 0) pageStatus[JV.STATUS_REPORT_START] = false;
|
|
|
- private_resetBandArea();
|
|
|
+ if (me.paging_option === JV.PAGING_OPTION_INFINITY_VERTICAL) {
|
|
|
+ rst = me.segments.length;
|
|
|
+ let pageStatus = [true, true, false, true, true, true, false, false];
|
|
|
+ for (let segIdx = 0; segIdx < me.segments.length; segIdx++) {
|
|
|
+ if (segIdx === me.segments.length - 1) {
|
|
|
+ pageStatus[JV.STATUS_REPORT_END] = true;
|
|
|
+ }
|
|
|
+ if (segIdx > 0) {
|
|
|
+ pageStatus[JV.STATUS_REPORT_START] = false;
|
|
|
+ }
|
|
|
me.pageStatusLst.push(pageStatus.slice(0));
|
|
|
pageIdx++;
|
|
|
- counterRowRec = orgMaxRowRec * rowIdx;
|
|
|
- private_addPageValue(me.dispValueIdxLst, me.segments[segIdx], counterRowRec, maxRowRec,me.page_seg_map, segIdx, pageIdx);
|
|
|
+ private_addPageValue(me.dispValueIdxLst, me.segments[segIdx], 0, me.segments[segIdx].length, me.page_seg_map, segIdx, pageIdx);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ let bands = JpcBand.createNew(rptTpl, defProperties);
|
|
|
+ let pageStatus = [true, true, false, true, false, false, false, false];
|
|
|
+ if (me.isEx) {
|
|
|
+ pageStatus[JV.STATUS_REPORT_START] = false;
|
|
|
+ }
|
|
|
+ if (rptTpl[CURRENT_FLOW_INFO][JV.PROP_MULTI_COLUMN]) {
|
|
|
+ me.multiCols = 1 * rptTpl[CURRENT_FLOW_INFO][JV.PROP_MULTI_COLUMN];
|
|
|
+ }
|
|
|
+ function private_resetBandArea() {
|
|
|
+ JpcBandHelper.setBandArea(bands, rptTpl, pageStatus, !me.isEx, me.isEx);
|
|
|
+ maxRowRec = JpcFlowTabHelper.getMaxRowsPerPage(bands, rptTpl);
|
|
|
}
|
|
|
- pageStatus[JV.STATUS_SEGMENT_END] = false;
|
|
|
- pageStatus[JV.STATUS_REPORT_START] = false;
|
|
|
+ for (let segIdx = 0; segIdx < me.segments.length; segIdx++) {
|
|
|
+ private_resetBandArea();
|
|
|
+ let orgMaxRowRec = maxRowRec;
|
|
|
+ let rowSplitCnt = Math.ceil(1.0 * me.segments[segIdx].length / orgMaxRowRec);
|
|
|
+ pageStatus[JV.STATUS_SEGMENT_END] = true;
|
|
|
+ private_resetBandArea();
|
|
|
+ let hasAdHocRow = !JpcFlowTabHelper.chkSegEnd(bands, rptTpl, me.segments, segIdx, (rowSplitCnt - 1) * orgMaxRowRec, maxRowRec);
|
|
|
+ if (hasAdHocRow) rowSplitCnt++;
|
|
|
+ if (rowSplitCnt % me.multiCols > 0) {
|
|
|
+ rowSplitCnt++
|
|
|
+ }
|
|
|
+ for (let rowIdx = 0; rowIdx < rowSplitCnt; rowIdx++) {
|
|
|
+ pageStatus[JV.STATUS_SEGMENT_END] = (rowIdx === (rowSplitCnt - 1));
|
|
|
+ if (pageIdx > 0) pageStatus[JV.STATUS_REPORT_START] = false;
|
|
|
+ private_resetBandArea();
|
|
|
+ me.pageStatusLst.push(pageStatus.slice(0));
|
|
|
+ pageIdx++;
|
|
|
+ counterRowRec = orgMaxRowRec * rowIdx;
|
|
|
+ private_addPageValue(me.dispValueIdxLst, me.segments[segIdx], counterRowRec, maxRowRec,me.page_seg_map, segIdx, pageIdx);
|
|
|
+ }
|
|
|
+ pageStatus[JV.STATUS_SEGMENT_END] = false;
|
|
|
+ pageStatus[JV.STATUS_REPORT_START] = false;
|
|
|
+ }
|
|
|
+ rst = Math.ceil(pageIdx / me.multiCols);
|
|
|
}
|
|
|
- rst = Math.ceil(1.0 * pageIdx / me.multiCols);
|
|
|
me.pagesAmt = rst;
|
|
|
return rst;
|
|
|
};
|
|
|
JpcFlowTabResult.outputAsSimpleJSONPage = function (rptTpl, dataObj, page, bands, controls, $CURRENT_RPT) {
|
|
|
let me = this, rst = [], tabRstLst = [];
|
|
|
let FLOW_NODE_STR = me.isEx?JV.NODE_FLOW_INFO_EX:JV.NODE_FLOW_INFO;
|
|
|
- let segIdx = JpcCommonHelper.getSegIdxByPageIdx(page, me.page_seg_map);
|
|
|
- //1 calculate the band position
|
|
|
- JpcBandHelper.setBandArea(bands, rptTpl, me.pageStatusLst[page - 1], !me.isEx, me.isEx);
|
|
|
- //2. start to output detail-part
|
|
|
let unitFactor = JpcCommonHelper.getUnitFactor(rptTpl);
|
|
|
- for (let pi = 0; pi < me.multiCols; pi++) {
|
|
|
- let actualPage = (page - 1) * me.multiCols + pi + 1;
|
|
|
- //2.1 Content-Tab
|
|
|
- tabRstLst.push(me.outputContent(rptTpl, dataObj, actualPage, bands, unitFactor, controls, pi, $CURRENT_RPT));
|
|
|
+ if (me.paging_option === JV.PAGING_OPTION_INFINITY_VERTICAL) {
|
|
|
+ let segIdx = page - 1;
|
|
|
+ //1 calculate the band position
|
|
|
+ JpcBandHelper.setBandArea(bands, rptTpl, me.pageStatusLst[page - 1], !me.isEx, me.isEx);
|
|
|
+ //2. then reset the band height
|
|
|
+ let tab = rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_CONTENT];
|
|
|
+ let flowContentBand = bands[tab[JV.PROP_BAND_NAME]];
|
|
|
+ let actH = JpcFlowTabHelper.getActualContentAreaHeight(bands, rptTpl, me.segments, page);
|
|
|
+ let offsetY = actH - (flowContentBand.Bottom - flowContentBand.Top);
|
|
|
+ JpcBandHelper.resetBandPos(rptTpl[JV.NODE_BAND_COLLECTION], bands, flowContentBand, offsetY);
|
|
|
+
|
|
|
+ tabRstLst.push(me.outputContent(rptTpl, dataObj, page, bands, unitFactor, controls, 0, $CURRENT_RPT));
|
|
|
//2.2 Column tab
|
|
|
- tabRstLst.push(me.outputColumn(rptTpl, dataObj, actualPage, segIdx, bands, unitFactor, controls, pi));
|
|
|
+ tabRstLst.push(me.outputColumn(rptTpl, dataObj, page, segIdx, bands, unitFactor, controls, 0));
|
|
|
//2.3 Sum Seg
|
|
|
- tabRstLst.push(me.outputSegSum(rptTpl, dataObj, actualPage, segIdx, bands, unitFactor, controls));
|
|
|
+ tabRstLst.push(me.outputSegSum(rptTpl, dataObj, page, segIdx, bands, unitFactor, controls));
|
|
|
//2.4 Sum Page
|
|
|
//2.5 Discrete
|
|
|
- if (pi == 0) {
|
|
|
- tabRstLst.push(JpcDiscreteHelper.outputDiscreteInfo(rptTpl[FLOW_NODE_STR][JV.NODE_DISCRETE_INFO], bands, dataObj, unitFactor, me.pageStatusLst[actualPage - 1], segIdx, 1, pi, $CURRENT_RPT));
|
|
|
+ tabRstLst.push(JpcDiscreteHelper.outputDiscreteInfo(rptTpl[FLOW_NODE_STR][JV.NODE_DISCRETE_INFO], bands, dataObj, unitFactor, me.pageStatusLst[page - 1], segIdx, 1, 0, $CURRENT_RPT));
|
|
|
+ } else {
|
|
|
+ let segIdx = JpcCommonHelper.getSegIdxByPageIdx(page, me.page_seg_map);
|
|
|
+ //1 calculate the band position
|
|
|
+ JpcBandHelper.setBandArea(bands, rptTpl, me.pageStatusLst[page - 1], !me.isEx, me.isEx);
|
|
|
+ //2. start to output detail-part
|
|
|
+ for (let pi = 0; pi < me.multiCols; pi++) {
|
|
|
+ let actualPage = (page - 1) * me.multiCols + pi + 1;
|
|
|
+ //2.1 Content-Tab
|
|
|
+ tabRstLst.push(me.outputContent(rptTpl, dataObj, actualPage, bands, unitFactor, controls, pi, $CURRENT_RPT));
|
|
|
+ //2.2 Column tab
|
|
|
+ tabRstLst.push(me.outputColumn(rptTpl, dataObj, actualPage, segIdx, bands, unitFactor, controls, pi));
|
|
|
+ //2.3 Sum Seg
|
|
|
+ tabRstLst.push(me.outputSegSum(rptTpl, dataObj, actualPage, segIdx, bands, unitFactor, controls));
|
|
|
+ //2.4 Sum Page
|
|
|
+ //2.5 Discrete
|
|
|
+ if (pi === 0) {
|
|
|
+ tabRstLst.push(JpcDiscreteHelper.outputDiscreteInfo(rptTpl[FLOW_NODE_STR][JV.NODE_DISCRETE_INFO], bands, dataObj, unitFactor, me.pageStatusLst[actualPage - 1], segIdx, 1, pi, $CURRENT_RPT));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
for (let i = 0; i < tabRstLst.length; i++) {
|
|
@@ -151,14 +190,14 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
let band = bands[tab[JV.PROP_BAND_NAME]];
|
|
|
if (band) {
|
|
|
let pageStatus = me.pageStatusLst[page - 1];
|
|
|
- if (pageStatus[band[JV.BAND_PROP_DISPLAY_TYPE]] == true) {
|
|
|
+ if (pageStatus[band[JV.BAND_PROP_DISPLAY_TYPE]]) {
|
|
|
let tab_fields = tab[JV.PROP_FLOW_FIELDS];
|
|
|
let data_details = me.isEx?dataObj[JV.DATA_DETAIL_DATA_EX]:dataObj[JV.DATA_DETAIL_DATA];
|
|
|
let contentValuesIdx = me.dispValueIdxLst[page - 1];
|
|
|
for (let i = 0; i < tab_fields.length; i++) {
|
|
|
let tab_field = tab_fields[i];
|
|
|
let data_field = null;
|
|
|
- if (me.disp_fields_idx[i] != JV.BLANK_FIELD_INDEX) {
|
|
|
+ if (me.disp_fields_idx[i] !== JV.BLANK_FIELD_INDEX) {
|
|
|
data_field = data_details[me.disp_fields_idx[i]];
|
|
|
} else {
|
|
|
data_field = JE.F(tab_field[JV.PROP_FIELD_ID], $CURRENT_RPT);
|
|
@@ -183,7 +222,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
let band = bands[tab[JV.PROP_BAND_NAME]];
|
|
|
if (band) {
|
|
|
let pageStatus = me.pageStatusLst[page - 1];
|
|
|
- if (pageStatus[band[JV.BAND_PROP_DISPLAY_TYPE]] == true) {
|
|
|
+ if (pageStatus[band[JV.BAND_PROP_DISPLAY_TYPE]]) {
|
|
|
if (tab[JV.PROP_TEXT]) {
|
|
|
rst.push(JpcTextHelper.outputText(tab[JV.PROP_TEXT], band, unitFactor, 1, 0, 1, 0, me.multiCols, multiColIdx));
|
|
|
}
|
|
@@ -206,7 +245,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
let band = bands[tab[JV.PROP_BAND_NAME]];
|
|
|
if (band) {
|
|
|
let pageStatus = me.pageStatusLst[page - 1];
|
|
|
- if (pageStatus[band[JV.BAND_PROP_DISPLAY_TYPE]] == true) {
|
|
|
+ if (pageStatus[band[JV.BAND_PROP_DISPLAY_TYPE]]) {
|
|
|
let tab_fields = me.seg_sum_tab_fields;
|
|
|
for (let i = 0; i < tab_fields.length; i++) {
|
|
|
let cellItem = JpcCommonOutputHelper.createCommonOutput(tab_fields[i], me.segSumValLst[segIdx][i], controls);
|
|
@@ -229,13 +268,13 @@ JpcFlowTabSrv.prototype.createNew = function(){
|
|
|
return rst;
|
|
|
};
|
|
|
JpcFlowTabResult.outputTabField = function (band, tab_field, data_field, valueIdx, serialIdx, rows, rowIdx, cols, colIdx, unitFactor, isRow, controls, multiColIdx) {
|
|
|
- let me = this, rst = null;
|
|
|
- rst = JpcCommonOutputHelper.createCommonOutput(tab_field, JpcFieldHelper.getValue(data_field, valueIdx), controls);
|
|
|
+ let me = this,
|
|
|
+ rst = JpcCommonOutputHelper.createCommonOutput(tab_field, JpcFieldHelper.getValue(data_field, valueIdx), controls);
|
|
|
rst[JV.PROP_AREA] = JpcAreaHelper.outputArea(tab_field[JV.PROP_AREA], band, unitFactor, rows, rowIdx, cols, colIdx, me.multiCols, multiColIdx, true, false);
|
|
|
return rst;
|
|
|
- }
|
|
|
+ };
|
|
|
|
|
|
return JpcFlowTabResult;
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
module.exports = new JpcFlowTabSrv();
|