TonyKang %!s(int64=6) %!d(string=hai) anos
pai
achega
0f4b03199e

+ 25 - 2
modules/reports/rpt_component/jpc_flow_tab.js

@@ -1115,6 +1115,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
                 }
                 }
                 me.pageSumValLst.push(rowGrandTotal);
                 me.pageSumValLst.push(rowGrandTotal);
                 //grouping content
                 //grouping content
+                let grpCntIdx = 0;
                 for (let rowIdx = 0; rowIdx < contentValuesIdx.length; rowIdx++) {
                 for (let rowIdx = 0; rowIdx < contentValuesIdx.length; rowIdx++) {
                     if (contentValuesIdx[rowIdx][1] === JV.DISPLAY_VAL_TYPE_GROUP) {
                     if (contentValuesIdx[rowIdx][1] === JV.DISPLAY_VAL_TYPE_GROUP) {
                         for (let grpIdx = 0; grpIdx < rptTpl[FLOW_NODE_STR][JV.NODE_FLOW_GROUP][JV.PROP_GROUP_LINES].length; grpIdx++) {
                         for (let grpIdx = 0; grpIdx < rptTpl[FLOW_NODE_STR][JV.NODE_FLOW_GROUP][JV.PROP_GROUP_LINES].length; grpIdx++) {
@@ -1130,10 +1131,11 @@ JpcFlowTabSrv.prototype.createNew = function(){
                                         }
                                         }
                                     }
                                     }
                                 }
                                 }
-                                let lineRst = me.outputTabGrpLine(band, grp_line, page, contentValuesIdx[rowIdx], contentValuesIdx.length, rowIdx, 1, 0, unitFactor, true, controls, multiColIdx);
+                                let lineRst = me.outputTabGrpLine(band, grp_line, page, contentValuesIdx[rowIdx], contentValuesIdx.length, rowIdx, 1, 0, unitFactor, true, controls, multiColIdx, grpCntIdx, $CURRENT_RPT);
                                 rst = rst.concat(lineRst);
                                 rst = rst.concat(lineRst);
                             }
                             }
                         }
                         }
+                        grpCntIdx++;
                     }
                     }
                 }
                 }
             }
             }
@@ -1295,7 +1297,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
             return rst;
             return rst;
         }
         }
     };
     };
-    JpcFlowTabResult.outputTabGrpLine = function (band, grp_line, page, grpValueIdx, rows, rowIdx, cols, colIdx, unitFactor, isRow, controls, multiColIdx) {
+    JpcFlowTabResult.outputTabGrpLine = function (band, grp_line, page, grpValueIdx, rows, rowIdx, cols, colIdx, unitFactor, isRow, controls, multiColIdx, grpCntIdx, $CURRENT_RPT) {
         let me = this, rst = [];
         let me = this, rst = [];
         if (grp_line[JV.PROP_GROUP_SUM_KEYS]) {
         if (grp_line[JV.PROP_GROUP_SUM_KEYS]) {
             let segIdx = JpcCommonHelper.getSegIdxByPageIdx(page, me.page_seg_map);
             let segIdx = JpcCommonHelper.getSegIdxByPageIdx(page, me.page_seg_map);
@@ -1309,7 +1311,10 @@ JpcFlowTabSrv.prototype.createNew = function(){
         }
         }
         if (grp_line[JV.PROP_TEXTS]) {
         if (grp_line[JV.PROP_TEXTS]) {
             for (let txt of grp_line[JV.PROP_TEXTS]) {
             for (let txt of grp_line[JV.PROP_TEXTS]) {
+                me.checkGrpTxtOutEvent(JV.RUN_TYPE_BEFORE_GROUP_TEXT_OUT, txt, grpCntIdx, $CURRENT_RPT);
                 rst.push(JpcTextHelper.outputText(txt, band, unitFactor, rows, rowIdx, cols, colIdx, me.multiCols, multiColIdx));
                 rst.push(JpcTextHelper.outputText(txt, band, unitFactor, rows, rowIdx, cols, colIdx, me.multiCols, multiColIdx));
+                // me.combinePageCells(rst, verticalCombinePos, horizonCombinePos);
+                // 可能会有一个After,但意义不大,用不着
             }
             }
         }
         }
         if (grp_line[JV.PROP_DISCRETE_FIELDS]) {
         if (grp_line[JV.PROP_DISCRETE_FIELDS]) {
@@ -1321,6 +1326,24 @@ JpcFlowTabSrv.prototype.createNew = function(){
         // console.log(rst);
         // console.log(rst);
         return rst;
         return rst;
     };
     };
+    JpcFlowTabResult.checkGrpTxtOutEvent = function ($RUN_TYPE, $TEXT, $TIMES, $CURRENT_RPT) {
+        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) {
+                    let expression = $CURRENT_RPT.formulas[execFmlIdx][JV.PROP_EXPRESSION];
+                    if (expression) {
+                        let $ME = $CURRENT_RPT.formulas[execFmlIdx];
+                        try {
+                            eval(expression);
+                        } catch (ex) {
+                            console.log(ex);
+                        }
+                    }
+                }
+            }
+        }
+    };
+
     JpcFlowTabResult.commonTabRestOutput = function(dataObj, page, segIdx, bands, band, unitFactor, tab, multiColIdx){
     JpcFlowTabResult.commonTabRestOutput = function(dataObj, page, segIdx, bands, band, unitFactor, tab, multiColIdx){
         let me = this, rst = [];
         let me = this, rst = [];
         if (tab[JV.PROP_TEXT]) {
         if (tab[JV.PROP_TEXT]) {

+ 2 - 0
public/web/rpt_value_define.js

@@ -210,6 +210,8 @@ const JV = {
     RUN_TYPE_BEFORE_COMBINE: "before_combine",
     RUN_TYPE_BEFORE_COMBINE: "before_combine",
     RUN_TYPE_AFTER_COMBINE: "after_combine",
     RUN_TYPE_AFTER_COMBINE: "after_combine",
 
 
+    RUN_TYPE_BEFORE_GROUP_TEXT_OUT: "before_group_text_output",
+
     PAGE_STATUS: ["EveryPage","FirstPage", "LastPage", "SegmentStart", "SegmentEnd", "Group", "CrossRowEnd", "CrossColEnd"],
     PAGE_STATUS: ["EveryPage","FirstPage", "LastPage", "SegmentStart", "SegmentEnd", "Group", "CrossRowEnd", "CrossColEnd"],
 
 
     CONTROL_PROPS: ["Shrink", "ShowZero", "Horizon", "Vertical", "Wrap", "VerticalForExcel", "ShrinkFirst", "CloseOutput"],
     CONTROL_PROPS: ["Shrink", "ShowZero", "Horizon", "Vertical", "Wrap", "VerticalForExcel", "ShrinkFirst", "CloseOutput"],

+ 1 - 0
web/maintain/report/js/rpt_tpl_calculation.js

@@ -33,6 +33,7 @@ let calculationTreeOprObj = {
         et.append("<option value='" + JV.RUN_TYPE_BEFORE_ANALYZING + "'>数据分析前运行</option>");
         et.append("<option value='" + JV.RUN_TYPE_BEFORE_ANALYZING + "'>数据分析前运行</option>");
         et.append("<option value='" + JV.RUN_TYPE_BEFORE_COMBINE + "'>合并单元格前事件</option>");
         et.append("<option value='" + JV.RUN_TYPE_BEFORE_COMBINE + "'>合并单元格前事件</option>");
         et.append("<option value='" + JV.RUN_TYPE_AFTER_COMBINE + "'>合并单元格后事件</option>");
         et.append("<option value='" + JV.RUN_TYPE_AFTER_COMBINE + "'>合并单元格后事件</option>");
+        et.append("<option value='" + JV.RUN_TYPE_BEFORE_GROUP_TEXT_OUT + "'>分组text输出前事件</option>");
     },
     },
     buildTreeData: function (rptTpl) {
     buildTreeData: function (rptTpl) {
         let me = this, rst = {"Name": "计算式", items: []};
         let me = this, rst = {"Name": "计算式", items: []};