Browse Source

code sync(增加对清单标记的处理)

TonyKang 7 years ago
parent
commit
1d390449bc

+ 3 - 0
modules/reports/rpt_component/helper/jpc_helper_discrete.js

@@ -71,6 +71,9 @@ let JpcDiscreteHelper = {
                     for (let j = 0; j < discreteArray[i][JV.PROP_DISCRETE_FIELDS].length; j++) {
                         let df = discreteArray[i][JV.PROP_DISCRETE_FIELDS][j];
                         let value = "";
+                        if (df[JV.PROP_DFT_VALUE]) {
+                            value = df[JV.PROP_DFT_VALUE];
+                        }
                         let item = JpcCommonOutputHelper.createCommonOutputWithoutDecorate(df, value, null);
                         //position
                         item[JV.PROP_AREA] = JpcAreaHelper.outputArea(df[JV.PROP_AREA], band, unitFactor, 1, 0, 1, 0, 1, 0, false, false);

+ 34 - 0
modules/reports/util/rpt_construct_data_util.js

@@ -803,6 +803,7 @@ function setupFunc(obj, prop, ownRawObj) {
     obj[prop].getProperty = ext_getPropety;
     obj[prop].getFee = ext_getFee;
     obj[prop].getPropertyByForeignId = ext_getPropertyByForeignId;
+    obj[prop].getArrayValues = ext_getArrayValues;
     obj[prop].getArrayItemByKey = ext_getArrayItemByKey;
     obj[prop].getPropertyByFlag = ext_getPropertyByFlag;
     obj[prop].getBlank = ext_getBlank;
@@ -1055,6 +1056,39 @@ function ext_getFeeRate(fee_Ids){
     return rst;
 }
 
+function ext_getArrayValues(itemKey) {
+    let rst = [], parentObj = this;
+    let dtObj = parentObj["myOwnRawDataObj"];
+    let keysArr = itemKey.split(".");
+    for (let dataItem of dtObj.data) {
+        let itemArr = [];
+        if (keysArr.length <= 2) {
+            if (dataItem[keysArr[0]] instanceof Array) {
+                if (keysArr.length === 2) {
+                    for (let item of dataItem[keysArr[0]]) {
+                        itemArr.push(item[keysArr[1]]);
+                    }
+                } else {
+                    itemArr = itemArr.concat(dataItem[keysArr[0]]);
+                }
+            } else {
+                if (keysArr.length === 2) {
+                    let subProperty = dataItem[keysArr[0]][keysArr[1]];
+                    if (subProperty instanceof Array) {
+                        itemArr = itemArr.concat(subProperty);
+                    } else {
+                        itemArr.push(subProperty);
+                    }
+                } else {
+                    itemArr.push(dataItem[keysArr[0]]);
+                }
+            }
+        }
+        rst.push(itemArr);
+    }
+    return rst;
+}
+
 function ext_getArrayItemByKey(arrayKey, itemKey, itemKeyValue, itemRstKey){
     let rst = [], parentObj = this;
     let dtObj = parentObj["myOwnRawDataObj"];

+ 12 - 2
web/maintain/report/js/rpt_tpl_cfg_helper.js

@@ -73,7 +73,7 @@ let rpt_tpl_cfg_helper = {
             $("#element_border")[0].style.display = "";
             $("#element_control")[0].style.display = "";
             $("#element_area_1")[0].style.display = "";
-            $("#element_area_2")[0].style.display = "";
+            // $("#element_area_2")[0].style.display = "";
             if (treeNode[JV.PROP_FIELD_ID] || treeNode[JV.PROP_PARAM_ID]) {
                 $("#element_pre_suff")[0].style.display = "";
                 if (treeNode[JV.PROP_PREFIX]) {
@@ -91,6 +91,11 @@ let rpt_tpl_cfg_helper = {
                 } else {
                     $("#eleFormat").get(0).value = "";
                 }
+                if (treeNode[JV.PROP_DFT_VALUE]) {
+                    $("#eleDftValue").get(0).value = treeNode[JV.PROP_DFT_VALUE];
+                } else {
+                    $("#eleDftValue").get(0).value = "";
+                }
             } else {
                 $("#element_pre_suff")[0].style.display = "none";
             }
@@ -130,7 +135,7 @@ let rpt_tpl_cfg_helper = {
             $("#element_border")[0].style.display = "none";
             $("#element_control")[0].style.display = "none";
             $("#element_area_1")[0].style.display = "none";
-            $("#element_area_2")[0].style.display = "none";
+            // $("#element_area_2")[0].style.display = "none";
             $("#element_pre_suff")[0].style.display = "none";
         }
     },
@@ -307,6 +312,11 @@ let rpt_tpl_cfg_helper = {
             dataInfoMapTreeOprObj.currentNode[JV.PROP_FORMAT] = dom.value;
         }
     },
+    changeDftValue: function (dom) {
+        if (dataInfoMapTreeOprObj.currentNode) {
+            dataInfoMapTreeOprObj.currentNode[JV.PROP_DFT_VALUE] = dom.value;
+        }
+    },
     changeAutoHeight: function(dom) {
         if (dataInfoMapTreeOprObj.currentNode) {
             dataInfoMapTreeOprObj.currentNode[JV.PROP_IS_AUTO_HEIGHT] = dom.checked;

+ 21 - 4
web/maintain/report/js/rpt_tpl_data_map.js

@@ -19,7 +19,7 @@ let dataInfoMapTreeOprObj = {
         $("#element_border")[0].style.display = "none";
         $("#element_control")[0].style.display = "none";
         $("#element_area_1")[0].style.display = "none";
-        $("#element_area_2")[0].style.display = "none";
+        // $("#element_area_2")[0].style.display = "none";
         $("#element_pre_suff")[0].style.display = "none";
     },
     iniDataMap: function () {
@@ -256,6 +256,12 @@ let dataInfoMapTreeOprObj = {
             let p = me.private_get_param_by_id(param[JV.PROP_PARAM_ID], rptTpl);
             if (p) {
                 rst[JV.PROP_NAME] = p[JV.PROP_NAME];
+                if (param[JV.PROP_DFT_VALUE]) {
+                    p[JV.PROP_DFT_VALUE] = param[JV.PROP_DFT_VALUE];
+                } else if (p[JV.PROP_DFT_VALUE]) {
+                    param[JV.PROP_DFT_VALUE] = p[JV.PROP_DFT_VALUE];
+                }
+                rst[JV.PROP_DFT_VALUE] = p[JV.PROP_DFT_VALUE];
             } else {
                 rst[JV.PROP_NAME] = param[JV.PROP_PARAM_ID];
             }
@@ -273,6 +279,11 @@ let dataInfoMapTreeOprObj = {
         destination[JV.PROP_PREFIX] = source[JV.PROP_PREFIX];
         destination[JV.PROP_SUFFIX] = source[JV.PROP_SUFFIX];
         if (source[JV.PROP_FORMAT]) destination[JV.PROP_FORMAT] = source[JV.PROP_FORMAT];
+        if (source[JV.PROP_DFT_VALUE]) {
+            destination[JV.PROP_DFT_VALUE] = source[JV.PROP_DFT_VALUE];
+        } else {
+            destination[JV.PROP_DFT_VALUE] = "";
+        }
         destination[JV.PROP_AREA] = {};
         me.private_copy_area(source[JV.PROP_AREA], destination[JV.PROP_AREA]);
     },
@@ -505,7 +516,7 @@ let dataInfoMapTreeOprObj = {
             let nodes = me.treeObj.getNodes();
             for (let node of nodes) {
                 if (node[JV.PROP_NAME] === JV.NODE_DISCRETE_INFO) {
-                    rptTpl[JV.NODE_FLOW_INFO][JV.NODE_DISCRETE_INFO] = me.private_extract_discrete_info(node);
+                    rptTpl[JV.NODE_FLOW_INFO][JV.NODE_DISCRETE_INFO] = me.private_extract_discrete_info(node, rptTpl);
                 } else if (node[JV.PROP_NAME] === JV.NODE_FLOW_CONTENT) {
                     let newContent = {};
                     newContent[JV.PROP_BAND_NAME] = node[JV.PROP_BAND_NAME];
@@ -558,7 +569,7 @@ let dataInfoMapTreeOprObj = {
                     }
                     rptTpl[JV.NODE_BILL_INFO][JV.NODE_BILL_CONTENT] = newContent;
                 } else if (node[JV.PROP_NAME] === JV.NODE_DISCRETE_INFO) {
-                    rptTpl[JV.NODE_BILL_INFO][JV.NODE_DISCRETE_INFO] = me.private_extract_discrete_info(node);
+                    rptTpl[JV.NODE_BILL_INFO][JV.NODE_DISCRETE_INFO] = me.private_extract_discrete_info(node, rptTpl);
                 }
             }
         }
@@ -585,7 +596,7 @@ let dataInfoMapTreeOprObj = {
         }
         return rst;
     },
-    private_extract_discrete_info: function(discreteNode) {
+    private_extract_discrete_info: function(discreteNode, rptTpl) {
         let me = this, rst = [];
         for (let dtlItemNode of discreteNode.items) {
             let newContent = {};
@@ -601,6 +612,12 @@ let dataInfoMapTreeOprObj = {
                         if (field[JV.PROP_FIELD_ID]) {
                             me.private_copy_field_properties(field, item);
                         } else if (field[JV.PROP_PARAM_ID]) {
+                            let p = me.private_get_param_by_id(field[JV.PROP_PARAM_ID], rptTpl);
+                            if (p) {
+                                if (field[JV.PROP_DFT_VALUE]) {
+                                    p[JV.PROP_DFT_VALUE] = field[JV.PROP_DFT_VALUE];
+                                }
+                            }
                             me.private_copy_param_properties(field, item);
                         }
                     }

+ 1 - 1
web/maintain/report/rpt_tpl_detail.html

@@ -1,4 +1,4 @@
-<div class="col-lg-5 p-0">
+<div class="col-lg-6 p-0">
     <div class="main-data-top">
         <ul class="nav nav-tabs tools-bar" role="tablist">
             <li class="nav-item">

+ 26 - 31
web/maintain/report/rpt_tpl_detail_field_location.html

@@ -27,7 +27,7 @@
                     <input class="form-control input-sm" id="eleFontSize" type="number" value="12" step="1" min="6" max="56" onchange="rpt_tpl_cfg_helper.fontSizeChange(this)" disabled>
                 </div>
                 <div class="form-group col-md-4">
-                    <label></label>
+                    <label>字体其他特性</label>
                     <div class="form-check">
                         <label class="form-check-label">
                             <input type="checkbox" class="form-check-input" id="eleFontBold" onchange="rpt_tpl_cfg_helper.fontBoldChange(this)" disabled>
@@ -80,7 +80,7 @@
                     <select class="form-control" id="elementAlignmentVertical" onchange="rpt_tpl_cfg_helper.changeAlignment(this, 'vertical')" disabled></select>
                 </div>
                 <div class="form-group col-md-5">
-                    <label></label>
+                    <label>控制其他特性</label>
                     <div class="form-check">
                         <label class="form-check-label">
                             <input type="checkbox" class="form-check-input" id="eleShrink" onchange="" disabled>
@@ -98,47 +98,46 @@
                 </div>
             </div>
             <div class="row" id="element_area_1">
-                <div class="form-group col-md-3">
-                    <label>输出区域-左</label>
-                    <input class="form-control input-sm" id="elementArea_Left" type="number" value="0" step="1" min="0" max="100" onchange="rpt_tpl_cfg_helper.changeArea(this, 'Left')" onkeyup="rpt_tpl_cfg_helper.changeArea(this, 'Left')">
-                </div>
-                <div class="form-group col-md-3">
-                    <label>输出区域-右</label>
-                    <input class="form-control input-sm" id="elementArea_Right" type="number" value="0" step="1" min="0" max="100" onchange="rpt_tpl_cfg_helper.changeArea(this, 'Right')" onkeyup="rpt_tpl_cfg_helper.changeArea(this, 'Right')">
-                </div>
-                <div class="form-group col-md-3">
-                    <label>输出区域-上</label>
-                    <input class="form-control input-sm" id="elementArea_Top" type="number" value="0" step="1" min="0" max="100" onchange="rpt_tpl_cfg_helper.changeArea(this, 'Top')" onkeyup="rpt_tpl_cfg_helper.changeArea(this, 'Top')">
-                </div>
-                <div class="form-group col-md-3">
-                    <label>输出区域-下</label>
-                    <input class="form-control input-sm" id="elementArea_Bottom" type="number" value="0" step="1" min="0" max="100" onchange="rpt_tpl_cfg_helper.changeArea(this, 'Bottom')" onkeyup="rpt_tpl_cfg_helper.changeArea(this, 'Bottom')">
-                </div>
-            </div>
-            <div class="row" id="element_area_2">
-                <div class="form-group col-md-3">
+                <div class="form-group col-md-2">
+                    <label>左</label><label>&nbsp&nbsp&nbsp</label>
                     <label class="form-check-label">
                         <input type="checkbox" class="form-check-input" id="isPercentage_Left" onchange="rpt_tpl_cfg_helper.changeAreaCalcType(this, 'Left')">
                         百分比
                     </label>
+                    <input class="form-control input-sm" id="elementArea_Left" type="number" value="0" step="1" min="0" max="100" onchange="rpt_tpl_cfg_helper.changeArea(this, 'Left')" onkeyup="rpt_tpl_cfg_helper.changeArea(this, 'Left')">
                 </div>
-                <div class="form-group col-md-3">
+                <div class="form-group col-md-2">
+                    <label>右</label><label>&nbsp&nbsp&nbsp</label>
                     <label class="form-check-label">
                         <input type="checkbox" class="form-check-input" id="isPercentage_Right" onchange="rpt_tpl_cfg_helper.changeAreaCalcType(this, 'Right')">
                         百分比
                     </label>
+                    <input class="form-control input-sm" id="elementArea_Right" type="number" value="0" step="1" min="0" max="100" onchange="rpt_tpl_cfg_helper.changeArea(this, 'Right')" onkeyup="rpt_tpl_cfg_helper.changeArea(this, 'Right')">
                 </div>
-                <div class="form-group col-md-3">
+                <div class="form-group col-md-2">
+                    <label>上</label><label>&nbsp&nbsp&nbsp</label>
                     <label class="form-check-label">
                         <input type="checkbox" class="form-check-input" id="isPercentage_Top" onchange="rpt_tpl_cfg_helper.changeAreaCalcType(this, 'Top')">
                         百分比
                     </label>
+                    <input class="form-control input-sm" id="elementArea_Top" type="number" value="0" step="1" min="0" max="100" onchange="rpt_tpl_cfg_helper.changeArea(this, 'Top')" onkeyup="rpt_tpl_cfg_helper.changeArea(this, 'Top')">
                 </div>
-                <div class="form-group col-md-3">
+                <div class="form-group col-md-2">
+                    <label>下</label><label>&nbsp&nbsp&nbsp</label>
                     <label class="form-check-label">
                         <input type="checkbox" class="form-check-input" id="isPercentage_Bottom" onchange="rpt_tpl_cfg_helper.changeAreaCalcType(this, 'Bottom')">
                         百分比
                     </label>
+                    <input class="form-control input-sm" id="elementArea_Bottom" type="number" value="0" step="1" min="0" max="100" onchange="rpt_tpl_cfg_helper.changeArea(this, 'Bottom')" onkeyup="rpt_tpl_cfg_helper.changeArea(this, 'Bottom')">
+                </div>
+                <div class="form-group col-md-2">
+                    <label>&nbsp&nbsp&nbsp</label>
+                    <div class="form-check">
+                        <label class="form-check-label">
+                            <input type="checkbox" class="form-check-input" id="eleAutoHeight" onchange="rpt_tpl_cfg_helper.changeAutoHeight(this)">
+                            自动行高
+                        </label>&nbsp&nbsp
+                    </div>
                 </div>
             </div>
             <div class="row" id="element_pre_suff">
@@ -155,15 +154,11 @@
                     <input class="form-control" id="eleFormat" value="" onkeyup="rpt_tpl_cfg_helper.changeFormat(this)">
                 </div>
                 <div class="input-group col-3">
-                    <label></label>
-                    <div class="form-check">
-                        <label class="form-check-label">
-                            <input type="checkbox" class="form-check-input" id="eleAutoHeight" onchange="rpt_tpl_cfg_helper.changeAutoHeight(this)">
-                            自动行高调整
-                        </label>&nbsp&nbsp
-                    </div>
+                    <div class="input-group-addon">默认值</div>
+                    <input class="form-control" id="eleDftValue" value="" onkeyup="rpt_tpl_cfg_helper.changeDftValue(this)">
                 </div>
             </div>
+            <br/>
             <div class="row">
                 <div class="form-group col-md-7">
                     <div class="form-group">

+ 1 - 1
web/maintain/report/rpt_tpl_preview.html

@@ -1,4 +1,4 @@
-<div class="form-view col-lg-7 p-0">
+<div class="form-view col-lg-6 p-0">
     <div class="main-data-h" style="position:relative">
         <div class="sub-button p-2">
             <button class="btn btn-primary" onclick="tplHelper.saveRptTpl()">保存</button>