zhangweicheng 7 роки тому
батько
коміт
318fdba4f0

+ 2 - 0
modules/all_models/bills.js

@@ -20,6 +20,7 @@ let billsSchema = new Schema({
     name: String,
     unit: String,
     quantity: String, // Decimal
+    quantity2:String,//预算项目中的数量2
     quantityEXP:String,//工程量表达式
     feeRateID:Number,
     feeRate:String,
@@ -64,6 +65,7 @@ let billsSchema = new Schema({
     installationKey:String,//用来记录安装增加费的关联字段
     deleteInfo: deleteSchema,
     isEstimate:{type: Number,default:0},       // 1 true 0 false 是否暂估
+    unitPriceAnalysis:{type: Number,default:0},       // 1 true 0 false 单价分析
     specialProvisional:String,
     remark:String,
     engineeringContent:String,//工程内容

+ 4 - 4
web/building_saas/main/js/views/main_tree_col.js

@@ -347,11 +347,11 @@ let MainTreeCol = {
                 return new GC.Spread.Sheets.CellTypes.CheckBox();
             }
         },
+        unitPriceAnalysis:function (node) {
+            if(node.sourceType == ModuleNames.bills) return new GC.Spread.Sheets.CellTypes.CheckBox();
+        },
         evaluationProject:function (node) {
-            if(node.sourceType == ModuleNames.ration){
-                return new GC.Spread.Sheets.CellTypes.CheckBox();
-            }
-
+            if(node.sourceType == ModuleNames.ration) return new GC.Spread.Sheets.CellTypes.CheckBox();
         },
         commonTotalFee: function () {
             return projectObj.getCommonTotalFeeCellType();

+ 45 - 3
web/building_saas/main/js/views/project_view.js

@@ -1706,8 +1706,9 @@ var projectObj = {
             projectObj.onIsEstimateClick(node,info);
         }else if(fieldName == "evaluationProject"){
             projectObj.onEvaluationProjectClic(node,info);
+        }else if(fieldName == "unitPriceAnalysis"){
+            projectObj.onUnitPriceAnalysisClick(node,info);
         }
-
     },
     onEvaluationProjectClic:function (node,info) {
         let checkboxValue = info.sheet.getCell(info.row, info.col).value();
@@ -1719,8 +1720,7 @@ var projectObj = {
             projectObj.project.calcProgram.calcAndSave(node);
         })
     },
-
-    onIsEstimateClick: function(node,info){
+    setAndGetCheckBoxVal:function (info) {
         let checkboxValue = info.sheet.getCell(info.row, info.col).value();
         let cell = info.sheet.getCell(info.row, info.col), newval = 0;
         if (checkboxValue) {
@@ -1730,6 +1730,10 @@ var projectObj = {
             newval = 1;
             cell.value(newval);
         }
+        return newval;
+    },
+    onIsEstimateClick: function(node,info){
+        let newval = projectObj.setAndGetCheckBoxVal(info);
         if(MainTreeCol.readOnly.bills(node)){
             projectObj.updateNodeField(node,newval,'isEstimate');
         }else if(node.data.projectGLJID){//更新的是定额类型的工料机或者是显示在造价书页面的主材、设备
@@ -1738,6 +1742,44 @@ var projectObj = {
             projectObj.project.projectGLJ.pGljUpdate(updateData);
         }
     },
+    onUnitPriceAnalysisClick:function (unode,info) {
+        let updateDatas=[],nodes=[];
+        let newval = projectObj.setAndGetCheckBoxVal(info);
+         //仅对大项费用、清单有效,修改父项清单,子项清单跟随修改。
+        if(unode.sourceType == ModuleNames.bills) unitPriceAnalysisUpdate(unode,newval);
+        if(updateDatas.length > 0){
+            $.bootstrapLoading.start();
+            projectObj.project.updateNodes(updateDatas,function () {
+                for(let n of nodes){
+                    n.data.unitPriceAnalysis = newval;
+                }
+                projectObj.mainController.refreshTreeNode(nodes);
+                $.bootstrapLoading.end();
+            })
+        }
+
+
+         function unitPriceAnalysisUpdate(node,val){
+             updateDatas.push(getUnitPriceUpdataData(node,val));
+             nodes.push(node);
+             if(node.children.length > 0 && node.children[0].sourceType == ModuleNames.bills) {//仅对大项费用、清单有效
+                 for(let i = 0;i<node.children.length;i++ ){
+                     unitPriceAnalysisUpdate(node.children[i],val)
+                 }
+             }
+         }
+
+         function getUnitPriceUpdataData(node,val) {
+             let data =  {
+                 type:node.sourceType,
+                 data:{
+                     ID:node.data.ID,
+                     unitPriceAnalysis:val
+                 }
+             };
+             return data;
+         }
+    },
     onSubcontractClick:function (node) {//点击分包费checkbox
         if (node.updateData.isSubcontract) node.updateData.isSubcontract = false;
         else node.updateData.isSubcontract = true;