|  | @@ -160,7 +160,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
 | 
	
		
			
				|  |  |          me.multiCols = 1;
 | 
	
		
			
				|  |  |          me.pagesAmt = 0;
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  | -    JpcFlowTabResult.sorting = function(rptTpl, dataObj, dataSeq) {
 | 
	
		
			
				|  |  | +    JpcFlowTabResult.sorting = function(rptTpl, dataObj, dataSeq, $CURRENT_RPT) {
 | 
	
		
			
				|  |  |          let me = this;
 | 
	
		
			
				|  |  |          let FLOW_NODE_STR = me.isEx?JV.NODE_FLOW_INFO_EX:JV.NODE_FLOW_INFO;
 | 
	
		
			
				|  |  |          if (rptTpl[FLOW_NODE_STR][JV.NODE_FLOW_SEG_SUM]) JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl[FLOW_NODE_STR][JV.NODE_FLOW_SEG_SUM][JV.PROP_SUM_FIELDS], me.seg_sum_tab_fields, me.seg_sum_fields_idx, me.isEx);
 | 
	
	
		
			
				|  | @@ -174,11 +174,24 @@ JpcFlowTabSrv.prototype.createNew = function(){
 | 
	
		
			
				|  |  |              me.segments.push(dataSeq[si].slice(0));
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //pre-sum the data(for seg sum display)
 | 
	
		
			
				|  |  | +        //考虑到实际会有离散指标的汇总,这些离散指标数据是通过计算式后得来的,这种情况下,不适宜在sorting阶段进行汇总统计,现挪到preSetupPages阶段处理
 | 
	
		
			
				|  |  | +    };
 | 
	
		
			
				|  |  | +    JpcFlowTabResult.sumSeg = function (dataObj, $CURRENT_RPT) {
 | 
	
		
			
				|  |  | +        let me = this;
 | 
	
		
			
				|  |  |          let data_details = me.isEx?dataObj[JV.DATA_DETAIL_DATA_EX]:dataObj[JV.DATA_DETAIL_DATA],
 | 
	
		
			
				|  |  |              data_fields = [];
 | 
	
		
			
				|  |  |          for (let i = 0; i < me.seg_sum_fields_idx.length; i++) {
 | 
	
		
			
				|  |  | -            let data_field = data_details[me.seg_sum_fields_idx[i]];
 | 
	
		
			
				|  |  | -            data_fields.push(data_field);
 | 
	
		
			
				|  |  | +            if (typeof(me.seg_sum_fields_idx[i])=="object") {
 | 
	
		
			
				|  |  | +                let exField = JE.F(me.seg_sum_fields_idx[i][JV.PROP_ID], $CURRENT_RPT);
 | 
	
		
			
				|  |  | +                if (exField) {
 | 
	
		
			
				|  |  | +                    data_fields.push(exField["data_field"]);
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    data_fields.push(null);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            } else {
 | 
	
		
			
				|  |  | +                let data_field = data_details[me.seg_sum_fields_idx[i]];
 | 
	
		
			
				|  |  | +                data_fields.push(data_field);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          for (let i = 0; i < me.segments.length; i++) { //seg level
 | 
	
		
			
				|  |  |              if (me.segments[i].length > 0) {
 | 
	
	
		
			
				|  | @@ -192,7 +205,6 @@ JpcFlowTabSrv.prototype.createNew = function(){
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  me.segSumValLst.push(rowGrandTotal);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      };
 | 
	
		
			
				|  |  |      JpcFlowTabResult.sumUpGrp = function ($CURRENT_RPT, dataObj, segIdx, preGrpIdx, nexGrpIdx) {
 | 
	
	
		
			
				|  | @@ -329,14 +341,17 @@ JpcFlowTabSrv.prototype.createNew = function(){
 | 
	
		
			
				|  |  |                              doc.fontSize(12);
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                          let hasSplitStr = false, splitStrArr = [];
 | 
	
		
			
				|  |  | +                        let accAmt = 0;
 | 
	
		
			
				|  |  |                          for (let i = 0; i < values.length; i++) {
 | 
	
		
			
				|  |  | -                            let amt = JpcCommonHelper.getStringLinesInArea(area, values[i], doc) - 1;
 | 
	
		
			
				|  |  | -                            rst += amt;
 | 
	
		
			
				|  |  | -                            if (amt > 0) {
 | 
	
		
			
				|  |  | +                            let amt = JpcCommonHelper.getStringLinesInArea(area, values[i], doc);
 | 
	
		
			
				|  |  | +                            accAmt += amt;
 | 
	
		
			
				|  |  | +                            // rst += amt;
 | 
	
		
			
				|  |  | +                            if (amt > 1) {
 | 
	
		
			
				|  |  |                                  hasSplitStr = true;
 | 
	
		
			
				|  |  |                                  splitStrArr.push(i);
 | 
	
		
			
				|  |  |                              }
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  | +                        if (accAmt > rst) rst = accAmt;
 | 
	
		
			
				|  |  |                          if (hasSplitStr) {
 | 
	
		
			
				|  |  |                              let newValArr = [];
 | 
	
		
			
				|  |  |                              for (let i = 0; i < values.length; i++) {
 | 
	
	
		
			
				|  | @@ -395,6 +410,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
 | 
	
		
			
				|  |  |          if (followTabEx) {
 | 
	
		
			
				|  |  |              JpcFieldHelper.findAndPutDataFieldIdx(rptTpl, rptTpl[JV.NODE_FLOW_INFO_EX][JV.NODE_FLOW_CONTENT][JV.PROP_FLOW_FIELDS], null, me.disp_fields_ex_idx, true);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        me.sumSeg(dataObj, $CURRENT_RPT); //考虑到实际会有离散指标的汇总,这些离散指标数据是通过计算式后得来的,这种情况下,不适宜在sorting阶段进行汇总统计,现统一挪到这里处理
 | 
	
		
			
				|  |  |          if (me.paging_option === JV.PAGING_OPTION_INFINITY) {
 | 
	
		
			
				|  |  |              rst = me.segments.length;
 | 
	
		
			
				|  |  |              let pageStatus = [true, true, false, true, true, true, false, false];
 | 
	
	
		
			
				|  | @@ -759,8 +775,17 @@ JpcFlowTabSrv.prototype.createNew = function(){
 | 
	
		
			
				|  |  |                  let contentValuesIdx = me.dispValueIdxLst[page - 1];
 | 
	
		
			
				|  |  |                  let page_sum_data_fields = [];
 | 
	
		
			
				|  |  |                  for (let i = 0; i < me.page_sum_fields_idx.length; i++) {
 | 
	
		
			
				|  |  | -                    let data_field = data_details[me.page_sum_fields_idx[i]];
 | 
	
		
			
				|  |  | -                    page_sum_data_fields.push(data_field);
 | 
	
		
			
				|  |  | +                    if (typeof(me.page_sum_fields_idx[i])=="object") {
 | 
	
		
			
				|  |  | +                        let exField = JE.F(me.page_sum_fields_idx[i][JV.PROP_ID], $CURRENT_RPT);
 | 
	
		
			
				|  |  | +                        if (exField) {
 | 
	
		
			
				|  |  | +                            page_sum_data_fields.push(exField["data_field"]);
 | 
	
		
			
				|  |  | +                        } else {
 | 
	
		
			
				|  |  | +                            page_sum_data_fields.push(null);
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        let data_field = data_details[me.page_sum_fields_idx[i]];
 | 
	
		
			
				|  |  | +                        page_sum_data_fields.push(data_field);
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  |                  }
 | 
	
		
			
				|  |  |                  let rowGrandTotal = [];
 | 
	
		
			
				|  |  |                  for (let di = 0; di < page_sum_data_fields.length; di++) {
 | 
	
	
		
			
				|  | @@ -976,11 +1001,13 @@ JpcFlowTabSrv.prototype.createNew = function(){
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |              let rst = JpcCommonOutputHelper.createCommonOutput(tab_field, showText, controls);
 | 
	
		
			
				|  |  |              rst[JV.PROP_AREA] = JpcAreaHelper.outputArea(tab_field[JV.PROP_AREA], band, unitFactor, rows, rowIdx, cols, colIdx, me.multiCols, multiColIdx, true, false);
 | 
	
		
			
				|  |  | +            rst[JV.PROP_IS_AUTO_HEIGHT] = true;
 | 
	
		
			
				|  |  |              return rst;
 | 
	
		
			
				|  |  |          } else {
 | 
	
		
			
				|  |  |              if (contentValInfo[3] > 0) showText = '';
 | 
	
		
			
				|  |  |              let rst = JpcCommonOutputHelper.createCommonOutput(tab_field, showText, controls);
 | 
	
		
			
				|  |  |              rst[JV.PROP_AREA] = JpcAreaHelper.outputArea(tab_field[JV.PROP_AREA], band, unitFactor, rows, rowIdx, cols, colIdx, me.multiCols, multiColIdx, true, false);
 | 
	
		
			
				|  |  | +            rst[JV.PROP_IS_AUTO_HEIGHT] = false;
 | 
	
		
			
				|  |  |              return rst;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      };
 | 
	
	
		
			
				|  | @@ -1055,17 +1082,24 @@ function setupControl(mergeCell, controls) {
 | 
	
		
			
				|  |  |              "Shrink": "T",
 | 
	
		
			
				|  |  |              "ShowZero": orgCtrl.ShowZero,
 | 
	
		
			
				|  |  |              "Horizon": orgCtrl.Horizon,
 | 
	
		
			
				|  |  | -            "Vertical": "top",
 | 
	
		
			
				|  |  | +            "Vertical": orgCtrl.Vertical,
 | 
	
		
			
				|  |  |              "Wrap": "T",
 | 
	
		
			
				|  |  | -            "VerticalForExcel": "justify"
 | 
	
		
			
				|  |  | +            "VerticalForExcel": "center"
 | 
	
		
			
				|  |  |          };
 | 
	
		
			
				|  |  |      } else {
 | 
	
		
			
				|  |  |          mergeCell[JV.PROP_CONTROL].Shrink = "T";
 | 
	
		
			
				|  |  |          mergeCell[JV.PROP_CONTROL].Vertical = "top";
 | 
	
		
			
				|  |  |          mergeCell[JV.PROP_CONTROL].Wrap = "T";
 | 
	
		
			
				|  |  | -        mergeCell[JV.PROP_CONTROL].VerticalForExcel = "justify";
 | 
	
		
			
				|  |  | +        mergeCell[JV.PROP_CONTROL].VerticalForExcel = "center";
 | 
	
		
			
				|  |  |          orgCtrl = mergeCell[JV.PROP_CONTROL];
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +    if (mergeCell[JV.PROP_IS_AUTO_HEIGHT]) {
 | 
	
		
			
				|  |  | +        mergeCell[JV.PROP_CONTROL]["VerticalForExcel"] = 'justify';
 | 
	
		
			
				|  |  | +        // mergeCell[JV.PROP_CONTROL]["Vertical"] = 'center';
 | 
	
		
			
				|  |  | +    } else {
 | 
	
		
			
				|  |  | +        mergeCell[JV.PROP_CONTROL]["VerticalForExcel"] = 'center';
 | 
	
		
			
				|  |  | +        // mergeCell[JV.PROP_CONTROL]["Vertical"] = 'top';
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |      return orgCtrl;
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -1075,31 +1109,92 @@ function combineAutoHeightCells(prepareObj, page, controls) {
 | 
	
		
			
				|  |  |          //merge cells' value and area
 | 
	
		
			
				|  |  |          //备注: 系统逻辑已经把Cell的顺序放好,无需再做排序。
 | 
	
		
			
				|  |  |          for (let mergeKey in prepareObj.pageCellObj) {
 | 
	
		
			
				|  |  | -            if (prepareObj.pageCellObj[mergeKey].length > 1) {
 | 
	
		
			
				|  |  | -                let firstMergeCell = prepareObj.pageCellObj[mergeKey][0].cell;
 | 
	
		
			
				|  |  | +            let sameColCells = prepareObj.pageCellObj[mergeKey]; //左右位置相同的Cell先放在一起,统一处理
 | 
	
		
			
				|  |  | +            if (sameColCells.length > 1) {
 | 
	
		
			
				|  |  | +                let firstMergeCell = sameColCells[0].cell;
 | 
	
		
			
				|  |  | +                firstMergeCell[JV.PROP_STYLE] = firstMergeCell[JV.PROP_STYLE].slice(0, firstMergeCell[JV.PROP_STYLE].indexOf("_AutoHeightMerge")); //首先还原original style
 | 
	
		
			
				|  |  | +                let orgCtrl = setupControl(firstMergeCell, controls);
 | 
	
		
			
				|  |  | +                let validValueAmt = 0, fullValidValueAmt = 0;
 | 
	
		
			
				|  |  | +                for (let i = 1; i < sameColCells.length; i++) {
 | 
	
		
			
				|  |  | +                    let mergeCell = sameColCells[i].cell;
 | 
	
		
			
				|  |  | +                    if (mergeCell[JV.PROP_STYLE].indexOf("_AutoHeightMerge_Top") < 0) {
 | 
	
		
			
				|  |  | +                        fullValidValueAmt++;
 | 
	
		
			
				|  |  | +                        //merge into the firstMergeCell! position & value
 | 
	
		
			
				|  |  | +                        firstMergeCell[JV.PROP_AREA][JV.PROP_BOTTOM] = mergeCell[JV.PROP_AREA][JV.PROP_BOTTOM];
 | 
	
		
			
				|  |  | +                        if (mergeCell[JV.PROP_VALUE]) {
 | 
	
		
			
				|  |  | +                            firstMergeCell[JV.PROP_VALUE] = firstMergeCell[JV.PROP_VALUE] + "|" + mergeCell[JV.PROP_VALUE];
 | 
	
		
			
				|  |  | +                            validValueAmt++;
 | 
	
		
			
				|  |  | +                        } else {
 | 
	
		
			
				|  |  | +                            // firstMergeCell[JV.PROP_VALUE] = firstMergeCell[JV.PROP_VALUE] + "|" ;
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        rst.push(sameColCells[i].cellIdx); //记下Cell的位置,在函数外消除
 | 
	
		
			
				|  |  | +                        //如果到了最后一条数据,得判断firstMergeCell是否满格(即数据是满的,有可能有些格数据也有折行但不是自动行高判断指标)
 | 
	
		
			
				|  |  | +                        //不满格的cell的Vertical强制设置为 'center'
 | 
	
		
			
				|  |  | +                        if (i === sameColCells.length - 1 && validValueAmt !== fullValidValueAmt) {
 | 
	
		
			
				|  |  | +                            // firstMergeCell[JV.PROP_CONTROL].Shrink = orgCtrl.Shrink;
 | 
	
		
			
				|  |  | +                            // firstMergeCell[JV.PROP_CONTROL].Wrap = "F";
 | 
	
		
			
				|  |  | +                            // firstMergeCell[JV.PROP_CONTROL].VerticalForExcel = null;
 | 
	
		
			
				|  |  | +                            firstMergeCell[JV.PROP_CONTROL].VerticalForExcel = 'center';
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                    } else {
 | 
	
		
			
				|  |  | +                        //碰到新开始的自动行高行,判断原先的firstMergeCell是否满格(即数据是满的,有可能有些格数据也有折行但不是自动行高判断指标)
 | 
	
		
			
				|  |  | +                        //不满格的cell的Vertical强制设置为 'center'
 | 
	
		
			
				|  |  | +                        if (validValueAmt !== fullValidValueAmt) {
 | 
	
		
			
				|  |  | +                            // firstMergeCell[JV.PROP_CONTROL].Shrink = orgCtrl.Shrink;
 | 
	
		
			
				|  |  | +                            // firstMergeCell[JV.PROP_CONTROL].Wrap = "F";
 | 
	
		
			
				|  |  | +                            // firstMergeCell[JV.PROP_CONTROL].VerticalForExcel = null;
 | 
	
		
			
				|  |  | +                            firstMergeCell[JV.PROP_CONTROL].VerticalForExcel = 'center';
 | 
	
		
			
				|  |  | +                        }
 | 
	
		
			
				|  |  | +                        firstMergeCell = sameColCells[i].cell;
 | 
	
		
			
				|  |  | +                        firstMergeCell[JV.PROP_STYLE] = firstMergeCell[JV.PROP_STYLE].slice(0, firstMergeCell[JV.PROP_STYLE].indexOf("_AutoHeightMerge"));
 | 
	
		
			
				|  |  | +                        orgCtrl = setupControl(firstMergeCell, controls);
 | 
	
		
			
				|  |  | +                        validValueAmt = 0;
 | 
	
		
			
				|  |  | +                        fullValidValueAmt = 0;
 | 
	
		
			
				|  |  | +                    }
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        rst.sort(function (i1, i2) {
 | 
	
		
			
				|  |  | +            return (i1 > i2)?1:-1;
 | 
	
		
			
				|  |  | +        });
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    return rst;
 | 
	
		
			
				|  |  | +}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +function combineAutoHeightCellsBk(prepareObj, page, controls) {
 | 
	
		
			
				|  |  | +    let rst = [];
 | 
	
		
			
				|  |  | +    if (prepareObj.cellsArr) {
 | 
	
		
			
				|  |  | +        //merge cells' value and area
 | 
	
		
			
				|  |  | +        //备注: 系统逻辑已经把Cell的顺序放好,无需再做排序。
 | 
	
		
			
				|  |  | +        for (let mergeKey in prepareObj.pageCellObj) {
 | 
	
		
			
				|  |  | +            let sameColCells = prepareObj.pageCellObj[mergeKey]; //左右位置相同的Cell先放在一起,统一处理
 | 
	
		
			
				|  |  | +            if (sameColCells.length > 1) {
 | 
	
		
			
				|  |  | +                let firstMergeCell = sameColCells[0].cell;
 | 
	
		
			
				|  |  |                  firstMergeCell[JV.PROP_STYLE] = firstMergeCell[JV.PROP_STYLE].slice(0, firstMergeCell[JV.PROP_STYLE].indexOf("_AutoHeightMerge"));
 | 
	
		
			
				|  |  |                  let orgCtrl = setupControl(firstMergeCell, controls);
 | 
	
		
			
				|  |  |                  let validValueAmt = 0;
 | 
	
		
			
				|  |  | -                for (let i = 1; i < prepareObj.pageCellObj[mergeKey].length; i++) {
 | 
	
		
			
				|  |  | -                    let mergeCell = prepareObj.pageCellObj[mergeKey][i].cell;
 | 
	
		
			
				|  |  | +                for (let i = 1; i < sameColCells.length; i++) {
 | 
	
		
			
				|  |  | +                    let mergeCell = sameColCells[i].cell;
 | 
	
		
			
				|  |  |                      if (mergeCell[JV.PROP_STYLE].indexOf("_AutoHeightMerge_Top") < 0) {
 | 
	
		
			
				|  |  |                          //merge into the firstMergeCell!
 | 
	
		
			
				|  |  |                          firstMergeCell[JV.PROP_AREA][JV.PROP_BOTTOM] = mergeCell[JV.PROP_AREA][JV.PROP_BOTTOM];
 | 
	
		
			
				|  |  |                          firstMergeCell[JV.PROP_VALUE] = firstMergeCell[JV.PROP_VALUE] + "|" + mergeCell[JV.PROP_VALUE];
 | 
	
		
			
				|  |  |                          if (mergeCell[JV.PROP_VALUE]) validValueAmt++;
 | 
	
		
			
				|  |  | -                        rst.push(prepareObj.pageCellObj[mergeKey][i].cellIdx);
 | 
	
		
			
				|  |  | -                        if (i === prepareObj.pageCellObj[mergeKey].length - 1 && validValueAmt === 0) {
 | 
	
		
			
				|  |  | +                        rst.push(sameColCells[i].cellIdx);
 | 
	
		
			
				|  |  | +                        if (i === sameColCells.length - 1 && validValueAmt === 0) {
 | 
	
		
			
				|  |  |                              firstMergeCell[JV.PROP_CONTROL].Shrink = orgCtrl.Shrink;
 | 
	
		
			
				|  |  |                              firstMergeCell[JV.PROP_CONTROL].Wrap = "F";
 | 
	
		
			
				|  |  |                              firstMergeCell[JV.PROP_CONTROL].VerticalForExcel = null;
 | 
	
		
			
				|  |  | +                            // firstMergeCell[JV.PROP_CONTROL].VerticalForExcel = 'center';
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  |                      } else {
 | 
	
		
			
				|  |  |                          if (validValueAmt === 0) {
 | 
	
		
			
				|  |  |                              firstMergeCell[JV.PROP_CONTROL].Shrink = orgCtrl.Shrink;
 | 
	
		
			
				|  |  |                              firstMergeCell[JV.PROP_CONTROL].Wrap = "F";
 | 
	
		
			
				|  |  |                              firstMergeCell[JV.PROP_CONTROL].VerticalForExcel = null;
 | 
	
		
			
				|  |  | +                            // firstMergeCell[JV.PROP_CONTROL].VerticalForExcel = 'center';
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  | -                        firstMergeCell = prepareObj.pageCellObj[mergeKey][i].cell;
 | 
	
		
			
				|  |  | +                        firstMergeCell = sameColCells[i].cell;
 | 
	
		
			
				|  |  |                          firstMergeCell[JV.PROP_STYLE] = firstMergeCell[JV.PROP_STYLE].slice(0, firstMergeCell[JV.PROP_STYLE].indexOf("_AutoHeightMerge"));
 | 
	
		
			
				|  |  |                          orgCtrl = setupControl(firstMergeCell, controls);
 | 
	
		
			
				|  |  |                          validValueAmt = 0;
 |