Bläddra i källkod

feat: 轨道交通工程,概算汇总增加章编号、节编号的处理

vian 4 år sedan
förälder
incheckning
1a9edac500

+ 2 - 0
modules/all_models/bills.js

@@ -13,6 +13,8 @@ let billsSchema = new Schema({
     chapterID: Number,
     billsLibId: Number,
     code: String,
+    chapterCode: String,
+    sectionCode: String,
     fullCode: String,
     type:{type: Number,default:4},//1 :大项费用 2:分部 3分项 4清单;5补项
     isAdd:{type: Number,default:0},//1 true 0 false是否新增

+ 2 - 0
modules/all_models/projects.js

@@ -21,6 +21,8 @@ const ProjectSchema = new Schema({
     "userID": {type:String,index: true},
     "importedByInterface": {type: Boolean, default: false},
     "code": {type: String, default: ''},
+    chapterCode: String,
+    sectionCode: String,
     "name": String,
     "projType": String,
     "recentDateTime": Date,

+ 2 - 2
modules/main/controllers/bills_controller.js

@@ -272,8 +272,8 @@ module.exports = {
     initialBudgetSummary: async function (req, res) {
         const data = JSON.parse(req.body.data);
         try {
-            const bills = await bill_facade.initialBudgetSummary(data.constructionID);
-            callback(req, res, 0, 'success', bills);
+            const rst = await bill_facade.initialBudgetSummary(data.constructionID);
+            callback(req, res, 0, 'success', rst);
         } catch (err) {
             console.log(err);
             callback(req, res, 1, err, null);

+ 265 - 4
web/building_saas/budget-summary/js/budgetSummarySetting.js

@@ -1,4 +1,5 @@
-const budgetSummaryTreeSetting = {
+// 建筑安装工程
+const budgetInstallationSetting = {
     rowHeaderWidth: 15,
     treeCol: 0,
     emptyRows: 0,
@@ -56,7 +57,7 @@ const budgetSummaryTreeSetting = {
     }, {
         width: 70,
         head: {
-            titleNames: ["量"],
+            titleNames: ["工程总量"],
             spanCols: [1],
             spanRows: [1],
             vAlign: [1],
@@ -73,7 +74,7 @@ const budgetSummaryTreeSetting = {
     }, {
         width: 100,
         head: {
-            titleNames: ["单价"],
+            titleNames: ["技术经济指标"],
             spanCols: [1],
             spanRows: [1],
             vAlign: [1],
@@ -223,4 +224,264 @@ const budgetSummaryTreeSetting = {
         }
     },
     ]
-};
+};
+
+// 轨道工程
+const budgetRailSetting = {
+    rowHeaderWidth: 15,
+    treeCol: 0,
+    emptyRows: 0,
+    headRows: 1,
+    headRowHeight: [40],
+    defaultRowHeight: 21,
+    cols: [{
+        width: 140,
+        head: {
+            titleNames: ["编码"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "code",
+            vAlign: 1,
+            hAlign: 0,
+            font: "Arial"
+        }
+    },{
+        width: 100,
+        head: {
+            titleNames: ["章编号"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "chapterCode",
+            vAlign: 1,
+            hAlign: 0,
+            font: "Arial"
+        }
+    }, {
+        width: 100,
+        head: {
+            titleNames: ["节编号"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "sectionCode",
+            vAlign: 1,
+            hAlign: 0,
+            font: "Arial"
+        }
+    }, {
+        width: 140,
+        head: {
+            titleNames: ["名称"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "name",
+            vAlign: 1,
+            hAlign: 0,
+            font: "Arial"
+        }
+    }, {
+        width: 60,
+        head: {
+            titleNames: ["单位"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "unit",
+            vAlign: 1,
+            hAlign: 1,
+            font: "Arial"
+        }
+    }, {
+        width: 70,
+        head: {
+            titleNames: ["工程总量"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "quantity",
+            type: 'number',
+            vAlign: 1,
+            hAlign: 2,
+            font: "Arial",
+        }
+    }, {
+        width: 100,
+        head: {
+            titleNames: ["技术经济指标"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"],
+        },
+        data: {
+            field: "feesIndex.common.unitFee",
+            type: 'number',
+            vAlign: 1,
+            hAlign: 2,
+            font: "Arial"
+        }
+    }, {
+        width: 100,
+        readOnly: true,
+        head: {
+            titleNames: ["合价"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "feesIndex.common.totalFee",
+            vAlign: 1,
+            hAlign: 2,
+            font: "Arial"
+        }
+    }, {
+        width: 140,
+        head: {
+            titleNames: ["计算基数"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "calcBase",
+            vAlign: 1,
+            hAlign: 0,
+            font: "Arial"
+        }
+    }, {
+        width: 80,
+        head: {
+            titleNames: ["费率(%)"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "feeRate",
+            type: 'number',
+            vAlign: 1,
+            hAlign: 2,
+            font: "Arial"
+        }
+    }, {
+        width: 100,
+        readOnly: true,
+        head: {
+            titleNames: ["建筑工程费"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "feesIndex.building.totalFee",
+            vAlign: 1,
+            hAlign: 2,
+            font: "Arial"
+        }
+    }, {
+        width: 100,
+        readOnly: true,
+        head: {
+            titleNames: ["安装工程费"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "feesIndex.installation.totalFee",
+            vAlign: 1,
+            hAlign: 2,
+            font: "Arial"
+        }
+    }, {
+        width: 100,
+        readOnly: true,
+        head: {
+            titleNames: ["设备购置费"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "feesIndex.equipment.totalFee",
+            vAlign: 1,
+            hAlign: 2,
+            font: "Arial"
+        }
+    }, {
+        width: 80,
+        readOnly: true,
+        head: {
+            titleNames: ["其他费用"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "feesIndex.other.totalFee",
+            vAlign: 1,
+            hAlign: 2,
+            font: "Arial"
+        }
+    }, {
+        width: 140,
+        head: {
+            titleNames: ["备注"],
+            spanCols: [1],
+            spanRows: [1],
+            vAlign: [1],
+            hAlign: [1],
+            font: ["Arial"]
+        },
+        data: {
+            field: "remark",
+            vAlign: 1,
+            hAlign: 0,
+            font: "Arial"
+        }
+    },
+    ]
+};

+ 25 - 3
web/building_saas/budget-summary/js/budgetSummarySheet.js

@@ -1,8 +1,13 @@
+
 /* 建设其他费表格相关 */
 const budgetSummaryObj = (() => {
 
   const { isEmptyVal, isDef, isNumber } = window.commonUtil;
-  const { fixedFlag, BudgetArea } = window.commonConstants;
+  const { fixedFlag, BudgetArea, BudgetType } = window.commonConstants;
+
+  let budgetSummaryTreeSetting;
+
+  let curBudgetType = BudgetType.BUILDING;
 
   // 原始数据
   let rawData = [];
@@ -231,7 +236,9 @@ const budgetSummaryObj = (() => {
               fees.push({ fieldName: 'other', totalFee: commonFeeItem && commonFeeItem.totalFee || 0 });
             }
           }
-          bulkData.push({ type: 'update', data: { ID, ...data } });
+          const actualID = node.data.area === BudgetArea.CONSTRUCTION_FEE ? node.data.orgProjectID : ID;
+          const updateType = node.data.area === BudgetArea.CONSTRUCTION_FEE ? 'updateProject' : 'update';
+          bulkData.push({ type: updateType, data: { ...data, ID: actualID } });
         });
       await bulkOperation(bulkData);
       Object
@@ -369,6 +376,19 @@ const budgetSummaryObj = (() => {
       }
       const endIndex =  constructionFeeNode.posterityCount() + 1;
       sheet.getRange(0, 0, endIndex, budgetSummaryTreeSetting.cols.length, GC.Spread.Sheets.SheetArea.viewport).locked(true);
+      // 除第一行,章编号 节编号可编辑
+      if (curBudgetType === BudgetType.RAIL) {
+        const chapterCodeCol = budgetSummaryTreeSetting.cols.findIndex(item => item.data.field === 'chapterCode');
+        const sectionCodeCol = budgetSummaryTreeSetting.cols.findIndex(item => item.data.field === 'sectionCode');
+        for (let row = 1; row < endIndex; row++) {
+          if (chapterCodeCol > -1) {
+            sheet.getCell(row, chapterCodeCol).locked(false);
+          }
+          if (sectionCodeCol > -1) {
+            sheet.getCell(row, sectionCodeCol).locked(false);
+          }
+        }
+      }
       return endIndex;
     }
     if (isMass) {
@@ -689,7 +709,9 @@ const budgetSummaryObj = (() => {
       $.bootstrapLoading.start();
       // 得先计算费用汇总(概算汇总计算基于费用汇总算出来的总金额)
       await projectObj.project.calcProgram.getGatherFeeData();
-      const { treeData, costGrowthRate, growthPeriod } = await ajaxPost('/bills/initialBudgetSummary', { constructionID });
+      const { budgetType, treeData, costGrowthRate, growthPeriod } = await ajaxPost('/bills/initialBudgetSummary', { constructionID });
+      budgetSummaryTreeSetting = budgetType === BudgetType.BUILDING ? budgetInstallationSetting : budgetRailSetting;
+      curBudgetType = budgetType;
       calcSetting.costGrowthRate = costGrowthRate;
       calcSetting.growthPeriod = growthPeriod;
       $('#costGrowthRate').val(costGrowthRate);