|
|
@@ -180,7 +180,7 @@ let gljUtil = {
|
|
|
continue;
|
|
|
}
|
|
|
if(!pglj.is_adjust_price){
|
|
|
- tender_glj_quantity = this.getRationGLJTenderQuantity(rg,tem_ration,q_decimal,scMathUtil);
|
|
|
+ tender_glj_quantity = this.getRationGLJTenderQuantity(rg,tem_ration,q_decimal,scMathUtil,pglj);
|
|
|
tender_r_quantity = this.getRationTenderQuantity(tem_ration,q_decimal,scMathUtil);
|
|
|
}
|
|
|
let total = scMathUtil.roundForObj(glj_quantity*r_quantity, q_decimal);
|
|
|
@@ -204,7 +204,7 @@ let gljUtil = {
|
|
|
result.tenderQuantity = tender_qantity_sum;
|
|
|
return result;
|
|
|
},
|
|
|
- getRationGLJTenderQuantity:function (ration_glj,ration,q_decimal,scMathUtil) {
|
|
|
+ getRationGLJTenderQuantity:function (ration_glj,ration,q_decimal,scMathUtil,projectGLJ) {
|
|
|
let coeMap = {
|
|
|
1:'labour', //人工
|
|
|
2:'material',//材料
|
|
|
@@ -221,14 +221,12 @@ let gljUtil = {
|
|
|
}
|
|
|
}
|
|
|
let coe = 1;
|
|
|
- if (!calcTools.isTenderProjectGLJ(ration_glj)){
|
|
|
- coe = 1;
|
|
|
- }
|
|
|
- else{
|
|
|
- coe = ration.quantityCoe&&this.isNotEmpty(ration.quantityCoe[coeField])?ration.quantityCoe[coeField]:1;
|
|
|
- coe = parseFloat(coe);
|
|
|
- }
|
|
|
-
|
|
|
+ if(projectGLJ && projectGLJ.is_adjust_price == 1){
|
|
|
+ coe = ration.quantityCoe&&this.isNotEmpty(ration.quantityCoe[coeField])?ration.quantityCoe[coeField]:1;
|
|
|
+ coe = parseFloat(coe);
|
|
|
+ }else{
|
|
|
+ coe = 1;
|
|
|
+ }
|
|
|
if (coe == 0) coe = 1;
|
|
|
let glj_quantity = scMathUtil.roundForObj(ration_glj.quantity, q_decimal);
|
|
|
return scMathUtil.roundForObj(glj_quantity * coe,q_decimal);
|
|
|
@@ -282,7 +280,8 @@ let gljUtil = {
|
|
|
}
|
|
|
},
|
|
|
getFlag:function (b) {
|
|
|
- return _.find(b.flags,{"fieldName":"fixed"});
|
|
|
+ let lo_sh = typeof _ !== 'undefined'?_:this._;
|
|
|
+ return lo_sh.find(b.flags,{"fieldName":"fixed"});
|
|
|
},
|
|
|
getGLJPrice:function (glj,projectGLJDatas,calcOptions,labourCoeDatas,decimalObj,isRadio,_,scMathUtil,ext,tenderCoe, isReport) {
|
|
|
let result = {};
|
|
|
@@ -433,14 +432,16 @@ let gljUtil = {
|
|
|
return parseInt(str.substr(0,1));
|
|
|
},
|
|
|
sortRationGLJ:function (list, std) {
|
|
|
- const field = std ? 'gljType' : 'type';
|
|
|
- list = _.sortByAll(list, [function (item) {
|
|
|
- return gljUtil.getMainType(item[field]);
|
|
|
- }, gljUtil.getCodeSortMath()]);
|
|
|
- return list;
|
|
|
+ const field = std ? 'gljType' : 'type';
|
|
|
+ let lo_sh = typeof _ !== 'undefined'?_:this._;
|
|
|
+ list = lo_sh.sortByAll(list, [function (item) {
|
|
|
+ return gljUtil.getMainType(item[field]);
|
|
|
+ }, gljUtil.getCodeSortMath()]);
|
|
|
+ return list;
|
|
|
},
|
|
|
sortMixRatio:function (list) {
|
|
|
- return _.sortByAll(list, ["code"]);
|
|
|
+ let lo_sh = typeof _ !== 'undefined'?_:this._;
|
|
|
+ return lo_sh.sortByAll(list, ["code"]);
|
|
|
},
|
|
|
//项目工料机 混凝土、砂浆、配合比排序与定额工料机不一样,同时,type取值的地方不一样
|
|
|
sortProjectGLJ:function (list,lodash) {
|
|
|
@@ -494,9 +495,10 @@ let gljUtil = {
|
|
|
return {glj_id:-99,unit_price_file_id:unitFileID,connect_key:connect_key,consumption:consumption,code:'80CCS',name:'车船税',unit:'元',type:302,specs:'',from:"cpt"}
|
|
|
},
|
|
|
updateProperty: function (obj, doc) {
|
|
|
- _.forEach(doc, function (n, key) {
|
|
|
+ let lo_sh = typeof _ !== 'undefined'?_:this._;
|
|
|
+ lo_sh.forEach(doc, function (n, key) {
|
|
|
obj[key] = n;
|
|
|
- });
|
|
|
+ });
|
|
|
},
|
|
|
getTotalQuantity:function(glj,ration,rd,gd){
|
|
|
if(ration){
|
|
|
@@ -504,7 +506,8 @@ let gljUtil = {
|
|
|
quantity = (quantity == 0 || quantity == undefined || quantity == null || quantity == "") ? 0 : quantity;
|
|
|
quantity = scMathUtil.roundForObj(quantity, rd);//计算前进行4舍5入
|
|
|
glj.quantity = scMathUtil.roundForObj(glj.quantity, gd);
|
|
|
- glj.tenderQuantity = this.getRationGLJTenderQuantity(glj, ration, gd, scMathUtil);
|
|
|
+ let pglj = calcTools.getProjectGLJ(glj);
|
|
|
+ glj.tenderQuantity = this.getRationGLJTenderQuantity(glj, ration, gd, scMathUtil,pglj);
|
|
|
|
|
|
return scMathUtil.roundToString(quantity * glj.quantity, gd);
|
|
|
}
|
|
|
@@ -569,8 +572,9 @@ let gljUtil = {
|
|
|
}
|
|
|
},
|
|
|
setProperty:function(Obj,updateData) {
|
|
|
+ let lo_sh = typeof _ !== 'undefined'?_:this._;
|
|
|
for(let ukey in updateData){
|
|
|
- if(_.isObject(updateData[ukey]) && _.isObject(Obj[ukey])&&!_.isArray(updateData[ukey])){
|
|
|
+ if(lo_sh.isObject(updateData[ukey]) && lo_sh.isObject(Obj[ukey])&&!lo_sh.isArray(updateData[ukey])){
|
|
|
setProperty(Obj[ukey],updateData[ukey]);
|
|
|
}else {
|
|
|
Obj[ukey] = updateData[ukey];
|
|
|
@@ -637,4 +641,9 @@ let gljUtil = {
|
|
|
hasCompMaterial:[202, 203, 204],//有组成物的材料
|
|
|
hasCompMachine:[301],//有组成物的机械
|
|
|
machineComposition:[201,302,303]//可以做为机械组成物的类型
|
|
|
+}
|
|
|
+
|
|
|
+if (typeof module !== 'undefined') {
|
|
|
+ gljUtil._ = require("lodash");
|
|
|
+ module.exports = gljUtil;
|
|
|
}
|