Jelajahi Sumber

定额计算规则。

Chenshilong 8 tahun lalu
induk
melakukan
a7d37cc4a1

+ 1 - 1
public/calc_util.js

@@ -190,4 +190,4 @@ class calculation {
     }
 }
 
-module.exports = new calculation();
+//module.exports = new calculation();

+ 2 - 1
web/building_saas/main/html/main.html

@@ -495,7 +495,7 @@
     <script type="text/javascript" src="/web/building_saas/main/js/models/ration_ass.js"></script>
 
     <script type="text/javascript" src="/public/web/id_tree.js"></script>
-    <script type="text/javascript" src="/test/tmp_data/test_ration_calc/ration_calc_base.js"></script>
+	<script type="text/javascript" src="/test/tmp_data/test_ration_calc/ration_calc_base.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/models/cache_tree.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/calc/calc_fees.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/calc/ration_calc.js"></script>
@@ -504,6 +504,7 @@
     <script type="text/javascript" src="/public/web/tree_sheet/tree_sheet_controller.js"></script>
     <script type="text/javascript" src="/public/web/tree_sheet/tree_sheet_helper.js"></script>
     <script type="text/javascript" src="/public/web/sheet/sheet_data_helper.js"></script>
+
     <!-- Test Data -->
     <script type="text/javascript" src="/test/tmp_data/bills_grid_setting.js"></script>
     <!--<script type="text/javascript" src="/test/tmp_data/test_bills_calc/bills_grid_setting_test_calc.js"></script>

+ 11 - 65
web/building_saas/main/js/models/ration_calc.js

@@ -367,69 +367,15 @@ let calcTemplate = {
     ]
 };
 
-let calcRation = {
-    "sectionId" : 76,
-    "ID" : 15,
-    "code" : "AA0001",
-    "name" : "人工挖土方",
-    "unit" : "100m3",
-    "basePrice" : 840.84,
-    "caption" : "人工挖土方",
-    "feeType" : 2,
-    "rationGljList" : [
-        {
-            "glj" : {
-                "repositoryId" : 3,
-                "ID" : 17,
-                "code" : "00010201",
-                "name" : "土石方综合工日",
-                "specs" : null,
-                "unit" : "工日",
-                "basePrice" : 22,
-                "gljDistType" : "人工",
-                "gljType" : 2
-            },
-            "consumeAmt" : 38.22,
-            "proportion" : 0
-        },{
-            "glj": {
-                "repositoryId" : 3,
-                "ID" : 68,
-                "code" : "85030207",
-                "name" : "履带式起重机",
-                "specs" : "50t",
-                "unit" : "台班",
-                "basePrice" : 1194.05,
-                "gljDistType" : "机械",
-                "gljType" : 64
-            },
-            "consumeAmt" : 1.22,
-            "proportion" : 0
-        },{
-            "glj": {
-                "repositoryId" : 3,
-                "ID" : 200,
-                "code" : "36290101",
-                "name" : "水",
-                "specs" : "",
-                "unit" : "m3",
-                "basePrice" : 2,
-                "gljDistType" : "材料",
-                "gljType" : 6
-            },
-            "consumeAmt" : 9.2,
-            "proportion" : 0
-        }
-    ],
-    "rationRepId" : 3
-};
+class RationCalc {
+    constructor(project){
+        this.project = project;
+    };
 
-let rationCalcObj = {};
-
-calcUtil.init(dummyCalcTpl, dummyFee);
-calcUtil.compile();
-calcUtil.calculate(dummyRation);
-for (let idx of dummyCalcTpl.compiledSeq) {
-    let item = dummyCalcTpl.calcItems[idx];
-    console.log('code: ' + item.code + ' | expression: ' + item.compiledExpr +  ' | result: ' + item.execRst);
-};
+    calculate(ration){
+        let calcUtil = new calculation();
+        calcUtil.init(calcTemplate, calcFeeRate);
+        calcUtil.compile();
+        calcUtil.calculate(ration);
+    };
+}

+ 63 - 2
web/building_saas/main/js/views/ration_calc_view.js

@@ -1,6 +1,62 @@
 /**
  * Created by CSL on 2017-07-17.
  */
+let calcRation = {
+    "sectionId" : 76,
+    "ID" : 15,
+    "code" : "AA0001",
+    "name" : "人工挖土方",
+    "unit" : "100m3",
+    "basePrice" : 840.84,
+    "caption" : "人工挖土方",
+    "feeType" : 2,
+    "rationGljList" : [
+        {
+            "glj" : {
+                "repositoryId" : 3,
+                "ID" : 17,
+                "code" : "00010201",
+                "name" : "土石方综合工日",
+                "specs" : null,
+                "unit" : "工日",
+                "basePrice" : 22,
+                "gljDistType" : "人工",
+                "gljType" : 2
+            },
+            "consumeAmt" : 38.22,
+            "proportion" : 0
+        },{
+            "glj": {
+                "repositoryId" : 3,
+                "ID" : 68,
+                "code" : "85030207",
+                "name" : "履带式起重机",
+                "specs" : "50t",
+                "unit" : "台班",
+                "basePrice" : 1194.05,
+                "gljDistType" : "机械",
+                "gljType" : 64
+            },
+            "consumeAmt" : 1.22,
+            "proportion" : 0
+        },{
+            "glj": {
+                "repositoryId" : 3,
+                "ID" : 200,
+                "code" : "36290101",
+                "name" : "水",
+                "specs" : "",
+                "unit" : "m3",
+                "basePrice" : 2,
+                "gljDistType" : "材料",
+                "gljType" : 6
+            },
+            "consumeAmt" : 9.2,
+            "proportion" : 0
+        }
+    ],
+    "rationRepId" : 3
+};
 
 let rationCalcView = {
     sheet: null,
@@ -14,7 +70,7 @@ let rationCalcView = {
             {headerName: "计算基数", headerWidth: 180, dataCode: "dispExpr", dataType: "String"},
             {headerName: "基数说明", headerWidth: 220, dataCode: "statement", dataType: "String"},
             {headerName: "费率", headerWidth: 80, dataCode: "feeRate", dataType: "Number"},   // precision: 3
-            {headerName: "单价", headerWidth: 100, dataCode: "unitFee", dataType: "Number"},
+            {headerName: "单价", headerWidth: 100, dataCode: "execRst", dataType: "Number"},  // unitFee
             {headerName: "合价", headerWidth: 100, dataCode: "totalFee", dataType: "Number"},
             {headerName: "备注", headerWidth: 120, dataCode: "memo", dataType: "String"}
         ],
@@ -32,7 +88,12 @@ let rationCalcView = {
 
     showData: function (ration) {
         var me = this;
-        me.ration = ration;  // AAAAAAA
+        //me.ration = ration;  // AAAAAAA
+        me.ration = calcRation;
+
+        let rationCalc = new RationCalc(null);
+        rationCalc.calculate(me.ration);
+
         me.datas = calcTemplate.calcItems;   // AAAAAAAAA
         sheetCommonObj.showData(me.sheet, me.setting, me.datas);
     }