zhangweicheng 6 年之前
父节点
当前提交
b6a435f187

+ 1 - 1
modules/main/facade/ration_facade.js

@@ -491,7 +491,7 @@ async function CalculateQuantity (ration,billsItemID,projectID) {
     let decimalObject =await decimal_facade.getProjectDecimal(projectID,project);
     let quantity_decimal = (decimalObject&&decimalObject.ration&&decimalObject.ration.quantity)?decimalObject.ration.quantity:3;
     let pbill = await bill_model.model.findOne({projectID:projectID,ID:billsItemID});
-    let  t_unit = ration.unit.replace(/^\d+/,"");
+    let  t_unit = ration.unit?ration.unit.replace(/^\d+/,""):"";
     if(t_unit!=pbill.unit){//如果定额工程量的单位去除前面的数字后不等于清单单位,定额工程量保持不变
         return ;
     }

+ 1 - 1
modules/ration_glj/routes/ration_glj_route.js

@@ -13,7 +13,7 @@ module.exports = function (app) {
     rgRouter.post('/replaceGLJ',rgController.replaceGLJ);
     rgRouter.post('/mReplaceGLJ',rgController.mReplaceGLJ);
     rgRouter.post('/updateRationGLJByEdit',rgController.updateRationGLJByEdit);
-    rgRouter.post('/getGLJClass', rgController.getGLJClass);
+    rgRouter.post('/getGLJClass/:engineerID', rgController.getGLJClass);
     app.use('/rationGlj',rgRouter);
 }
 

+ 6 - 2
web/building_saas/main/js/controllers/block_controller.js

@@ -242,7 +242,7 @@ let BlockController = {
             for(let d of blockData.datas){
                 d.billsItemID = parentID;
                 let billsQuantity = scMathUtil.roundForObj(parent.data.quantity,getDecimal("quantity",parent));
-                this.calcRationQuantityAndContain(billsQuantity,d);
+                this.calcRationQuantityAndContain(billsQuantity,d,parent.data.unit);
                 //如果粘贴位置不属于分部分项工程,或者不是安装工程,则把安装增加费内容置空
                 if(!Bills.isFBFX(parent)|| !project.isInstall()){
                     d.ration_installations = [];
@@ -552,10 +552,14 @@ let BlockController = {
             firstSerialNo += 1;
         }
     },
-    calcRationQuantityAndContain : function (billsQuantity,ration) {//计算定额工程量和含量
+    calcRationQuantityAndContain : function (billsQuantity,ration,billsUnit) {//计算定额工程量和含量
         let EXPString = ration.quantityEXP+"";
         if(EXPString.indexOf("QDL") != -1){
             if(EXPString=="QDL"){//定额的工程量是直接通过清单量填进来的;
+                let  t_unit = ration.unit?ration.unit.replace(/^\d+/,""):"";
+                if(t_unit!=billsUnit){//如果定额的单位去除前面的数字后不等于清单单位,定额工程量保持不变
+                    return ;
+                }
                 let times = parseInt(ration.unit);
                 if(isNaN(times)){
                     times = 1;

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

@@ -398,7 +398,8 @@ function getGLJData(actionType) {
 }
 
 function showGLJClassTree(record) {
-    CommonAjax.post('/rationGlj/getGLJClass',record, function (data) {
+    let engineerID = projectInfoObj.projectInfo.property.engineering_id;
+    CommonAjax.post('/rationGlj/getGLJClass/'+engineerID,record, function (data) {
         if(data.exist==true){
             alert("当前人材机已存在。");
         }else {