zhangweicheng před 6 roky
rodič
revize
632d76d8dc

+ 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('');

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

@@ -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>

+ 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):"";

+ 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;

+ 20 - 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,6 @@ 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();
@@ -786,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();
                 });
             }
@@ -798,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;

+ 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);

+ 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 () {

+ 3 - 0
web/building_saas/pm/js/pm_newMain.js

@@ -1023,6 +1023,9 @@ const projTreeObj = {
         else {
             value = isDef(node.data[dataCode]) ? node.data[dataCode] : '';
         }
+        if(node.data.projType == "Tender" && (dataCode=="feeRateFile" || dataCode == "unitPriceFile")){
+            sheet.setCellType(row, col,sheetCommonObj.getCusButtonCellType(projTreeObj.cusButtonClick,false),GC.Spread.Sheets.SheetArea.viewport);
+        }
         sheet.setValue(row, col, value);
     },
     showTreeData: function (nodes, setting,sheet) {