Selaa lähdekoodia

feat: 提供报表承包人主要材料设备_变值权重B等数据后端获取方法

zhangweicheng 4 vuotta sitten
vanhempi
commit
c0ebaa7c8e

+ 6 - 1
public/gljUtil.js

@@ -22,7 +22,8 @@ module.exports = {
     getEconomicDatas:getEconomicDatas,
     getMainMaterialDatas:getMainMaterialDatas,
     getQuantityDatas:getQuantityDatas,
-    getTenderPriceCoe:getTenderPriceCoe
+    getTenderPriceCoe:getTenderPriceCoe,
+    getPriceCoeDatas:getPriceCoeDatas,
 };
 
 function calcProjectGLJQuantity(projectGLJDatas,rationGLJDatas,rationDatas,billsDatas,q_decimal) {
@@ -75,4 +76,8 @@ function getQuantityDatas(engineerFeatures,mainQuantities,billsList,fixedFlag,_,
 
 function getTenderPriceCoe(glj,tproperty){
   return gljNodeUtil.getTenderPriceCoe(glj,tproperty);
+}
+
+function getPriceCoeDatas(pgljList, contractorList, totalFee, tprojectProperty,_,scMathUtil){
+    gljNodeUtil.getPriceCoeDatas(pgljList, contractorList, totalFee, tprojectProperty,_,scMathUtil);
 }

+ 43 - 0
public/web/gljUtil.js

@@ -634,6 +634,49 @@ let gljUtil = {
       let infoPrice = info[fieldArray[0]];
       if(!this.isDef(infoPrice)) infoPrice= info[fieldArray[1]];//信息价只有一个价格(含税价/不含税价),则不分计税方式,套用仅有的价格。
       return parseFloat(infoPrice);
+    },
+    getPriceCoeDatas: function (projectGLJList, contractor_list, totalFee, projectProperty,_,scMathUtil) {
+        let datas = [];
+        let pgljList = projectGLJList ;
+        let contractorList = contractor_list ;
+        let decimalObj = projectProperty.decimal;  
+        let calcOptions=projectProperty.calcOptions;
+        let billsDecimal =  decimalObj.bills.totalPrice ;
+        let gljMap = _.indexBy(pgljList, 'id');
+        for (let e of contractorList) {
+          let t = {
+            ID: e.ID,
+            projectID: e.projectID,
+            is_related: e.is_related, //关联,1关,0不关
+            projectGLJID: e.projectGLJID, //关联工料机ID
+            seq: e.seq, //序号
+            code: e.code,
+            name: e.name,
+            specs: e.specs,
+            unit: e.unit,
+            type: e.type,
+            marketPrice: e.market_price,
+            quantity: e.quantity,
+            remark: e.remark,
+            supply: e.supply,
+            is_evaluate: 0,
+            FO: e.FO,
+            FI: e.FI
+          };
+          let pglj = gljMap[e.projectGLJID];
+          if (e.is_related && pglj) {
+            let tenderCoe = gljUtil.getTenderPriceCoe(pglj,projectProperty);
+            t.marketPrice = gljUtil.getMarketPrice(pglj,{gljList:pgljList},calcOptions,decimalObj,false,_,scMathUtil,tenderCoe);
+            t.vender = pglj.vender;
+            t.supply = pglj.supply;
+            t.quantity = pglj.quantity;
+            t.is_evaluate = pglj.is_evaluate;
+          }
+          t.totalPrice = scMathUtil.roundForObj(parseFloat(t.quantity) * parseFloat(t.marketPrice), billsDecimal);
+          if (totalFee !== 0) t.varWeight = scMathUtil.roundForObj(t.totalPrice / totalFee, 2);
+          datas.push(t);
+        }
+        return _.sortByAll(datas, 'code');
     },      
     fixedFlag : {
         // 分部分项工程

+ 6 - 6
web/building_saas/main/js/views/material_adjust_view.js

@@ -434,17 +434,17 @@ let materialAdjustObj = {
     }
     return _.sortByAll(datas, 'code');
   },
-  getPriceCoeDatas: function (projectGLJList, contractor_list, totalFee, decimalObj) {
-    let datas = [];
+  getPriceCoeDatas: function (projectGLJList, contractor_list, totalFee, projectProperty) {
     let pgljList = projectGLJList ? projectGLJList : projectObj.project.projectGLJ.datas.gljList;
     let contractorList = contractor_list ? contractor_list : projectObj.project.contractor_list.datas;
-    let billsDecimal = decimalObj ? decimalObj.bills.totalPrice : getDecimal('bills.totalPrice');
-    let gljMap = _.indexBy(pgljList, 'id');
+    let tprojectProperty = projectProperty?projectProperty:projectObj.project.projectInfo.property;
     if (!gljUtil.isDef(totalFee)) {
       let node = projectObj.project.Bills.getEngineeringCostNode(projectObj.mainController);
       totalFee = node && node.data.feesIndex && node.data.feesIndex.common ? node.data.feesIndex.common.totalFee : 0;
     }
-    for (let e of contractorList) {
+    return gljUtil.getPriceCoeDatas(pgljList, contractorList, totalFee, tprojectProperty,_,scMathUtil)
+
+    /* for (let e of contractorList) {
       let t = {
         ID: e.ID,
         projectID: e.projectID,
@@ -476,7 +476,7 @@ let materialAdjustObj = {
       if (totalFee !== 0) t.varWeight = scMathUtil.roundForObj(t.totalPrice / totalFee, 2);
       datas.push(t);
     }
-    return _.sortByAll(datas, 'code');
+    return _.sortByAll(datas, 'code'); */
   },
   getCommonObject: function (glj) {
     let data = {