Browse Source

Merge branch 'master' of http://192.168.1.12:3000/SmartCost/ConstructionCost

TonyKang 7 years ago
parent
commit
81b367cca3

+ 4 - 1
config/gulpConfig.js

@@ -31,6 +31,7 @@ module.exports = {
     ],
     main_css:[
         'lib/ztree/css/zTreeStyle.css',
+        'lib/jquery-ui/jquery-ui.css',
         'lib/spreadjs/sheets/css/gc.spread.sheets.excel2013lightGray.10.0.1.css',
         'lib/spreadjs/views/gc.spread.views.dataview.10.0.0.css',
         'lib/jquery-contextmenu/jquery.contextMenu.css'
@@ -38,8 +39,11 @@ module.exports = {
     main_jspaths:[
         'lib/JSExpressionEval_src/*.js',
         '!lib/JSExpressionEval_src/JsHashMap.js',
+        'lib/jquery-ui/jquery-ui.min.js',
+        'lib/jquery-ui/jquery-ui-datepickerCN.js',
         'lib/jquery-contextmenu/*.js',
         'lib/lodash/lodash.js',
+        // 'test/tmp_data/test_ration_calc/ration_calc_base.js',
         'web/building_saas/main/js/models/main_consts.js',
         'web/building_saas/glj/js/project_glj.js',
         'web/building_saas/glj/js/composition.js',
@@ -74,7 +78,6 @@ module.exports = {
         // 'web/building_saas/main/js/models/volume_price.js',
         'web/building_saas/main/js/models/labour_coe.js',
         'public/web/id_tree.js',
-        'test/tmp_data/test_ration_calc/ration_calc_base.js',
         'web/building_saas/main/js/models/cache_tree.js',
         'web/building_saas/main/js/calc/calc_fees.js',
         'web/building_saas/main/js/calc/ration_calc.js',

+ 36 - 0
lib/jquery-ui/jquery-ui-datepickerCN.js

@@ -0,0 +1,36 @@
+/**
+ * Created by Zhong on 2017/11/27.
+ */
+jQuery(function($){
+    $.datepicker.regional['zh-CN'] = {
+        clearText: '清除',
+        clearStatus: '清除已选日期',
+        closeText: '关闭',
+        closeStatus: '不改变当前选择',
+        prevText: '< 上月',
+        prevStatus: '显示上月',
+        prevBigText: '<<',
+        prevBigStatus: '显示上一年',
+        nextText: '下月>',
+        nextStatus: '显示下月',
+        nextBigText: '>>',
+        nextBigStatus: '显示下一年',
+        currentText: '今天',
+        currentStatus: '显示本月',
+        monthNames: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
+        monthNamesShort: ['一月','二月','三月','四月','五月','六月', '七月','八月','九月','十月','十一月','十二月'],
+        monthStatus: '选择月份',
+        yearStatus: '选择年份',
+        weekHeader: '周',
+        weekStatus: '年内周次',
+        dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
+        dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
+        dayNamesMin: ['日','一','二','三','四','五','六'],
+        dayStatus: '设置 DD 为一周起始',
+        dateStatus: '选择 m月 d日, DD',
+        dateFormat: 'yy-mm-dd',
+        firstDay: 1,
+        initStatus: '请选择日期',
+        isRTL: false};
+    $.datepicker.setDefaults($.datepicker.regional['zh-CN']);
+});

File diff suppressed because it is too large
+ 1312 - 0
lib/jquery-ui/jquery-ui.css


File diff suppressed because it is too large
+ 13 - 0
lib/jquery-ui/jquery-ui.min.js


+ 3 - 90
test/tmp_data/test_ration_calc/ration_calc_base.js

@@ -3,97 +3,10 @@
  */
 "use strict";
 
-const baseCalc = 0, adjustCalc = 1, budgetCalc = 2, diffCalc = 3,  offerCalc = 4;
-
-const gljType = {
-    // 人工
-    LABOUR: 1,
-    // ==============材料类型=================
-    // 普通材料
-    GENERAL_MATERIAL: 201,
-    // 混凝土
-    CONCRETE: 202,
-    // 砂浆
-    MORTAR: 203,
-    // 配合比
-    MIX_RATIO: 204,
-    // 商品混凝土
-    COMMERCIAL_CONCRETE: 205,
-    // 商品砂浆
-    COMMERCIAL_MORTAR: 206,
-    // ==============材料类型=================
-    // ==============机械类型=================
-    // 普通机械
-    GENERAL_MACHINE: 301,
-    // 机械组成物
-    MACHINE_COMPOSITION: 302,
-    // 机上人工
-    MACHINE_LABOUR: 303,
-    // ==============机械类型=================
-    // 主材
-    MAIN_MATERIAL: 4,
-    // 设备
-    EQUIPMENT: 5
-};
-
-let rationCalcBase = [
-    {
-        'dispName': '定额基价人工费',
-        'calcFun': 'base',
-        'calcType': baseCalc,
-        'gljTypes': [gljType.LABOUR]
-    },
-    {
-        'dispName': '定额基价材料费',
-        'calcFun': 'base',
-        'calcType': baseCalc,
-        'gljTypes': [gljType.GENERAL_MATERIAL, gljType.CONCRETE, gljType.MORTAR, gljType.MIX_RATIO, gljType.COMMERCIAL_CONCRETE, gljType.COMMERCIAL_MORTAR]
-    },
-    {
-        'dispName': '定额基价机械费',
-        'calcFun': 'base',
-        'calcType': baseCalc,
-        'gljTypes': [gljType.GENERAL_MACHINE]
-    },
-    {
-        'dispName': '定额基价机上人工费',
-        'calcFun': 'base',
-        'calcType': baseCalc,
-        'gljTypes': [gljType.MACHINE_LABOUR]
-    },
-    {
-        'dispName': '人工费价差',
-        'calcFun': 'diff',
-        'calcType': diffCalc,
-        'gljTypes': [gljType.LABOUR]
-    },
-    {
-        'dispName': '材料费价差',
-        'calcFun': 'diff',
-        'calcType': diffCalc,
-        'gljTypes': [gljType.GENERAL_MATERIAL, gljType.CONCRETE, gljType.MORTAR, gljType.MIX_RATIO, gljType.COMMERCIAL_CONCRETE, gljType.COMMERCIAL_MORTAR]
-    },
-    {
-        'dispName': '机械费价差',
-        'calcFun': 'diff',
-        'calcType': diffCalc,
-        'gljTypes': [gljType.GENERAL_MACHINE]
-    },
-    {
-        'dispName': '主材费',
-        'calcFun': 'budget',
-        'calcType': budgetCalc,
-        'gljTypes': [gljType.MAIN_MATERIAL]
-    },
-    {
-        'dispName': '设备费',
-        'calcFun': 'budget',
-        'calcType': budgetCalc,
-        'gljTypes': [gljType.EQUIPMENT]
-    }
-];
+// 这里的代码分别移到main_costs.js中和calc_program.js中,目的是相关内容集中放置,减少重复声明,减少单元引用。
 
 // 该方法暂时不用,已使用中文预编译的方式代替,但可靠性有待验证,若有问题再用回来。
+/*
 function getRationCalcBase(dispName){
     for (let base of rationCalcBase) {
        if (base.dispName == dispName) {
@@ -101,4 +14,4 @@ function getRationCalcBase(dispName){
        };
     }
     return null;
-};
+};*/

+ 1 - 1
web/building_saas/glj/html/glj_index.html

@@ -12,7 +12,7 @@
 </div>
 <div class="container-fluid">
     <div class="row">
-        <div class="main-content col-lg-12 p-0">
+        <div class="col-lg-12 p-0">
             <div class="top-content">
                 <div class="main-data-top" id="project-glj">
                     <p style="text-align: center; margin-top: 30px;">正在加载数据</p>

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

@@ -13,6 +13,7 @@
     <!--zTree-->
     <link rel="stylesheet" href="/lib/ztree/css/zTreeStyle.css" type="text/css">
     <!--SpreadJs-->
+    <link rel="stylesheet" href="/lib/jquery-ui/jquery-ui.css" type="text/css">
     <link rel="stylesheet" href="/lib/spreadjs/sheets/css/gc.spread.sheets.excel2013lightGray.10.0.1.css" type="text/css">
     <link rel="stylesheet" href="/lib/spreadjs/views/gc.spread.views.dataview.10.0.0.css">
     <!-- jquery.contextmenu -->
@@ -620,7 +621,7 @@
 
 
         <!-- inject:js -->
-        <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/main_consts.js"></script>
         <script type="text/javascript" src="/web/building_saas/glj/js/project_glj.js"></script>
         <script type="text/javascript" src="/web/building_saas/glj/js/composition.js"></script>
@@ -646,6 +647,8 @@
         <script src="/lib/JSExpressionEval_src/Tokanizer.js"></script>
         <script src="/lib/JSExpressionEval_src/Evaluator.js"></script>
         <!--end expression calculate-->
+        <script type="text/javascript" src="/lib/jquery-ui/jquery-ui.min.js"></script>
+        <script type="text/javascript" src="/lib/jquery-ui/jquery-ui-datepickerCN.js"></script>
         <script type="text/javascript" src="/lib/jquery-contextmenu/jquery.contextMenu.js"></script>
         <script type="text/javascript" src="/lib/jquery-contextmenu/jquery.ui.position.js"></script>
         <script type="text/javascript" src="/lib/lodash/lodash.js"></script>

+ 1 - 1
web/building_saas/main/js/calc/bills_calc.js

@@ -2,7 +2,7 @@
  * Created by Mai on 2017/7/5.
  */
 
-const rationContent = 0, rationPrice = 1, rationPriceConverse = 2, billsPrice = 3;
+// const rationContent = 0, rationPrice = 1, rationPriceConverse = 2, billsPrice = 3;
 
 // sumTotalFeeFlag: sum(child.totalFee), totalFeeFlag: bills.quantity × bills.unitFee
 const sumTotalFeeFlag = 0, totalFeeFlag = 1;

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

@@ -18,6 +18,7 @@ let feeType = [
     {type: 'material', name: '材料费'},
     {type: 'machine', name: '机械费'},
     {type: 'mainMaterial', name: '主材费'},
+    {type: 'equipment', name: '设备费'},
     {type: 'manage', name: '企业管理费'},
     {type: 'profit', name: '利润'},
     {type: 'risk', name: '风险费'},

+ 128 - 26
web/building_saas/main/js/models/calc_program.js

@@ -100,6 +100,56 @@ let defaultBillTemplate = {
     ]
 };
 
+const baseCalcType = {baseCalc: 0, adjustCalc: 1, budgetCalc: 2, diffCalc: 3,  offerCalc: 4};
+
+let rationCalcBase = [
+    {
+        'dispName': '定额基价人工费',
+        'calcType': baseCalcType.baseCalc,
+        'gljTypes': [gljType.LABOUR]
+    },
+    {
+        'dispName': '定额基价材料费',
+        'calcType': baseCalcType.baseCalc,
+        'gljTypes': [gljType.GENERAL_MATERIAL, gljType.CONCRETE, gljType.MORTAR, gljType.MIX_RATIO, gljType.COMMERCIAL_CONCRETE, gljType.COMMERCIAL_MORTAR]
+    },
+    {
+        'dispName': '定额基价机械费',
+        'calcType': baseCalcType.baseCalc,
+        'gljTypes': [gljType.GENERAL_MACHINE]
+    },
+    {
+        'dispName': '定额基价机上人工费',
+        'calcType': baseCalcType.baseCalc,
+        'gljTypes': [gljType.MACHINE_LABOUR]
+    },
+    {
+        'dispName': '人工费价差',
+        'calcType': baseCalcType.diffCalc,
+        'gljTypes': [gljType.LABOUR]
+    },
+    {
+        'dispName': '材料费价差',
+        'calcType': baseCalcType.diffCalc,
+        'gljTypes': [gljType.GENERAL_MATERIAL, gljType.CONCRETE, gljType.MORTAR, gljType.MIX_RATIO, gljType.COMMERCIAL_CONCRETE, gljType.COMMERCIAL_MORTAR]
+    },
+    {
+        'dispName': '机械费价差',
+        'calcType': baseCalcType.diffCalc,
+        'gljTypes': [gljType.GENERAL_MACHINE]
+    },
+    {
+        'dispName': '主材费',
+        'calcType': baseCalcType.budgetCalc,
+        'gljTypes': [gljType.MAIN_MATERIAL]
+    },
+    {
+        'dispName': '设备费',
+        'calcType': baseCalcType.budgetCalc,
+        'gljTypes': [gljType.EQUIPMENT]
+    }
+];
+
 let analyzer = {
     calcTemplate: null,
     success: true,
@@ -293,10 +343,10 @@ let executeObj = {
                 for (let glj of me.treeNode.data.gljList) {
                     let price = 0;
                     if (base.gljTypes.indexOf(glj.type) >= 0) {
-                        if (base.calcType == baseCalc){ price = parseFloat(glj["basePrice"]);}
-                        else if (base.calcType == adjustCalc){price = parseFloat(glj["adjustPrice"]);}
-                        else if (base.calcType == budgetCalc){price = parseFloat(glj["marketPrice"]);}
-                        else if (base.calcType == diffCalc){
+                        if (base.calcType == baseCalcType.baseCalc){ price = parseFloat(glj["basePrice"]);}
+                        else if (base.calcType == baseCalcType.adjustCalc){price = parseFloat(glj["adjustPrice"]);}
+                        else if (base.calcType == baseCalcType.budgetCalc){price = parseFloat(glj["marketPrice"]);}
+                        else if (base.calcType == baseCalcType.diffCalc){
                             let aprice = glj["adjustPrice"] ? glj["adjustPrice"] : 0;
                             let mprice = glj["marketPrice"] ? glj["marketPrice"] : 0;
                             price = (parseFloat(mprice) - parseFloat(aprice)).toDecimal(me.digitDefault);
@@ -316,7 +366,7 @@ let executeObj = {
                     ( me.treeNode.data.subType === gljType.GENERAL_MACHINE && base.dispName === '定额基价机械费') ||
                     ( me.treeNode.data.subType === gljType.MAIN_MATERIAL && base.dispName === '主材费') ||
                     ( me.treeNode.data.subType === gljType.EQUIPMENT && base.dispName === '设备费')
-                ) result = me.treeNode.data.marketUnitFee;
+                ) result = me.treeNode.data.marketUnitFee ? me.treeNode.data.marketUnitFee : 0;
 
                 return result;
             };
@@ -541,6 +591,13 @@ class CalcProgram {
         };
     };
 
+    isLeafBill(treeNode){
+        let me = this;
+        return treeNode.sourceType === me.project.Bills.getSourceType() &&
+               treeNode.source.children &&
+               treeNode.source.children.length === 0;
+    };
+
     // 仅内部调用。注意:外部不能直接使用,因为这里传入的树节点必须有一定的初始化。
     InnerCalc(treeNode){
         let me = this;
@@ -582,32 +639,76 @@ class CalcProgram {
             };
         };
 
+        function isBaseFeeType(type){
+            return ['labour', 'material', 'machine', 'mainMaterial', 'equipment'].indexOf(type) > -1;
+        };
+
         // 汇总定额或子清单的费用类别
-        if (treeNode.calcType == treeNodeCalcType.ctGatherRations || treeNode.calcType == treeNodeCalcType.ctGatherBills){
+        if (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees || treeNode.calcType == treeNodeCalcType.ctGatherBillsFees){
             treeNode.data.programID = null;
             initFees(treeNode);
 
-            let objsArr = (treeNode.calcType == treeNodeCalcType.ctGatherRations) ? project.Ration.getRationsByNode(treeNode) : treeNode.children;
+            let objsArr = (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees) ? project.Ration.getRationsByNode(treeNode) : treeNode.children;
             let rst = [];
             for (let ft of feeType) {
                 let ftObj = {};
                 ftObj.fieldName = ft.type;
                 ftObj.name = ft.name;
-                let uf = 0, tf = 0, tuf = 0, ttf = 0;
-                for (let item of objsArr) {
-                    let data = (treeNode.calcType == treeNodeCalcType.ctGatherRations) ? item : item.data;
-                    if (data.feesIndex && data.feesIndex[ft.type]) {
-                        uf = (uf + parseFloat(data.feesIndex[ft.type].unitFee)).toDecimal(me.digitDefault);
-                        tf = (tf + parseFloat(data.feesIndex[ft.type].totalFee)).toDecimal(me.digitDefault);
-                        tuf = (tuf + parseFloat(data.feesIndex[ft.type].tenderUnitFee)).toDecimal(me.digitDefault);
-                        ttf = (ttf + parseFloat(data.feesIndex[ft.type].tenderTotalFee)).toDecimal(me.digitDefault);
+                let buf = 0, btf = 0, btuf = 0, bttf = 0;
+
+                if (treeNode.calcType == treeNodeCalcType.ctGatherBillsFees){
+                    for (let item of objsArr) {
+                        let data = item.data;
+                        if (data.feesIndex && data.feesIndex[ft.type]) {
+                            buf = (buf + parseFloat(data.feesIndex[ft.type].unitFee)).toDecimal(me.digitDefault);
+                            btf = (btf + parseFloat(data.feesIndex[ft.type].totalFee)).toDecimal(me.digitDefault);
+                            btuf = (btuf + parseFloat(data.feesIndex[ft.type].tenderUnitFee)).toDecimal(me.digitDefault);
+                            bttf = (bttf + parseFloat(data.feesIndex[ft.type].tenderTotalFee)).toDecimal(me.digitDefault);
+                        };
+                    };
+                }
+                else if (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees){     // 这里的算法要配合冷姐姐的神图才能看懂^_^
+                    let sum_rtf = 0, sum_rttf = 0;
+                    let bq = parseFloat(treeNode.data.quantity ? treeNode.data.quantity : 1);
+
+                    for (let data of objsArr) {
+                        let rq = parseFloat(data.quantity ? data.quantity : 0);
+
+                        let ruf = 0, rtuf = 0, rtf = 0, rttf = 0;
+                        if (data.feesIndex && data.feesIndex[ft.type]) {
+                            ruf = parseFloat(data.feesIndex[ft.type].unitFee);
+                            rtuf = parseFloat(data.feesIndex[ft.type].tenderUnitFee);
+                            rtf = parseFloat(data.feesIndex[ft.type].totalFee);
+                            rttf = parseFloat(data.feesIndex[ft.type].tenderTotalFee);
+                        };
+
+                        if (me.project.projSetting.billsCalcMode === leafBillGetFeeType.rationContent) {
+                            buf = (buf + (ruf * rq / bq).toDecimal(2)).toDecimal(2);
+                            btuf = (btuf + (rtuf * rq / bq).toDecimal(2)).toDecimal(2);
+                        };
+
+                        sum_rtf = (sum_rtf + rtf).toDecimal(2);
+                        sum_rttf = (sum_rttf + rttf).toDecimal(2);
+                    };
+
+                    if (me.project.projSetting.billsCalcMode === leafBillGetFeeType.rationPrice || me.project.projSetting.billsCalcMode === leafBillGetFeeType.rationPriceConverse) {
+                        buf = (sum_rtf / bq).toDecimal(2);
+                        btuf = (sum_rttf / bq).toDecimal(2);
+                    };
+                    if (isBaseFeeType(ft.type) || (me.project.projSetting.billsCalcMode === leafBillGetFeeType.rationPriceConverse && ft.type == "common")){
+                        btf = sum_rtf;
+                        bttf = sum_rttf;
+                    }
+                    else{
+                        btf = (buf * bq).toDecimal(2);
+                        bttf = (btuf * bq).toDecimal(2);
                     };
                 };
-                ftObj.unitFee = uf.toDecimal(me.digit);
-                ftObj.totalFee = tf.toDecimal(me.digit);
-                ftObj.tenderUnitFee = tuf.toDecimal(me.digit);
-                ftObj.tenderTotalFee = ttf.toDecimal(me.digit);
 
+                ftObj.unitFee = buf;
+                ftObj.totalFee = btf;
+                ftObj.tenderUnitFee = btuf;
+                ftObj.tenderTotalFee = bttf;
                 checkFee(treeNode, ftObj);
 
                 rst.push(ftObj);
@@ -676,7 +777,7 @@ class CalcProgram {
                 };
             }
         };
-    }
+    };
 
     // 计算本节点(默认同时递归计算所有父节点,可选)
     calculate(treeNode, calcParents = true){
@@ -684,27 +785,27 @@ class CalcProgram {
 
         let isRation = treeNode.sourceType === me.project.Ration.getSourceType();
         let isBill = treeNode.sourceType === me.project.Bills.getSourceType();
-        let isLeafBill = isBill && treeNode.source.children && treeNode.source.children.length === 0;   // 是清单且其下没有子清单
-        let isBillPriceCalc = me.project.projSetting.billsCalcMode === billsPrice;
+        let isBillPriceCalc = me.project.projSetting.billsCalcMode === leafBillGetFeeType.billsPrice;
+        let isLeafBill = me.isLeafBill(treeNode);
 
         if (isRation){
             treeNode.calcType = treeNodeCalcType.ctRationCalcProgram;
         }
         else if (isLeafBill) {
             if (treeNode.children && treeNode.children.length > 0){
-                me.calcLeafBillChildren(treeNode);
+                // me.calcLeafBillChildren(treeNode);
 
-                if (isBillPriceCalc)                        // 清单单价计算模式下的叶子清单:取自己的计算程序ID,找到自己的计算程序计算
+                if (isBillPriceCalc)                        // 清单单价计算模式下的叶子清单:取自己的计算程序ID,找到自己的计算程序计算。(汇总清单所有定额的工料机)
                     treeNode.calcType = treeNodeCalcType.ctBillCalcProgram;
                 else                                        // 前三种计算模式下的叶子清单:汇总定额的计算程序的费用类别
-                    treeNode.calcType = treeNodeCalcType.ctGatherRations;
+                    treeNode.calcType = treeNodeCalcType.ctGatherRationsFees;
             }
             else{                                          // 公式计算
                 treeNode.calcType = treeNodeCalcType.ctCalcBaseValue;
             };
         }
         else if (isBill)                                 // 父清单:汇总子清单的费用类别
-            treeNode.calcType = treeNodeCalcType.ctGatherBills;
+            treeNode.calcType = treeNodeCalcType.ctGatherBillsFees;
 
         me.InnerCalc(treeNode);
 
@@ -792,6 +893,7 @@ class CalcProgram {
     // 重新计算叶子清单下的所有子结点:如定额、工料机定额等(calculate算法基于定额、工料机定额的计算结果是正确的,实际上有时它们的计算结果并不是最新的)
     calcLeafBillChildren(treeNode){
         let me = this;
+        if(!me.isLeafBill(treeNode)) return;
         if (treeNode.children && treeNode.children.length > 0) {
             let needSaveNodes = [];
             for (let child of treeNode.children){

+ 44 - 5
web/building_saas/main/js/models/main_consts.js

@@ -17,6 +17,37 @@ const ModuleNames = {
     calc_program: 'calc_program'
 };
 
+const gljType = {
+    // 人工
+    LABOUR: 1,
+    // ==============材料类型=================
+    // 普通材料
+    GENERAL_MATERIAL: 201,
+    // 混凝土
+    CONCRETE: 202,
+    // 砂浆
+    MORTAR: 203,
+    // 配合比
+    MIX_RATIO: 204,
+    // 商品混凝土
+    COMMERCIAL_CONCRETE: 205,
+    // 商品砂浆
+    COMMERCIAL_MORTAR: 206,
+    // ==============材料类型=================
+    // ==============机械类型=================
+    // 普通机械
+    GENERAL_MACHINE: 301,
+    // 机械组成物
+    MACHINE_COMPOSITION: 302,
+    // 机上人工
+    MACHINE_LABOUR: 303,
+    // ==============机械类型=================
+    // 主材
+    MAIN_MATERIAL: 4,
+    // 设备
+    EQUIPMENT: 5
+};
+
 const feeRate_consts={
     decimal:3
 };
@@ -38,9 +69,9 @@ const CP_Col_Width = {          // 多处计算程序界面的列宽统一设置
 
 const treeNodeCalcType = {
     ctRationCalcProgram: 1,
-    ctBillCalcProgram: 2,
-    ctGatherRations: 3,
-    ctGatherBills: 4,
+    ctBillCalcProgram: 2,       // 汇总清单下所有定额的工料机
+    ctGatherRationsFees: 3,     // 汇总定额的各个费
+    ctGatherBillsFees: 4,       // 汇总清单的各个费
     ctCalcBaseValue: 5
 };
 
@@ -77,11 +108,19 @@ const volumePriceMaps = {
     201: "量材",
     301: "量机",
     4: "量主",
-    5: "量设",
+    5: "量设"
 };
 
 const rationType = {
     ration: 1,
     volumePrice: 2,
     gljRation: 3
-};
+};
+
+const leafBillGetFeeType = {
+    rationContent: 0,
+    rationPrice: 1,
+    rationPriceConverse: 2,
+    billsPrice: 3
+};
+

+ 2 - 2
web/building_saas/main/js/views/main_tree_col.js

@@ -37,7 +37,7 @@ let MainTreeCol = {
         calcProgramName: function (node) {
             if (
                 node.sourceType === projectObj.project.Ration.getSourceType() ||
-                (node.sourceType === projectObj.project.Bills.getSourceType() && node.source.children && node.source.children.length === 0 && projectObj.project.projSetting.billsCalcMode === billsPrice)
+                (projectObj.project.calcProgram.isLeafBill(node) && projectObj.project.projSetting.billsCalcMode === leafBillGetFeeType.billsPrice)
             ) return false
             else return true;
         },
@@ -100,7 +100,7 @@ let MainTreeCol = {
         calcProgramName: function (node) {
             if (
                 node.sourceType === projectObj.project.Ration.getSourceType() ||
-                (node.sourceType === projectObj.project.Bills.getSourceType() && node.source.children && node.source.children.length === 0 && projectObj.project.projSetting.billsCalcMode === billsPrice)
+                (projectObj.project.calcProgram.isLeafBill(node) && projectObj.project.projSetting.billsCalcMode === leafBillGetFeeType.billsPrice)
             ) {
                 var names = new GC.Spread.Sheets.CellTypes.ComboBox();
                 names.items(projectObj.project.calcProgram.compiledTemplateNames);

+ 68 - 1
web/building_saas/main/js/views/project_property_basicInfo.js

@@ -39,9 +39,19 @@ let basicInfoView = {
         }
     },
 
+    setDatePicker: function (sheet, dateRows) {
+        let me = this;
+        this.renderSheetFuc(sheet, function () {
+            for(let i = 0, len = dateRows.length; i < len; i++){
+                sheet.getCell(dateRows[i], 1).cellType(me.getDatePickerCellType()).width(100).formatter('yyyy-mm-dd');
+            }
+        });
+    },
+
     buildHeader: function (sheet, headers) {
         let me = basicInfoView;
         let fuc = function () {
+            sheet.options.clipBoardOptions = GC.Spread.Sheets.ClipboardPasteOptions.values;
             sheet.setColumnCount(headers.length);
             sheet.setRowHeight(0, 40, GC.Spread.Sheets.SheetArea.colHeader);
             for(let i = 0, len = headers.length; i < len; i++){
@@ -77,6 +87,7 @@ let basicInfoView = {
         let fuc = function () {
             sheet.setRowCount(datas.length);
             me.initTree(sheet, true, datas);
+            me.setDatePicker(sheet, me.setting.dateRows);
             sheet.setFormatter(-1, 1, '@');
             for(let col = 0, cLen = cols.length; col < cLen; col++){
                 sheet.getRange(-1, col, -1, 1).hAlign(GC.Spread.Sheets.HorizontalAlign[cols[col]['hAlign']]);
@@ -107,6 +118,7 @@ let basicInfoView = {
             //date
             if(me.setting.dateRows.indexOf(args.row) !== -1){
                 if(v.length > 0){
+                    v = formatDate(new Date(v), 'yyyy-MM-dd')
                     v = me.filtDate(v);
                     if(!v){
                         alert('请输入正确的日期格式yyyy-mm-dd');
@@ -130,6 +142,7 @@ let basicInfoView = {
         let me = basicInfoView;
         let items = sheetCommonObj.analyzePasteData(me.setting, args);
         let recRows = [];
+        console.log('enter');
         for(let i = 0, len = items.length; i < len; i++){
             let row = i + args.cellRange.row;
             if(me.setting.locked.rows.indexOf(row) !== -1){
@@ -137,7 +150,9 @@ let basicInfoView = {
             }
             else if(me.setting.dateRows.indexOf(row) !== -1){
                 items[i].value = me.filtDate(items[i].value);
-                if(!items[i].value){
+                console.log(items.value);
+                if(!me.isDef(items[i].value)){
+                    console.log('aa');
                     recRows.push(row);
                 }
                 else {
@@ -148,6 +163,8 @@ let basicInfoView = {
                 me.datas[row].value = items[i].value;
             }
         }
+        console.log(recRows);
+        console.log(me.datas);
         if(recRows.length > 0){
             me.renderSheetFuc(args.sheet, function () {
                 for(let i = 0, len = recRows.length; i < len; i++){
@@ -369,7 +386,57 @@ let basicInfoView = {
             }
         };
         return new TreeNodeCellType()
+    },
+
+    getDatePickerCellType: function () {
+        let ns = GC.Spread.Sheets;
+
+        function DatePickerCellType() {
+        }
+        DatePickerCellType.prototype = new GC.Spread.Sheets.CellTypes.Base();
+
+        DatePickerCellType.prototype.createEditorElement = function (context) {
+            //Create input presenter.
+            return document.createElement("input");
+        };
+        DatePickerCellType.prototype.activateEditor = function (editorContext, cellStyle, cellRect, context) {
+            //Initialize input editor.
+            if (editorContext) {
+                $editor = $(editorContext);
+                //DatePickerCellType.prototype.activateEditor.apply(this, arguments);
+                $editor.datepicker({dateFormat: 'yy-mm-dd'});
+                $editor.css("position", "absolute");
+                $editor.attr("gcUIElement", "gcEditingInput");
+                $(".ui-datepicker").attr("gcUIElement", "gcEditingInput");
+            }
+        }
+        DatePickerCellType.prototype.deactivateEditor = function (editorContext, context) {
+            //Remove input editor when end editor status.
+            if (editorContext) {
+                var element = editorContext;
+                $(element).datepicker("hide");
+                $(element).datepicker("destroy");
+            }
+           // DatePickerCellType.prototype.deactivateEditor.apply(this, arguments)
+        };
+        DatePickerCellType.prototype.setEditorValue = function (editor, value, context) {
+            //Sync value from Cell value to editor value.
+            $(editor).datepicker("setDate", value);
+        };
+        DatePickerCellType.prototype.getEditorValue = function (editor, context) {
+            //Sync value from editor value to cell value.
+            return $(editor).datepicker("getDate");
+        };
+        DatePickerCellType.prototype.updateEditor = function (editorContext, cellStyle, cellRect, context) {
+            if (editorContext) {
+                $editor = $(editorContext);
+                $editor.css("width", cellRect.width - 1);
+                $editor.css("height", cellRect.height - 3);
+            }
+        };
+        return new DatePickerCellType();
     }
+
 };
 
 $(document).ready(function () {