瀏覽代碼

Merge branch 'master' of http://smartcost.f3322.net:3000/MaiXinRong/IndexSystem

MaiXinRong 7 年之前
父節點
當前提交
d167ffbe47

+ 1 - 1
app/controller/lib_controller.js

@@ -214,7 +214,7 @@ module.exports = app => {
                 if (isNaN(id) || id <= 0) {
                     throw '参数错误';
                 }
-                if(text === undefined || text !== '确认删除'){
+                if(text === undefined || text.trim() !== '确认删除'){
                     throw '参数错误';
                 }
                 //获取指标源数据

+ 3 - 2
app/public/js/global.js

@@ -1,9 +1,10 @@
 /*全局自适应高度*/
 function autoFlashHeight(){
     var cHeader = $(".c-header").height();
+    var toptitle = $(".top-title").height();
+    var bottomtitle = $(".bottom-title").height();
     $(".sjs-height-1").height($(window).height()-cHeader-160);
-    $(".sjs-height-2").height($(window).height()-cHeader-191);
-    $(".sjs-height-3").height($(window).height()-cHeader-520);
+    $(".sjs-height-3").height($(window).height()-cHeader-toptitle-bottomtitle-552);
 };
 $(window).resize(autoFlashHeight);
 /*全局自适应高度结束*/

+ 30 - 22
app/public/js/lib_detail.js

@@ -65,31 +65,38 @@ $(document).ready(function() {
                 bills_id: billsInfo.id
             };
             postData(postUrl, postInfo, function (result) {
-                let index_html = '';
-                const index_list = result.indexList;
-                for(let i in index_list) {
-                    index_html += '<tr> <td>'+ index_list[i].code +'</td> <td>'+ index_list[i].name +'</td>' +
-                        '<td>'+ (index_list[i].unit1 !== null ? index_list[i].unit1 : '') +'</td>' +
-                        '<td>'+ (index_list[i].unit2 !== null ? index_list[i].unit2 : '') +'</td>' +
-                        '<td>'+ index_list[i].rule +'</td> <td>'+ (index_list[i].eval_rule !== null ? index_list[i].eval_rule : '') +'</td>' +
-                        '<td>'+ (index_list[i].value !== null ? index_list[i].value : '') +'</td> </tr>';
-                }
-                $('#indexList').html(index_html);
-
-                let param_html = '';
-                const param_list = result.paramList;
-                for(let i in param_list) {
-                    param_list[i].calc_value = param_list[i].calc_value !== null ? param_list[i].calc_value : '';
-                    let subNode = param_list[i].match_type === 3 ? '(自动绑定)' : (param_list[i].match_type === 4 ? param_list[i].match_key : '');
-                    param_html += '<tr> <td>'+ param_list[i].name +'</td><td>'+ subNode +'</td>' +
-                        '<td><input type="number" class="form-control form-control-sm" value="'+ param_list[i].calc_value +'" ' +
-                        'data-old-value="'+ param_list[i].calc_value +'" data-lib-id="'+ param_list[i].lib_id +'" ' +
-                        'data-node-id="'+ param_list[i].node_id +'" data-code="'+ param_list[i].code +'"></td> </tr>';
-                }
-                $('#paramList').html(param_html);
+                updateIndexHTML(result.indexList);
+                updateParamHTML(result.paramList);
             });
         }
     }
+    
+    function updateIndexHTML(indexlist) {
+        let index_html = '';
+        const index_list = indexlist;
+        for(let i in index_list) {
+            index_html += '<tr> <td>'+ index_list[i].code +'</td> <td>'+ index_list[i].name +'</td>' +
+                '<td>'+ (index_list[i].unit1 !== null ? index_list[i].unit1 : '') +'</td>' +
+                '<td>'+ (index_list[i].unit2 !== null ? index_list[i].unit2 : '') +'</td>' +
+                '<td>'+ index_list[i].rule +'</td> <td class="text-right">'+ (index_list[i].eval_rule !== null ? index_list[i].eval_rule : '') +'</td>' +
+                '<td class="text-right">'+ (index_list[i].value !== null ? index_list[i].value : '') +'</td> </tr>';
+        }
+        $('#indexList').html(index_html);
+    }
+    
+    function updateParamHTML(paramlist) {
+        let param_html = '';
+        const param_list = paramlist;
+        for(let i in param_list) {
+            param_list[i].calc_value = param_list[i].calc_value !== null ? param_list[i].calc_value : '';
+            let subNode = param_list[i].match_type === 3 ? '(自动绑定)' : (param_list[i].match_type === 4 ? param_list[i].match_key : '');
+            param_html += '<tr> <td>'+ param_list[i].name +'</td><td>'+ subNode +'</td>' +
+                '<td><input type="text" class="form-control form-control-sm text-right" value="'+ param_list[i].calc_value +'" ' +
+                'data-old-value="'+ param_list[i].calc_value +'" data-lib-id="'+ param_list[i].lib_id +'" ' +
+                'data-node-id="'+ param_list[i].node_id +'" data-code="'+ param_list[i].code +'"></td> </tr>';
+        }
+        $('#paramList').html(param_html);
+    }
 
     $('body').on('blur', '#paramList input', function () {
         const self = $(this);
@@ -104,6 +111,7 @@ $(document).ready(function() {
             const postUrl = '/lib/updateParamValue';
             postData(postUrl, postInfo, function (result) {
                 self.attr('data-old-value', result.param.calc_value);
+                updateIndexHTML(result.indexes);
             },function (result) {
                 self.val(self.attr('data-old-value'));
             });

+ 11 - 3
app/view/lib/detail-modal.ejs

@@ -6,7 +6,7 @@
                 <h5 class="modal-title">删除确认</h5>
                 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
             </div>
-            <form method="post" action="/lib/delete?_csrf=<%= ctx.csrf %>">
+            <form method="post" action="/lib/delete?_csrf=<%= ctx.csrf %>" onsubmit="return check_delete_lib();">
                 <input type="hidden" name="del_lib_id" value="<%= libInfo.id %>">
                 <div class="modal-body">
                     <div class="form">
@@ -15,7 +15,7 @@
                             <br>需要删除,请在以下输入框输入"&nbsp;&nbsp;&nbsp;<b>确认删除</b>&nbsp;&nbsp;&nbsp;",再点击“确认删除”按钮。
                         </div>
                         <div class="form-group">
-                            <input class="form-control" type="text" name="del_lib_text"  placeholder="输入 “确认删除”">
+                            <input class="form-control" type="text" name="del_lib_text" id="del_lib_text" placeholder="输入 “确认删除”">
                         </div>
                     </div>
                 </div>
@@ -49,4 +49,12 @@
             </form>
         </div>
     </div>
-</div>
+</div>
+<script>
+    function check_delete_lib() {
+        if($('#del_lib_text').val().trim() !== '确认删除') {
+            alert('请在输入框中正确输入"确认删除"');
+            return false;
+        }
+    }
+</script>

+ 39 - 28
app/view/lib/detail.ejs

@@ -26,35 +26,46 @@
                     </div>
                 </div>
                 <div class="col-7">
-                    <div class="sjs-height-3">
-                        <table class="table table-bordered table-sm table-hover">
-                            <thead>
-                            <tr>
-                                <th>指标编号</th>
-                                <th>项目或费用名称</th>
-                                <th colspan="2">指标单位</th>
-                                <th>计算规则</th>
-                                <th>指标计算</th>
-                                <th>经济指标</th>
-                            </tr>
-                            </thead>
-                            <tbody id="indexList">
-                            </tbody>
-                        </table>
+                    <!--top-->
+                    <div>
+                        <div class="top-title">
+                            <h5>指标</h5>
+                        </div>
+                        <div class="sjs-height-3">
+                            <table class="table table-bordered table-sm table-hover">
+                                <thead>
+                                <tr>
+                                    <th>指标编号</th>
+                                    <th>项目或费用名称</th>
+                                    <th colspan="2">指标单位</th>
+                                    <th>计算规则</th>
+                                    <th>指标计算</th>
+                                    <th>经济指标</th>
+                                </tr>
+                                </thead>
+                                <tbody id="indexList">
+                                </tbody>
+                            </table>
+                        </div>
                     </div>
-                    <div class="sjs-bottom-2">
-                        <legend class="mt-3">填写参数</legend>
-                        <!--本节点参数-->
-                        <table class="table table-bordered table-sm table-hover">
-                            <thead>
-                            <tr><th colspan="4" class="text-center"><span id="codeName"></span> 参数</th></tr>
-                            <tr>
-                                <th>参数名称</th><th>绑定分项节点</th><th>参数数值</th>
-                            </tr>
-                            </thead>
-                            <tbody id="paramList">
-                            </tbody>
-                        </table>
+                    <!--bottom-->
+                    <div>
+                        <div class="bottom-title mt-3">
+                            <h5>填写参数</h5>
+                        </div>
+                        <div class="sjs-bottom-2">
+                            <!--本节点参数-->
+                            <table class="table table-bordered table-sm table-hover">
+                                <thead>
+                                <tr><th colspan="4" class="text-center"><span id="codeName"></span> 参数</th></tr>
+                                <tr>
+                                    <th>参数名称</th><th>绑定分项节点</th><th>参数数值</th>
+                                </tr>
+                                </thead>
+                                <tbody id="paramList">
+                                </tbody>
+                            </table>
+                        </div>
                     </div>
                 </div>
             </div>

+ 1 - 1
app/view/lib/global.ejs

@@ -39,7 +39,7 @@
                                     <%- p.match_key %>
                                     <% } %>
                                 </td>
-                                <td><input name="param-value" class="form-control form-control-sm" value="<%- p.calc_value %>" org-value="<%- p.calc_value %>"></td>
+                                <td><input name="param-value" class="form-control form-control-sm text-right" value="<%- p.calc_value %>" org-value="<%- p.calc_value %>"></td>
                             </tr>
                             <% } %>
                         </table>