Kaynağa Gözat

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/YangHuCost

TonyKang 6 yıl önce
ebeveyn
işleme
43bef00be1

+ 1 - 1
modules/all_models/project_glj.js

@@ -100,7 +100,7 @@ let modelSchema = {
     // 是否主要材料 (0为否 1为是)
     is_main_material: {
         type: Number,
-        default: 0
+        default: 1
     },
     //以下仅普通材料可用
     grossWeightCoe: Number, //毛重系数

+ 2 - 2
public/web/gljUtil.js

@@ -311,9 +311,9 @@ let gljUtil = {
     },
     //项目工料机 混凝土、砂浆、配合比排序与定额工料机不一样,同时,type取值的地方不一样
     sortProjectGLJ:function (list) {
-        let specialMap = {202:9,203:10,204:11};//混凝土、砂浆、配合比 排到最后
+        let specialMap = {1:-1,303:0,202:9,203:10,204:11};//,人工、机械工排在最前,混凝土、砂浆、配合比 排到最后
         list = _.sortByAll(list, [function (item) {
-            if(gljUtil.isConcreteType(item.unit_price.type)) return specialMap[item.unit_price.type];
+            if(specialMap[item.unit_price.type] != undefined) return specialMap[item.unit_price.type];
             return gljUtil.getMainType(item.unit_price.type);
         }, "code"]);
         return list;

+ 1 - 0
public/web/scMathUtil.js

@@ -192,6 +192,7 @@ let scMathUtil = {
     },
     isNumOrFormula:function (text) {
         let value = Number(text);
+        if(value ==0 ) return value;
         if (!value) {
             try {
                 let exp = new Expression('');

+ 6 - 6
web/building_saas/main/html/main.html

@@ -150,7 +150,7 @@
                               <a class="nav-link px-3 right-nav-link"  href="javascript:void(0)" id = 'locateTab' relaPanel="#locate">查找定位</a>
                           </li>-->
                           <li class="nav-item">
-                              <a class="nav-link px-1 right-nav-link" href="javascript:void(0)" id = 'stdBillsGuidanceTab' relaPanel="#zy">清单规则</a>
+                              <a class="nav-link px-1 right-nav-link" href="javascript:void(0)" id = 'stdBillsGuidanceTab' relaPanel="#zy">项目表</a>
                           </li>
                          <!-- <li class="nav-item">
                               <a class="nav-link px-3" href="javascript:void(0)" id = 'stdBillsTab' relaPanel="#qd">清单规则</a>
@@ -187,9 +187,9 @@
                           <div class="resize-y" id="mainVerticalResize"></div>
                           <div class="bottom-content" id="bottom_div">
                               <ul class="nav nav-tabs" role="tablist" id="bottom_div_ul">
-                                  <li class="nav-item" id="QDJL_div">
+                                  <!--<li class="nav-item" id="QDJL_div">
                                       <a class="nav-link sub-item" id="linkQDJL" data-toggle="tab" href="#subSpread" role="tab">清单精灵</a>
-                                  </li>
+                                  </li>-->
                                   <li class="nav-item" id="GLJ_div">
                                       <a class="nav-link sub-item active" id="linkGLJ" data-toggle="tab" href="#subSpread" role="tab">工料机</a>
                                   </li>
@@ -255,7 +255,7 @@
                                           <div class=" main-data-bottom ovf-hidden col-auto p-0" id="gljItemTab" style="width: 30px">
                                               <div class="rn-nav d-flex align-items-start flex-column gljSubTab">
                                                   <div id="zmhs_toogle">
-                                                      <div class="tn-nav d-flex align-items-start flex-column" data-toggle="tooltip" data-placement="left" title="" data-original-title="打开子目换算">
+                                                      <div class="d-flex align-items-start flex-column" data-toggle="tooltip" data-placement="left" title="" data-original-title="打开子目换算">
                                                           <span class="mt-3 ml-2 text-primary">子目换算</span>
                                                           <i class="fa fa-arrow-left mt-auto mb-3 text-primary ml-2"></i>
                                                       </div>
@@ -311,7 +311,7 @@
                                       <div class="main-data-bottom ovf-hidden" style="display: none" id="comments">
                                           <textarea style="font-size: 0.9rem" class="form-control" rows="8" readonly=""></textarea>
                                       </div>
-                                      <div class="container-fluid main-data-bottom ovf-hidden" id="qdjl" role="tabpanel">
+                                      <!--<div class="container-fluid main-data-bottom ovf-hidden" id="qdjl" role="tabpanel">
                                           <div class="row p-0" style="background: #efefef">
                                               <div class="col-6 p-0">
                                                   <div id="qdjlTools" style="width: calc(100% - 5px); border-bottom: solid 1px lightgrey;">
@@ -322,7 +322,7 @@
                                                   </div>
                                               </div>
                                           </div>
-                                      </div>
+                                      </div>-->
                                   </div>
                               </div>
                           </div>

+ 17 - 1
web/building_saas/main/js/models/bills.js

@@ -597,6 +597,13 @@ var Bills = {
                 return false;
             }
         };
+        bills.prototype.isTotalCost = function (node) {//判断这个节点是否是总造价
+            if(isFlag(node.data)&&node.data.flagsIndex.fixed.flag==fixedFlag.TOTAL_COST){
+                return true;
+            }else {
+                return false;
+            }
+        };
         bills.prototype.calcEngineeringCostNode=function(controller){
             let roots =  controller.tree.roots;
             for(let root of roots){
@@ -614,6 +621,15 @@ var Bills = {
                 }
             }
         };
+        bills.prototype.getTotalCostNode=function(controller){//取工程造价总金额节点
+            let roots =  controller.tree.roots;
+            for(let root of roots){
+                if(project.Bills.isTotalCost(root)==true){
+                    return root;
+                }
+            }
+        };
+
         bills.prototype.getFBFXNode = function (controller) {//取分部分项工程节点
             let roots =  controller.tree.roots;
             for(let root of roots){
@@ -730,7 +746,7 @@ var Bills = {
                     }
                 }
                 if(m_node.parent==null&&includeRootNode==false){//删除的节点中包含了根节点,要重新计算工程造价,并且工程造价节点只要加入一次就行了
-                    parentNodes.push(me.getEngineeringCostNode(controller));
+                    parentNodes.push(me.getTotalCostNode(controller));
                     includeRootNode=true
                 }else {
                     m_node.parent?parentNodes.push(m_node.parent):"";

+ 5 - 1
web/building_saas/main/js/models/calc_program.js

@@ -1645,7 +1645,11 @@ class CalcProgram {
 
                 if (treeNode.calcType == treeNodeCalcType.ctGatherBillsFees){
                     for (let node of nodes) {
-                        if (node.data.feesIndex && node.data.feesIndex[ft.type]) { // 父清单不要汇总综合单价。
+                        if (node.data.feesIndex && node.data.feesIndex[ft.type]) {
+                            if (projectObj.project.property.valuationType === 'bill') { // 预算
+                                buf = (buf + parseFloatPlus(node.data.feesIndex[ft.type].unitFee)).toDecimal(decimalObj.process);
+                                btuf = (btuf + parseFloatPlus(node.data.feesIndex[ft.type].tenderUnitFee)).toDecimal(decimalObj.process);
+                            };
                             btf = (btf + parseFloatPlus(node.data.feesIndex[ft.type].totalFee)).toDecimal(decimalObj.process);
                             bttf = (bttf + parseFloatPlus(node.data.feesIndex[ft.type].tenderTotalFee)).toDecimal(decimalObj.process);
                         };

+ 2 - 1
web/building_saas/main/js/models/project.js

@@ -327,7 +327,8 @@ var PROJECT = {
             let me = this;
             let  changeMark = projectInfoObj.projectInfo.changeMark;
             if(changeMark&&changeMark!=''){
-                this.Bills.getEngineeringCostNode(projectObj.mainController).changed = true;
+                let totalNode = this.Bills.getTotalCostNode(projectObj.mainController);
+                if(totalNode) totalNode.changed = true;
                 this.calcProgram.calcAllNodesAndSave();
                 CommonAjax.post("/project/removeProjectMark",{projectID:me.ID()},function (data) {
                     delete projectInfoObj.projectInfo.changeMark;

+ 21 - 9
web/building_saas/main/js/models/quantity_detail.js

@@ -723,9 +723,7 @@ var quantity_detail = {
                 me.updateRationQuantity(value,node,null,editingText);
             }
         };
-
-
-        quantity_detail.prototype.updateBillQuantity=function (value,node,quantityEXP,editingText) {
+        quantity_detail.prototype.updateBillQuantity=function (value,node,quantityEXP,editingText,batchGLGL = false) {//batchGLLC是否批量更新公路公里为单位的所有清单
             let oldQuantityEXP =  node.data.quantityEXP;
             node.updateData.quantityEXP = quantityEXP?quantityEXP:editingText;
             value = scMathUtil.roundForObj(value,getDecimal("quantity",node));
@@ -737,7 +735,10 @@ var quantity_detail = {
             node.updateData.quantity = newQuantity;
             let needUpdateChildren = [];//需更新的子定额
             let gljNodes=[];//当定额工程量改变时需刷新的子工料机
-            if(node.children.length>0){//如果有子项
+            let batchBillNodes = [];
+            if(batchGLGL==true){//批量更新公路公里的时候不考虑清单下的子定额工程量的更新
+                this.batchUpdateGLGLNodes(batchBillNodes,node);
+            }else if(node.children.length>0){//如果有子项
                 for(let rationNode of node.children){
                     let EXPString = rationNode.data.quantityEXP+"";
                     if(EXPString.indexOf("QDL")!=-1){//包含了清单量的定额才要再重新计算
@@ -770,9 +771,7 @@ var quantity_detail = {
             }
             if(needUpdateChildren.length>0){//清单下的定额工程量发生了改变
                 node.changed = true;//本身发生了改变,需要存储。
-                /*project.calcProgram.calcNodesAndSave(needUpdateChildren, function () {
-                    project.projectGLJ.loadData();
-                });*/
+                needUpdateChildren.push(node);
                 project.calcProgram.calcNodesAndSave(needUpdateChildren, function () {
                     project.projectGLJ.calcQuantity();
                     if(project.Bills.isFBFX(node)) { //判断是否属于分部分项工程 ,是的话才需要做计取安装费计算
@@ -785,10 +784,10 @@ var quantity_detail = {
                         });
                     }
                 });
-
             }else {
                 node.changed = true;
-                project.calcProgram.calcAndSave(node, function () {
+                batchBillNodes.push(node);
+                project.calcProgram.calcNodesAndSave(batchBillNodes, function () {
                     project.projectGLJ.calcQuantity();
                 });
             }
@@ -797,6 +796,19 @@ var quantity_detail = {
             }
             gljOprObj.refreshView();
         };
+
+        quantity_detail.prototype.batchUpdateGLGLNodes = function (batchUpdateGLGLNodes,node) {
+            for(let b of projectObj.project.Bills.datas){
+                if(b.ID == node.data.ID) continue;
+                let bNode =  projectObj.project.mainTree.getNodeByID(b.ID);
+                if(bNode && b.unit == "公路公里"){
+                    bNode.updateData.quantityEXP = node.updateData.quantityEXP;
+                    bNode.updateData.quantity = node.updateData.quantity;
+                    bNode.changed = true;
+                    batchUpdateGLGLNodes.push(bNode);
+                }
+            }
+        };
         quantity_detail.prototype.updateRationQuantity=function(value,node,quantityEXP,editingText){
             let oldQuantityEXP =  node.data.quantityEXP;
             node.updateData.quantityEXP = quantityEXP?quantityEXP:editingText;

+ 1 - 1
web/building_saas/main/js/views/glj_view.js

@@ -18,7 +18,7 @@ var gljOprObj = {
     parentNodeIds: {},
     activeTab: '#linkGLJ',
     rationTab:'#linkGLJ',
-    billsTab:'#linkQDJL',
+    billsTab:'#linkGCLMX',
     setting: {},
     detailSetting: {
         header: [

+ 5 - 1
web/building_saas/main/js/views/main_tree_col.js

@@ -220,7 +220,9 @@ let MainTreeCol = {
         },
         forQuantity: function (node) {
             if(node.sourceType === projectObj.project.Bills.getSourceType()){
-                if(node.data.type==billType.DXFY||node.data.type==billType.FB||(node.data.type==billType.BILL&&MainTreeCol.readOnly.billsParent(node))){//大项费用、分部、清单父项行,工程量只读。
+                //如果是预算项目的,所有清单的数量1、数量2不做输入限制。
+                if(projectInfoObj.projectInfo.property && projectInfoObj.projectInfo.property.valuationType == "bill")  return false;
+                if(node.data.type==billType.FB||(node.data.type==billType.BILL&&MainTreeCol.readOnly.billsParent(node))){//大项费用、分部、清单父项行,工程量只读。
                     return true;
                 }
             }else if(MainTreeCol.readOnly.glj(node)){
@@ -230,6 +232,8 @@ let MainTreeCol = {
         },
         forQuantity2:function (node) {
             if(node.sourceType !== ModuleNames.bills) return true;//不是清单,只读
+            //如果是预算项目的,所有清单的数量1、数量2不做输入限制。
+            if(projectInfoObj.projectInfo.property && projectInfoObj.projectInfo.property.valuationType == "bill")  return false;
             if(node.data.type==billType.DXFY||(node.data.type==billType.BILL&&MainTreeCol.readOnly.billsParent(node))) return true;//大项费用、清单父项行,工程量只读。
             return false
         },

+ 3 - 3
web/building_saas/main/js/views/project_info.js

@@ -34,10 +34,10 @@ var projectInfoObj = {
                 that.projectInfo = data;
                 if(!data.engineeringInfo.billsGuidance_lib || data.engineeringInfo.billsGuidance_lib.length === 0){
                     $('#stdBillsGuidanceTab').addClass('disabled');
+                } else {
+                    //打开预算项目时,右侧“清单规则”显示为“项目表”,打开工程量清单项目时,右侧“清单规则”显示为“清单范本”。
+                    $('#stdBillsGuidanceTab').text(data.property.valuationType === 'bill' ? '项目表' : '清单范本');
                 }
-              /*  else {
-                    $('#stdBillsGuidanceTab').text(data.engineeringInfo.billsGuidance_lib[0].type === 1 ? '清单指引' : '清单精灵');
-                }*/
 
                 //init decimal
                 setDecimal(decimalObj, data.property.decimal);

+ 1 - 1
web/building_saas/main/js/views/project_view.js

@@ -102,7 +102,7 @@ var projectObj = {
             }
             return true;
         };
-        let canDownLevel = function (node) {
+        let canDownLevel = function (node) {//
             if(!node){
                 return false;
             }

+ 8 - 0
web/building_saas/main/js/views/quantity_edit_view.js

@@ -190,6 +190,14 @@ let quantityEditObj = {
         let quantity_detail = projectObj.project.quantity_detail;
         quantity_detail.cleanQuantityDetail(node,true);
         if(node.sourceType === ModuleNames.bills){
+            if(quantityEXP!=""&& node.data.unit == "公路公里"){
+                hintBox.infoBox('操作确认', '是否将所有单位等于"公路公里"的项目的工程量都设为该值?', 2, function () {
+                    quantity_detail.updateBillQuantity(value,node,quantityEXP,quantityEXP,true);
+                }, function () {
+                    quantity_detail.updateBillQuantity(value,node,quantityEXP,quantityEXP);
+                },['是','否']);
+                return;
+            }
             quantity_detail.updateBillQuantity(value,node,quantityEXP,quantityEXP);
         }else {
             quantity_detail.updateRationQuantity(value,node,quantityEXP,quantityEXP);

+ 1 - 1
web/building_saas/main/js/views/sub_view.js

@@ -73,7 +73,7 @@ let subObj = {
             $("#ZMHS_div").hide();
             $("#MBZM_div").hide();
             $("#AZZJF_div").hide();
-            $('#QDJL_div').show();
+            $('#QDJL_div').hide();//暂时隐藏
             $(gljOprObj.billsTab).click();
         }
         projectObj.mainSpread.focus();

+ 2 - 1
web/building_saas/main/js/views/zlfb_view.js

@@ -288,7 +288,8 @@ let zlfb_object={
             cbTools.refreshFormulaNodes();
             projectObj.project.installation_fee.calcInstallationFee(function () {
                 //重新计算
-                projectObj.project.Bills.getEngineeringCostNode(controller).changed = true;
+                let toNode =  projectObj.project.Bills.getTotalCostNode(controller);
+                if(toNode) toNode.changed = true;
                 projectObj.project.calcProgram.calcAllNodesAndSave();
             });
         },function () {

+ 12 - 5
web/building_saas/pm/js/pm_newMain.js

@@ -1001,6 +1001,13 @@ const projTreeObj = {
         }
         return new TreeNodeCellType();
     },
+    setFileSelectButton:function (row,col,node,sheet,setting) {
+        if(!setting) setting = this.setting;
+        let dataCode = setting.header[col]['dataCode'];
+        if(node.data.projType == "Tender" && (dataCode=="feeRateFile" || dataCode == "unitPriceFile")){
+            sheet.setCellType(row, col,sheetCommonObj.getCusButtonCellType(projTreeObj.cusButtonClick,false),GC.Spread.Sheets.SheetArea.viewport);
+        }
+    },
     setCellValue: function (cell, node,sheet,setting) {
         //const sheet = this.workBook.getActiveSheet();
         if(!setting) setting = this.setting;
@@ -1043,11 +1050,7 @@ const projTreeObj = {
                         sheet.getCell(i, j).hAlign(GC.Spread.Sheets.HorizontalAlign.center);
                     }
                     me.setCellValue({row: i, col: j}, nodes[i],sheet,setting);
-                    let dataCode = headers[j].dataCode;
-                    if(nodes[i].data.projType == "Tender" && (dataCode=="feeRateFile" || dataCode == "unitPriceFile")) {
-                        sheet.setCellType(i, j,sheetCommonObj.getCusButtonCellType(me.cusButtonClick,false),GC.Spread.Sheets.SheetArea.viewport);
-                    }
-                    //sheet.setValue(i, j, nodes[i]['data'][dataCode]);
+                    me.setFileSelectButton(i,j,nodes[i],sheet,setting);
                 }
                 sheet.getCell(i, 1,GC.Spread.Sheets.SheetArea.viewport).locked(true);
             }
@@ -1072,6 +1075,7 @@ const projTreeObj = {
             let rIdx = me.tree.items.indexOf(n);
             for(let i = 0; i < header.length; i++){
                 me.setCellValue({row: rIdx, col: i}, n,sheet);
+                me.setFileSelectButton(rIdx,i,n,sheet);
             }
         }
 
@@ -1637,6 +1641,9 @@ $(document).ready(function() {
         let selected = projTreeObj.tree.selected;
         let projs = getProjs(selected);
         setProjOptions(projs, selected);
+        //恢复成默认选中预算项目类别。
+        $($("input[name='valuation_type']")[0]).prop('checked', true);
+        $($("input[name='valuation_type']")[1]).prop('checked', false);
         $($("input[name='valuation_type']")[0]).click();
         //设置地区选项
         if(regions.length > 0){