Bläddra i källkod

Merge branch '1.0.0_online' of http://smartcost.f3322.net:3000/SmartCost/ConstructionOperation into 1.0.0_online

TonyKang 6 år sedan
förälder
incheckning
183e77a2e4

+ 2 - 0
modules/all_models/engineering_lib.js

@@ -72,6 +72,8 @@ let modelSchema = {
     visible:{type: Boolean, default: false},
     visible:{type: Boolean, default: false},
     //取费专业
     //取费专业
     engineering:Number,
     engineering:Number,
+    //单位工程取费专业
+    projectEngineering:Number,
     //是否计算安装增加费
     //是否计算安装增加费
     isInstall:{type: Boolean, default: false}
     isInstall:{type: Boolean, default: false}
 };
 };

+ 2 - 1
web/maintain/billsGuidance_lib/html/zhiyin.html

@@ -44,6 +44,7 @@
                         <a id="downLevel" href="javascript:void(0);" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title=""><i class="fa fa-arrow-right" aria-hidden="true"></i> 降级</a>
                         <a id="downLevel" href="javascript:void(0);" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title=""><i class="fa fa-arrow-right" aria-hidden="true"></i> 降级</a>
                         <a id="downMove" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title=""><i class="fa fa-arrow-down" aria-hidden="true"></i> 下移</a>
                         <a id="downMove" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title=""><i class="fa fa-arrow-down" aria-hidden="true"></i> 下移</a>
                         <a id="upMove" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title=""><i class="fa fa-arrow-up" aria-hidden="true"></i> 上移</a>
                         <a id="upMove" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title=""><i class="fa fa-arrow-up" aria-hidden="true"></i> 上移</a>
+                        <a id="expandContract" href="javascript:void(0);" class="btn btn-sm" data-toggle="tooltip" data-placement="bottom" title=""><i class="fa fa-minus-square-o" aria-hidden="true"></i> 收起定额</a>
                       </div>
                       </div>
                     </div>
                     </div>
                       <div class="main-top-content">
                       <div class="main-top-content">
@@ -137,4 +138,4 @@
     autoFlashHeight();
     autoFlashHeight();
 </script>
 </script>
 
 
-</html>
+</html>

+ 62 - 3
web/maintain/billsGuidance_lib/js/billsGuidance.js

@@ -1,5 +1,4 @@
 'use strict';
 'use strict';
-
 /**
 /**
  *
  *
  *
  *
@@ -90,6 +89,13 @@ const billsGuidance = (function () {
         update: 'update',
         update: 'update',
         del: 'delete'
         del: 'delete'
     };
     };
+    //项目指引节点状态:展开全部、收起定额
+    const itemExpandState = {
+        expand: 1,
+        contract: 0
+    };
+    //项目指引当前节点展开收缩状态,默认展开全部
+    let curExpandState = 1;
     const guideItem = {
     const guideItem = {
         dom: $('#guideItemSpread'),
         dom: $('#guideItemSpread'),
         workBook: null,
         workBook: null,
@@ -329,13 +335,17 @@ const billsGuidance = (function () {
         if(!node.guidance.tree){
         if(!node.guidance.tree){
             getItemsByBills(libID, node.data.ID, function (rstData) {
             getItemsByBills(libID, node.data.ID, function (rstData) {
                 initTree(node.guidance, guideSheet, guideItem.treeSetting, rstData);
                 initTree(node.guidance, guideSheet, guideItem.treeSetting, rstData);
+                setNodesExpandState(node.guidance.tree.items, curExpandState);
+                renderSheetFunc(guideSheet, function () {
+                    TREE_SHEET_HELPER.refreshNodesVisible(node.guidance.tree.roots, guideSheet, true);
+                });
                 //设置底色
                 //设置底色
                 setNodesColor(guideSheet, node.guidance.tree.items);
                 setNodesColor(guideSheet, node.guidance.tree.items);
                 //项目指引初始焦点
                 //项目指引初始焦点
                 guideItemInitSel(guideSheet.getActiveRowIndex() ? guideSheet.getActiveRowIndex() : 0);
                 guideItemInitSel(guideSheet.getActiveRowIndex() ? guideSheet.getActiveRowIndex() : 0);
             });
             });
-        }
-        else{
+        } else{
+            setNodesExpandState(node.guidance.tree.items, curExpandState);
             node.guidance.controller.showTreeData();
             node.guidance.controller.showTreeData();
             //设置底色
             //设置底色
             setNodesColor(guideSheet, node.guidance.tree.items);
             setNodesColor(guideSheet, node.guidance.tree.items);
@@ -343,7 +353,36 @@ const billsGuidance = (function () {
             guideItemInitSel(guideSheet.getActiveRowIndex() ? guideSheet.getActiveRowIndex() : 0);
             guideItemInitSel(guideSheet.getActiveRowIndex() ? guideSheet.getActiveRowIndex() : 0);
         }
         }
     }
     }
+    //设置项目节点展开收起状态:展开全部、收起定额
+    //@param {Array}nodes(当前清单下的所有项目指引节点) {Number}expandState(展开全部1或收起定额0).
+    function setNodesExpandState(nodes, expandState) {
+        if(expandState === itemExpandState.contract) {
+            //找出所有定额的父节点
+            let rations = _.filter(nodes, function (node) {
+                return node.data.type === itemType.ration;
+            });
+            let rationParentIDs = [];
+            for(let ration of rations){
+                if(ration.data.ParentID != -1){
+                    rationParentIDs.push(ration.data.ParentID);
+                }
+            }
+            rationParentIDs = Array.from(new Set(rationParentIDs));
+            let rationParentNodes = _.filter(nodes, function (node) {
+                return rationParentIDs.includes(node.data.ID);
+            });
+            //收起定额
+            for(let node of rationParentNodes){
+                node.setExpanded(false);
+            }
+        } else {
+            for(let node of nodes){
+                node.setExpanded(true);
+            }
+        }
+    }
     //根据奇偶层级设置节点底色,奇数层为蓝色(树节点深度为偶数)
     //根据奇偶层级设置节点底色,奇数层为蓝色(树节点深度为偶数)
+    //@param {Object}sheet {Array}nodes @return {void}
     function setNodesColor(sheet, nodes) {
     function setNodesColor(sheet, nodes) {
         const color = '#DFE8F9';
         const color = '#DFE8F9';
         renderSheetFunc(sheet, function () {
         renderSheetFunc(sheet, function () {
@@ -437,6 +476,8 @@ const billsGuidance = (function () {
         if(node && node.nextSibling){
         if(node && node.nextSibling){
             $('#downMove').removeClass('disabled');
             $('#downMove').removeClass('disabled');
         }
         }
+        //收起定额、展开全部
+        $('#expandContract').removeClass('disabled');
         //插入定额
         //插入定额
         if(node && (node.children.length === 0 || allRationChildren(node))){
         if(node && (node.children.length === 0 || allRationChildren(node))){
             $('#insertRation').removeClass('disabled');
             $('#insertRation').removeClass('disabled');
@@ -1547,6 +1588,24 @@ const billsGuidance = (function () {
         $('#downMove').click(function () {
         $('#downMove').click(function () {
             downMove();
             downMove();
         });
         });
+        //收起定额、展开全部
+        $('#expandContract').click(function () {
+            //目前状态时展开全部节点状态,点击则收起定额
+            let tree = bills.tree.selected.guidance.tree,
+                itemSheet = guideItem.workBook.getActiveSheet();
+            if(curExpandState === itemExpandState.expand){
+                curExpandState = itemExpandState.contract;
+                $(this).html('<i class="fa fa-plus-square-o" aria-hidden="true"></i> 展开全部');
+                setNodesExpandState(tree.items, itemExpandState.contract);
+            } else {
+                curExpandState = itemExpandState.expand;
+                $(this).html('<i class="fa fa-minus-square-o" aria-hidden="true"></i> 收起定额');
+                setNodesExpandState(tree.items, itemExpandState.expand);
+            }
+            renderSheetFunc(itemSheet, function () {
+                TREE_SHEET_HELPER.refreshNodesVisible(tree.roots, itemSheet, true);
+            });
+        });
         $('#insertRation').click(function () {
         $('#insertRation').click(function () {
             let checkedRows = getCheckedRationRows();
             let checkedRows = getCheckedRationRows();
             let insertDatas = getInsertRations(checkedRows);
             let insertDatas = getInsertRations(checkedRows);

+ 7 - 22
web/maintain/ration_repository/js/ration.js

@@ -71,27 +71,6 @@ let rationOprObj = {
             let row = info.newSelections[0].row;
             let row = info.newSelections[0].row;
             let me = rationOprObj;
             let me = rationOprObj;
             me.rationSelInit(row);
             me.rationSelInit(row);
-          /*  sheetCommonObj.cleanSheet(sheetGLJ, settingGLJ, -1);
-            sheetCommonObj.cleanSheet(sheetCoe, settingCoe, -1);
-            sheetCommonObj.cleanSheet(sheetAss, settingAss, -1);
-            sheetCommonObj.cleanSheet(sheetInst, settingInst, -1);
-            let cacheSection = me.getCache();
-            if (cacheSection && row < cacheSection.length) {
-                rationGLJOprObj.getGljItems(cacheSection[row], function () {
-                    me.workBook.focus(true);
-                });
-                rationCoeOprObj.getCoeItems(cacheSection[row], function () {
-                    me.workBook.focus(true);
-                });
-                rationAssistOprObj.getAssItems(cacheSection[row]);
-                rationInstObj.getInstItems(cacheSection[row], function () {
-                    me.workBook.focus(true);
-                });
-            }
-            else {
-                rationGLJOprObj.currentRationItem = null;
-            }
-            me.workBook.focus(true);*/
         }
         }
     },
     },
     rationSelInit: function (row) {
     rationSelInit: function (row) {
@@ -636,7 +615,7 @@ let rationOprObj = {
             }
             }
         });
         });
     },
     },
-    getRationItems: function(sectionID){
+    getRationItems: function(sectionID, callback = null){
         if (sectionID != -1) {
         if (sectionID != -1) {
             let me = rationOprObj;
             let me = rationOprObj;
             me.mixUpdate = 0;
             me.mixUpdate = 0;
@@ -649,6 +628,9 @@ let rationOprObj = {
                 annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
                 annotationOprObj.rationAnnotationOpr(me.currentRations["_SEC_ID_" + sectionID]);
                 me.showRationItems(sectionID);
                 me.showRationItems(sectionID);
                 sectionTreeObj.removeBtn.removeClass('disabled');
                 sectionTreeObj.removeBtn.removeClass('disabled');
+                if(callback){
+                    callback();
+                }
             } else {
             } else {
                 $.ajax({
                 $.ajax({
                     type:"POST",
                     type:"POST",
@@ -669,6 +651,9 @@ let rationOprObj = {
                             me.showRationItems(sectionID);
                             me.showRationItems(sectionID);
                         }
                         }
                         sectionTreeObj.removeBtn.removeClass('disabled');
                         sectionTreeObj.removeBtn.removeClass('disabled');
+                        if(callback) {
+                            callback();
+                        }
                     },
                     },
                     error:function(err){
                     error:function(err){
                         sectionTreeObj.removeBtn.removeClass('disabled');
                         sectionTreeObj.removeBtn.removeClass('disabled');

+ 8 - 5
web/maintain/ration_repository/js/section_tree.js

@@ -631,7 +631,10 @@ let sectionTreeObj = {
             me.removeBtn.addClass('disabled');
             me.removeBtn.addClass('disabled');
             rationOprObj.canRations = true;
             rationOprObj.canRations = true;
             rationOprObj.workBook.getSheet(0).clearSelection();
             rationOprObj.workBook.getSheet(0).clearSelection();
-            rationOprObj.getRationItems(node.data.ID);
+            rationOprObj.getRationItems(node.data.ID, function () {
+                rationOprObj.workBook.getActiveSheet().setActiveCell(0, 0);
+                rationOprObj.rationSelInit(0);
+            });
             rationOprObj.setCombo(rationOprObj.workBook.getSheet(0), 'dynamic');
             rationOprObj.setCombo(rationOprObj.workBook.getSheet(0), 'dynamic');
         }
         }
         else {
         else {
@@ -645,11 +648,11 @@ let sectionTreeObj = {
             annotationOprObj.hideTable($('#fzTableAll'), $('#fzTablePartial'));
             annotationOprObj.hideTable($('#fzTableAll'), $('#fzTablePartial'));
             sheetCommonObj.cleanSheet(rationOprObj.workBook.getSheet(0), rationOprObj.setting, -1);
             sheetCommonObj.cleanSheet(rationOprObj.workBook.getSheet(0), rationOprObj.setting, -1);
             rationGLJOprObj.sheet.getParent().focus(false);
             rationGLJOprObj.sheet.getParent().focus(false);
+            sheetCommonObj.cleanSheet(rationGLJOprObj.sheet, rationGLJOprObj.setting, -1);
+            sheetCommonObj.cleanSheet(rationAssistOprObj.sheet, rationAssistOprObj.setting, -1);
+            sheetCommonObj.cleanSheet(rationCoeOprObj.sheet, rationCoeOprObj.setting, -1);
+            sheetCommonObj.cleanSheet(rationInstObj.sheet, rationInstObj.setting, -1);
         }
         }
-        sheetCommonObj.cleanSheet(rationGLJOprObj.sheet, rationGLJOprObj.setting, -1);
-        sheetCommonObj.cleanSheet(rationAssistOprObj.sheet, rationAssistOprObj.setting, -1);
-        sheetCommonObj.cleanSheet(rationCoeOprObj.sheet, rationCoeOprObj.setting, -1);
-        sheetCommonObj.cleanSheet(rationInstObj.sheet, rationInstObj.setting, -1);
         me.workBook.focus(true);
         me.workBook.focus(true);
     }
     }
 };
 };

+ 10 - 9
web/maintain/std_glj_lib/js/glj.js

@@ -442,7 +442,7 @@ let repositoryGljObj = {
         return false;
         return false;
     },
     },
 
 
-    getCurrentComponent: function (gljComponent) {
+    getCurrentComponent: function (gljComponent, sort = false) {
         let me = repositoryGljObj, rst = [];
         let me = repositoryGljObj, rst = [];
         for(let i = 0; i < gljComponent.length; i++){
         for(let i = 0; i < gljComponent.length; i++){
             let obj = {};
             let obj = {};
@@ -461,12 +461,14 @@ let repositoryGljObj = {
                 }
                 }
             }
             }
         }
         }
-        rst.sort(function (a, b) {
-            let r = 0;
-            if(a.code > b.code) r = 1;
-            else if(a.code < b.code) r = -1;
-            return r;
-        });
+        if(sort){
+            rst.sort(function (a, b) {
+                let r = 0;
+                if(a.code > b.code) r = 1;
+                else if(a.code < b.code) r = -1;
+                return r;
+            });
+        }
         return rst;
         return rst;
     },
     },
     //获得引用了组成物id为componentId的工料机,和重新变化组成物数组、重新计算单价
     //获得引用了组成物id为componentId的工料机,和重新变化组成物数组、重新计算单价
@@ -550,9 +552,8 @@ let repositoryGljObj = {
             if(allowComponent.includes(me.currentCache[row].gljType)){
             if(allowComponent.includes(me.currentCache[row].gljType)){
                 //展示数据
                 //展示数据
                 if(me.currentGlj.component.length > 0){
                 if(me.currentGlj.component.length > 0){
-                    me.currentComponent = me.getCurrentComponent(me.currentGlj.component);
+                    me.currentComponent = me.getCurrentComponent(me.currentGlj.component, true);
                     if(me.currentComponent.length > 0){
                     if(me.currentComponent.length > 0){
-                        console.log(me.currentComponent);
                         sheetsOprObj.showData(that, that.workBook.getSheet(0), that.setting, me.currentComponent);
                         sheetsOprObj.showData(that, that.workBook.getSheet(0), that.setting, me.currentComponent);
                     }
                     }
                 }
                 }

+ 16 - 2
web/users/js/compilation.js

@@ -366,10 +366,12 @@ $(document).ready(function() {
             $("#engineeringError").show();
             $("#engineeringError").show();
             return;
             return;
         }
         }
+        if($('#projectEngineering').val() == ''){
+            $("#projectError").show();
+            return;
+        }
         $("#addEngineerConfirm").attr("disabled",true);//防止重复提交
         $("#addEngineerConfirm").attr("disabled",true);//防止重复提交
         $("#addEngineerForm").submit();
         $("#addEngineerForm").submit();
-
-
     });
     });
     //
     //
 
 
@@ -824,4 +826,16 @@ function getTaxGroupData() {
         }
         }
     }
     }
     return groupData;
     return groupData;
+}
+
+
+function intChecking(e,elemt) {//限制输入正整数
+    let code = e.which || e.keyCode;
+    if(code == 46 || code == 45){//不能输入小数点和-号
+        e.preventDefault();
+    }
+    if( elemt.value == ""&&code == 48){//当输入框为空时不能输入0
+        e.preventDefault();
+    }
+
 }
 }

+ 23 - 5
web/users/views/compilation/add.html

@@ -37,6 +37,7 @@
                                 <th>工程专业</th>
                                 <th>工程专业</th>
                                 <th>费用标准</th>
                                 <th>费用标准</th>
                                 <th>定额取费专业</th>
                                 <th>定额取费专业</th>
+                                <th>单位工程取费专业</th>
                                 <th>标准清单</th>
                                 <th>标准清单</th>
                                 <th>定额库</th>
                                 <th>定额库</th>
                                 <th>人材机库</th>
                                 <th>人材机库</th>
@@ -57,7 +58,8 @@
                                             </div>
                                             </div>
                                         </div>
                                         </div>
                                     </td>
                                     </td>
-                                    <td><div><span><%= engineering.feeName %></span> <a onclick='editEngineer(this)'><i class="glyphicon glyphicon-pencil"></i></a></div>
+                                    <td>
+                                        <div><span><%= engineering.feeName %></span> <a onclick='editEngineer(this)'><i class="glyphicon glyphicon-pencil"></i></a></div>
                                         <div class="input-group input-group-sm input_group_div" style="width:200px;display: none">
                                         <div class="input-group input-group-sm input_group_div" style="width:200px;display: none">
                                             <input class="form-control" name="feeName">
                                             <input class="form-control" name="feeName">
                                             <div class="input-group-btn">
                                             <div class="input-group-btn">
@@ -65,14 +67,25 @@
                                                     <span class="glyphicon glyphicon-ok"></span></button>
                                                     <span class="glyphicon glyphicon-ok"></span></button>
                                             </div>
                                             </div>
                                         </div></td>
                                         </div></td>
-                                    <td><div><span><%= engineering.engineering %></span> <a onclick='editEngineer(this)'><i class="glyphicon glyphicon-pencil"></i></a></div>
+                                    <td>
+                                        <div><span><%= engineering.engineering %></span> <a onclick='editEngineer(this)'><i class="glyphicon glyphicon-pencil"></i></a></div>
                                         <div class="input-group input-group-sm input_group_div" style="width:200px;display: none">
                                         <div class="input-group input-group-sm input_group_div" style="width:200px;display: none">
-                                            <input class="form-control engineeringInput" type="number" name="engineering">
+                                            <input onkeypress="intChecking(event,this)" class="form-control engineeringInput" type="number" name="engineering">
                                             <div class="input-group-btn">
                                             <div class="input-group-btn">
                                                 <button type="button" class="btn btn-success" onclick='confirmUpdate(this,"<%= engineering._id.toString()%>")'>
                                                 <button type="button" class="btn btn-success" onclick='confirmUpdate(this,"<%= engineering._id.toString()%>")'>
                                                     <span class="glyphicon glyphicon-ok"></span></button>
                                                     <span class="glyphicon glyphicon-ok"></span></button>
                                             </div>
                                             </div>
-                                        </div></td>
+                                        </div>
+                                    </td>
+                                    <td><div><span><%= engineering.projectEngineering %></span> <a onclick='editEngineer(this)'><i class="glyphicon glyphicon-pencil"></i></a></div>
+                                        <div class="input-group input-group-sm input_group_div" style="width:200px;display: none">
+                                            <input onkeypress="intChecking(event,this)" class="form-control engineeringInput" type="number" name="projectEngineering">
+                                            <div class="input-group-btn">
+                                                <button type="button" class="btn btn-success" onclick='confirmUpdate(this,"<%= engineering._id.toString()%>")'>
+                                                    <span class="glyphicon glyphicon-ok"></span></button>
+                                            </div>
+                                        </div>
+                                    </td>
                                     <td><%= engineering.bill_lib.length %></td>
                                     <td><%= engineering.bill_lib.length %></td>
                                     <td><%= engineering.ration_lib.length %></td>
                                     <td><%= engineering.ration_lib.length %></td>
                                     <td><%= engineering.glj_lib.length %></td>
                                     <td><%= engineering.glj_lib.length %></td>
@@ -113,9 +126,14 @@
                     </div>
                     </div>
                     <div class="form-group">
                     <div class="form-group">
                         <label>定额取费专业</label>
                         <label>定额取费专业</label>
-                        <input class="form-control engineeringInput" type="number" name ="engineering" id="engineeringInput" placeholder="请输入定额取费专业">
+                        <input onkeypress="intChecking(event,this)" class="form-control engineeringInput" type="number"  name ="engineering" id="engineeringInput" placeholder="请输入定额取费专业">
                         <small class="form-text text-danger" id="engineeringError" style="display: none">请输入定额取费专业。</small>
                         <small class="form-text text-danger" id="engineeringError" style="display: none">请输入定额取费专业。</small>
                     </div>
                     </div>
+                    <div class="form-group">
+                        <label>单位工程取费专业</label>
+                        <input onkeypress="intChecking(event,this)"  class="form-control engineeringInput" type="number" name ="projectEngineering" id="projectEngineering" placeholder="请输入单位工程取费专业">
+                        <small class="form-text text-danger" id="projectError" style="display: none">请输入单位工程取费专业。</small>
+                    </div>
                     <input type="hidden" name="valuationID" value="<%= valuationId %>">
                     <input type="hidden" name="valuationID" value="<%= valuationId %>">
                     <input type="hidden" name="compilationId" value="<%= selectedCompilation._id.toString() %>" >
                     <input type="hidden" name="compilationId" value="<%= selectedCompilation._id.toString() %>" >
                 </form>
                 </form>