Pārlūkot izejas kodu

feat: 概算汇总接口,方便报表取数据,规范数据

vian 4 gadi atpakaļ
vecāks
revīzija
26fbeec91a
2 mainītis faili ar 22 papildinājumiem un 3 dzēšanām
  1. 20 1
      modules/main/facade/bill_facade.js
  2. 2 2
      public/common_util.js

+ 20 - 1
modules/main/facade/bill_facade.js

@@ -151,7 +151,26 @@ module.exports={
         const constructionFeeBills = await this.getConstructionFeeData(constructionID, sortedOtherFeeBills[0].ID);
         // 汇算工程费用
         await this.summarizeData(constructionFeeBills);
-        return [...constructionFeeBills, ...sortedOtherFeeBills];
+        const rst = [...constructionFeeBills, ...sortedOtherFeeBills];
+        // 方便报表取数据,规范数据
+        rst.forEach(item => {
+            item.code = item.code || '';
+            item.name = item.name || '';
+            item.unit = item.unit || '';
+            item.quantity = item.quantity || '';
+            const buildingFeeItem = item.fees && item.fees.find(f => f.fieldName === 'building');
+            const installFeeItem = item.fees && item.fees.find(f => f.fieldName === 'installation');
+            const equipmentFeeItem = item.fees && item.fees.find(f => f.fieldName === 'equipment');
+            const otherFeeItem = item.fees && item.fees.find(f => f.fieldName === 'other');
+            const totalFeeItem = item.fees && item.fees.find(f => f.fieldName === 'common');
+            item.buildingFee = buildingFeeItem ? buildingFeeItem.totalFee : 0;
+            item.installationFee = installFeeItem ? installFeeItem.totalFee : 0;
+            item.equipmentFee = equipmentFeeItem ? equipmentFeeItem.totalFee : 0;
+            item.otherFee = otherFeeItem ? otherFeeItem.totalFee : 0;
+            item.totalFee = totalFeeItem ? totalFeeItem.totalFee : 0;
+            item.rate = '0';
+        });
+        return rst;
     },
     // 获取工程费用数据,作为概算汇总数据的拼接树数据
     getConstructionFeeData: async function (constructionID, nextID) {

+ 2 - 2
public/common_util.js

@@ -133,10 +133,10 @@ function deleteEmptyObject(arr) {
 
     // 判断单位工程的工程专业的金额所属是“建筑工程费”还是“安装工程费”
     const getEngineeringFeeType = (engineeringName) => {
-        if (['土建工程', '装饰工程', '市政工程', '城市轨道交通工程', '装配式建筑工程', '城市地下综合管廊工程'].includes(engineeringName)) {
+        if (['土建工程', '装饰工程', '市政工程', '城市轨道交通工程', '装配式建筑工程', '城市地下综合管廊工程', '轨道工程'].includes(engineeringName)) {
             return 'building';
         }
-        if (['安装工程']) {
+        if (['安装工程', '城市轨道交通安装']) {
             return 'installation'
         }
         return null;