Pārlūkot izejas kodu

code sync + 指标combine特性

TonyKang 6 gadi atpakaļ
vecāks
revīzija
12d8b8937a

+ 9 - 0
modules/reports/rpt_component/jpc_flow_tab.js

@@ -819,6 +819,15 @@ JpcFlowTabSrv.prototype.createNew = function(){
         }
         return rst;
     };
+    JpcFlowTabResult.combinePageCells = function (rptTpl, pageCells) {
+        let me = this;
+        let FLOW_NODE_STR = me.isEx?JV.NODE_FLOW_INFO_EX:JV.NODE_FLOW_INFO;
+        let tab = rptTpl[FLOW_NODE_STR][JV.NODE_FLOW_CONTENT];
+        let tab_fields = tab[JV.PROP_FLOW_FIELDS];
+        for (let tabField of tab_fields) {
+            // tabField[JV.PROP_]
+        }
+    };
     JpcFlowTabResult.outputPreviewContent = function(rptTpl, bands, unitFactor, controls, pageStatus, maxRec) {
         let me = this, rst = [];
         let tab = rptTpl[JV.NODE_FLOW_INFO][JV.NODE_FLOW_CONTENT];

+ 15 - 4
modules/reports/util/rpt_excel_util.js

@@ -275,24 +275,35 @@ function writeStyles(stylesObj){
 }
 function writeSharedString(sharedStrList){
     let rst = [];
+    let pri_func_write = function(cellVal) {
+        if (cellVal !== null) {
+            if ((typeof cellVal === 'string') && cellVal.indexOf(' ') === 0) {
+                rst.push('<si><t xml:space="preserve">' + cellVal + '</t></si>');
+            } else {
+                rst.push('<si><t>' + cellVal + '</t></si>');
+            }
+        }
+    };
     if (sharedStrList && sharedStrList.length > 0) {
         rst.push(dftHeadXml + '\r\n');
         rst.push('<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="' + sharedStrList.length + '" uniqueCount="' + sharedStrList.length + '">');
         let regExp = new RegExp("<", "gm");
         for (let i = 0; i < sharedStrList.length; i++) {
-            //rst.push('<si><t>' + sharedStrList[i] + '</t></si>');
             if (typeof sharedStrList[i] === 'string') {
                 //转换特殊字符,如 < , 则需要转义一下
                 sharedStrList[i] = sharedStrList[i].replace(regExp, "&lt;");
                 if (sharedStrList[i].indexOf('|') >= 0) {
                     //rst.push('<si><t>' + sharedStrList[i].split('|').join('\r\n') + '</t></si>');
-                    rst.push('<si><t>' + sharedStrList[i].split('|').join('\n') + '</t></si>');
+                    // rst.push('<si><t>' + sharedStrList[i].split('|').join('\n') + '</t></si>');
+                    pri_func_write(sharedStrList[i].split('|').join('\n'));
                 } else {
-                    rst.push('<si><t>' + sharedStrList[i] + '</t></si>');
+                    // rst.push('<si><t>' + sharedStrList[i] + '</t></si>');
+                    pri_func_write(sharedStrList[i]);
                 }
                 // rst.push('<si><t>' + sharedStrList[i].replace('|','\r\n') + '</t></si>');
             } else {
-                rst.push('<si><t>' + sharedStrList[i] + '</t></si>');
+                // rst.push('<si><t>' + sharedStrList[i] + '</t></si>');
+                pri_func_write(sharedStrList[i]);
             }
         }
         rst.push('</sst>');

+ 1 - 0
public/web/rpt_value_define.js

@@ -120,6 +120,7 @@ const JV = {
     PROP_POSITION: "Position",
     PROP_HIDDEN: "Hidden",
     PROP_IS_SERIAL: "isSerial",
+    PROP_COMBINE_TYPE: "combineType",
     PROP_IS_AUTO_HEIGHT: "isAutoHeight",
     PROP_FONT: "font",
     PROP_CONTROL: "control",

+ 28 - 0
web/maintain/report/js/rpt_tpl_data_map.js

@@ -403,6 +403,7 @@ let dataInfoMapTreeOprObj = {
         if (source[JV.PROP_HIDDEN]) destination[JV.PROP_HIDDEN] = true;
         if (source[JV.PROP_IS_SERIAL]) destination[JV.PROP_IS_SERIAL] = true;
         if (source[JV.TAB_FIELD_PROP_SORT]) destination[JV.TAB_FIELD_PROP_SORT] = source[JV.TAB_FIELD_PROP_SORT];
+        if (source[JV.PROP_COMBINE_TYPE]) destination[JV.PROP_COMBINE_TYPE] = source[JV.PROP_COMBINE_TYPE];
         if (source[JV.PROP_AREA]) {
             destination[JV.PROP_AREA] = {};
             me.private_copy_area(source[JV.PROP_AREA], destination[JV.PROP_AREA]);
@@ -632,6 +633,10 @@ let dataInfoMapTreeOprObj = {
         }
         return rst;
     },
+    checkIfCanAddFieldCombine: function (treeNode) {
+        let rst = (treeNode.getParentNode() !== null && treeNode.getParentNode().Name === `流水式表_数据`);
+        return rst;
+    },
     bandSelectChange: function(dom, treeNodeId) {
         let me = dataInfoMapTreeOprObj, node = me.treeObj.getNodeByTId(treeNodeId);
         if (dom.selectedIndex > 0) {
@@ -640,6 +645,14 @@ let dataInfoMapTreeOprObj = {
             node[JV.PROP_BAND_NAME] = "";
         }
     },
+    combineSelectChange: function(dom, treeNodeId) {
+        let me = dataInfoMapTreeOprObj, node = me.treeObj.getNodeByTId(treeNodeId);
+        if (dom.selectedIndex > 0) {
+            node[JV.PROP_COMBINE_TYPE] = dom.value;
+        } else {
+            node[JV.PROP_COMBINE_TYPE] = null;
+        }
+    },
     addDiyDom: function (treeId, treeNode) {
         let me = dataInfoMapTreeOprObj, aObj = $("#" + treeNode.tId + IDMark_A);
         //加band selection
@@ -647,6 +660,21 @@ let dataInfoMapTreeOprObj = {
             //准备加selection
             let addBandStr = "<select class='selDemo' id='diySelect_" +treeNode.tId+ "' onchange='dataInfoMapTreeOprObj.bandSelectChange(this, \"" + treeNode.tId + "\")'></select>";
             aObj.after(addBandStr);
+        } else if (me.checkIfCanAddFieldCombine(treeNode)) {
+            let addBandStr = "<select class='selDemo' id='diyCombineSelect_" +treeNode.tId+ "' onchange='dataInfoMapTreeOprObj.combineSelectChange(this, \"" + treeNode.tId + "\")'><option value='none'>请选择</option><option value='vertical'>纵向合并</option><option value='horizon'>横向合并</option></select>";
+            aObj.after(addBandStr);
+            let selectCombineObj = $("#diyCombineSelect_" +treeNode.tId);
+            if (treeNode.hasOwnProperty(JV.PROP_COMBINE_TYPE)) {
+                if (treeNode[JV.PROP_COMBINE_TYPE] === 'vertical') {
+                    selectCombineObj[0].selectedIndex = 1;
+                } else if (treeNode[JV.PROP_COMBINE_TYPE] === 'horizon') {
+                    selectCombineObj[0].selectedIndex = 2;
+                } else {
+                    selectCombineObj[0].selectedIndex = 0;
+                }
+            } else {
+                selectCombineObj[0].selectedIndex = 0;
+            }
         }
     },
     addHoverDom: function(treeId, treeNode) {