Prechádzať zdrojové kódy

定义默认全局参数1.0

MaiXinRong 7 rokov pred
rodič
commit
022e6677bd

+ 98 - 4
app/const/template_param.js

@@ -76,21 +76,115 @@ const defaultGlobalParams = [
         node_id: 0,
         param_id: 4,
         code: 'g_d',
-        name: '路线总长度(主线长度)',
-        match_type: matchType.non_match,
+        name: '路线总长度',
+        match_type: matchType.fixed_id,
+        match_key: '1',
+        matchNum: matchNum.dgn_quantity1,
     },{
         template_id: 1,
         node_id: 0,
         param_id: 5,
         code: 'g_e',
-        name: '建筑总面积{路线总长度(主线长度)×路基(或桥隧)宽度}',
+        name: '建筑总面积',
         match_type: matchType.non_match,
     },{
         template_id: 1,
         node_id: 0,
         param_id: 6,
         code: 'g_f',
-        name: '路基长度(指不含桥梁、隧道的路基长度(双幅平均计))',
+        name: '路基长度',
+        match_type: matchType.code,
+        match_key: '1-2',
+        match_num: matchNum.dgn_quantity1,
+    },  {
+        template_id: 1,
+        node_id: 0,
+        param_id: 6,
+        code: 'g_g',
+        name: '桥梁建筑面积',
+        match_type: matchType.non_match,
+    },{
+        template_id: 1,
+        node_id: 0,
+        param_id: 6,
+        code: 'g_h',
+        name: '桥梁长度(含互通主线)',
+        match_type: matchType.code,
+        match_key: '1-4',
+        match_num: matchNum.dgn_quantity1,
+    }, {
+        template_id: 1,
+        node_id: 0,
+        param_id: 6,
+        code: 'g_i',
+        name: '路面铺装体积',
+        match_type: matchType.non_match,
+    }, {
+        template_id: 1,
+        node_id: 0,
+        param_id: 6,
+        code: 'g_j',
+        name: '桥梁建筑面积',
+        match_type: matchType.non_match,
+    }, {
+        template_id: 1,
+        node_id: 0,
+        param_id: 6,
+        code: 'g_k',
+        name: '桥梁用筋重量',
+        match_type: matchType.non_match,
+    }, {
+        template_id: 1,
+        node_id: 0,
+        param_id: 6,
+        code: 'g_l',
+        name: '桥梁混凝土体积',
+        match_type: matchType.non_match,
+    }, {
+        template_id: 1,
+        node_id: 0,
+        param_id: 6,
+        code: 'g_m',
+        name: '交叉工程总占地面积',
+        match_type: matchType.non_match,
+    }, {
+        template_id: 1,
+        node_id: 0,
+        param_id: 6,
+        code: 'g_n',
+        name: '隧道长度',
+        match_type: matchType.code,
+        match_key: '1-6',
+        match_num: matchNum.dgn_quantity1,
+    }, {
+        template_id: 1,
+        node_id: 0,
+        param_id: 6,
+        code: 'g_o',
+        name: '隧道建筑面积',
+        match_type: matchType.non_match,
+    }, {
+        template_id: 1,
+        node_id: 0,
+        param_id: 6,
+        code: 'g_p',
+        name: '房建总占地面积',
+        match_type: matchType.code,
+        match_key: '1-9',
+        match_num: matchNum.dgn_quantity1,
+    }, {
+        template_id: 1,
+        node_id: 0,
+        param_id: 6,
+        code: 'g_q',
+        name: '房建处数',
+        match_type: matchType.non_match,
+    }, {
+        template_id: 1,
+        node_id: 0,
+        param_id: 6,
+        code: 'g_r',
+        name: '计划工期',
         match_type: matchType.non_match,
     },
 ];

+ 17 - 2
app/public/js/template.js

@@ -143,7 +143,7 @@ $(document).ready(function () {
         });
     });
     // 指标参数,绑定参数取值(分项编号)
-    $('input[name=paramMatchCode]').blur(function () {
+    $('input[name=nodeParamMatchCode]').blur(function () {
         const self = $(this);
         if (self.val() === self.attr('org-value')) { return; }
         const nodeId = GetUrlQueryString('id');
@@ -154,9 +154,24 @@ $(document).ready(function () {
             match_key: $(this).val(),
         }, function (data) {
             self.attr('org-value', data.match_key);
+        }, function () {
+            self.val(self.attr('org-value'));
+        })
+    });
+    // 指标参数,绑定参数取值(分项编号)
+    $('input[name=globalParamMatchCode]').blur(function () {
+        const self = $(this);
+        if (self.val() === self.attr('org-value')) { return; }
+        const nodeId = GetUrlQueryString('id');
+        const paramCode = $(this).parent().parent().prev().attr('code');
+        postData('/template/updateParamMatch', {
+            node_id: 0,
+            code: paramCode,
+            match_key: $(this).val(),
         }, function (data) {
-            self.val(data.match_key);
             self.attr('org-value', data.match_key);
+        }, function () {
+            self.val(self.attr('org-value'));
         })
     });
     // 指标参数,选择取值类别

+ 2 - 2
app/view/template/index.ejs

@@ -79,7 +79,7 @@
                                                             <% } %>
                                                         </div>
                                                     </div>
-                                                    <input name="paramMatchCode" type="text" class="form-control" aria-label="Text input with dropdown button" value="<%- n.match_key %>" org-value="<%- n.match_key %>">
+                                                    <input name="nodeParamMatchCode" type="text" class="form-control" aria-label="Text input with dropdown button" value="<%- n.match_key %>" org-value="<%- n.match_key %>">
                                                 </div>
                                                 <% } else { %>
                                                 <small class="text-muted">(自动绑定)</small>
@@ -118,7 +118,7 @@
                                                             <% } %>
                                                         </div>
                                                     </div>
-                                                    <input name="paramMatchCode" type="text" class="form-control" aria-label="Text input with dropdown button">
+                                                    <input name="globalParamMatchCode" type="text" class="form-control" aria-label="Text input with dropdown button" value="<%- p.match_key %>" org-value="<%- p.match_key %>">
                                                 </div>
                                                 <% } else { %>
                                                 <small class="text-muted">(自动绑定)</small>