chenshilong пре 7 година
родитељ
комит
cc5c26174d

+ 0 - 49
web/building_saas/main/js/calc/calc_fees.js

@@ -1,38 +1,6 @@
 /**
  * Created by Mai on 2017/7/21.
  */
-
-let feeType = [
-    // {type: 'common', name: '工程造价'},
-    // {type: 'baseLabour', name: '基价人工费'},
-    // {type: 'material', name: '材料费'},
-    // {type: 'machine', name: '机械费'},
-    // {type: 'rationDirect', name: '定额直接费'},
-    // {type: 'manage', name: '企业管理费'},
-    // {type: 'profit', name: '利润'},
-    // {type: 'risk', name: '风险费'},
-
-// 以下标准由缪佩玲提供
-    {type: 'direct', name: '直接费'},
-    {type: 'labour', name: '人工费'},
-    {type: 'material', name: '材料费'},
-    {type: 'machine', name: '机械费'},
-    {type: 'mainMaterial', name: '主材费'},
-    {type: 'equipment', name: '设备费'},
-    {type: 'manage', name: '企业管理费'},
-    {type: 'profit', name: '利润'},
-    {type: 'risk', name: '风险费'},
-    {type: 'labourDiff', name: '人工价差'},
-    {type: 'materialDiff', name: '材料价差'},
-    {type: 'machineDiff', name: '机械价差'},
-    {type: 'common', name: '工程造价'},
-    {type: 'adjustLabour', name: '调整人工费'},
-    {type: 'adjustMachineLabour', name: '调整机上人工费'},
-    {type: 'zangu', name: '暂估'},
-    // 模拟用户新增
-    {type: 'fee1', name: '甲供材料费'}
-];
-
 let calcFees = {
     findFee: function (data, fieldName) {
         if (!data.fees) {
@@ -107,22 +75,5 @@ let calcFees = {
                 };
             }
         }
-    },
-    // CSL,2017.08.28
-    feeTypeToName: function (type) {
-        for (let ft of feeType) {
-            if (ft.type === type) {
-                return ft.name;
-            };
-        };
-    },
-
-    feeNameToType: function (name) {
-        for (let ft of feeType) {
-            if (ft.name === name) {
-                return ft.type;
-            };
-        };
-        return '';
     }
 }

+ 41 - 5
web/building_saas/main/js/models/calc_program.js

@@ -150,6 +150,27 @@ let rationCalcBase = [
     }
 ];
 
+let cpFeeTypes = [
+    {type: 'direct', name: '直接费'},
+    {type: 'labour', name: '人工费'},
+    {type: 'material', name: '材料费'},
+    {type: 'machine', name: '机械费'},
+    {type: 'mainMaterial', name: '主材费'},
+    {type: 'equipment', name: '设备费'},
+    {type: 'manage', name: '企业管理费'},
+    {type: 'profit', name: '利润'},
+    {type: 'risk', name: '风险费'},
+    {type: 'labourDiff', name: '人工价差'},
+    {type: 'materialDiff', name: '材料价差'},
+    {type: 'machineDiff', name: '机械价差'},
+    {type: 'adjustLabour', name: '调整人工费'},
+    {type: 'adjustMachineLabour', name: '调整机上人工费'},
+    {type: 'zangu', name: '暂估'},
+    {type: 'fee1', name: '甲供材料费'},
+    // 模拟用户新增
+    {type: 'common', name: '工程造价'}
+];
+
 let analyzer = {
     calcTemplate: null,
     success: true,
@@ -363,7 +384,7 @@ let executeObj = {
                 };
                 return result;
             };
-            // 量价没有具体的工料机类型,但仍然要用定额的计算程序,所以要给计算基数直接指定。
+            // 量价没有具体的工料机类型,但仍然要用定额的计算程序,所以要给计算基数直接指定。
             function volumePriceFee() {
                 let result = 0;
                 if (
@@ -400,10 +421,11 @@ let executeObj = {
 };
 
 let treeNodeTools = {
+    // 获取全部有公式的树节点清单
     getFormulaNodes: function () {
         let nodes = [];
-        for (let item of projectObj.project.mainTree.items){
-              if (item.data.calcBase && item.data.calcBase != '') nodes.push(item);
+        for (let node of projectObj.project.mainTree.items){
+              if (node.sourceType == ModuleNames.bills && node.data.calcBase && node.data.calcBase != '') nodes.push(node);
         };
         return nodes;
     },
@@ -469,7 +491,7 @@ class CalcProgram {
 
         me.feeRates = this.project.FeeRate.datas.rates;
         me.labourCoes = this.project.labourCoe.datas.coes;
-        me.feeTypes = feeType;
+        me.feeTypes = cpFeeTypes;
         me.calcBases = rationCalcBase;
         me.templates = this.project.calcProgram.datas.templates;
 
@@ -696,7 +718,7 @@ class CalcProgram {
 
             let objsArr = (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees) ? project.Ration.getRationsByNode(treeNode) : treeNode.children;
             let rst = [];
-            for (let ft of feeType) {
+            for (let ft of cpFeeTypes) {
                 let ftObj = {};
                 ftObj.fieldName = ft.type;
                 ftObj.name = ft.name;
@@ -994,6 +1016,20 @@ class CalcProgram {
         return changedNodes;
     };
 
+    // 计算全部公式项
+    calcFormulaNodes(){
+        let nodes = treeNodeTools.getFormulaNodes();
+        if (nodes.length == 0) return;
+        for (let node of nodes){
+              this.calcFormulaNode(node);
+        };
+    };
+
+    // 计算公式项。(它一定是叶子结点,它的父结点一定没有公式)
+    calcFormulaNode(treeNode){
+        // do
+    };
+
     // 计算叶子清单下的所有子结点(如定额、量价、工料机定额等), 并计算自身和所有父结点。最后打包存储。
     calcLeafAndSave(treeNode){
         let me = this;

+ 0 - 2
web/building_saas/main/js/models/main_consts.js

@@ -11,7 +11,6 @@ const ModuleNames = {
     ration_coe:'ration_coe',
     ration_ass:'ration_ass',
     quantity_detail:'quantity_detail',
-    // volume_price: 'volume_price',
     labour_coe: 'labour_coe',
     calc_program: 'calc_program'
 };
@@ -114,7 +113,6 @@ const volumePriceMaps = {
     5: "量设"
 };
 
-
 const rationType = {
     ration: 1,
     volumePrice: 2,

+ 1 - 1
web/building_saas/main/js/views/project_view.js

@@ -389,7 +389,7 @@ var projectObj = {
                 that.project.property = projectInfoObj.projectInfo.property;
                 //that.project.calcProgram.compileAllTemps();
                 that.project.calcBase.init(that.project);
-                that.project.calcFields = JSON.parse(JSON.stringify(feeType));
+                that.project.calcFields = JSON.parse(JSON.stringify(cpFeeTypes));
                 // that.project.initCalcFields();
                 let str = JSON.stringify(that.project.projSetting.main_tree_col);
                 that.project.projSetting.mainGridSetting = JSON.parse(str);