Bladeren bron

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

chenshilong 7 jaren geleden
bovenliggende
commit
8a17ec8eb2

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

@@ -3,7 +3,7 @@
  */
 let mongoose = require('mongoose');
 let quantity_detail = require("./quantity_detail_facade");
-let Bills_Lib = mongoose.model('std_bills_lib_list');
+let Bills_Lib = mongoose.model('std_bills_lib_bills');
 let bill_Model = require('../models/bills').model;
 let _ = require("lodash");
 module.exports={

+ 56 - 59
modules/reports/rpt_component/jpc_flow_tab.js

@@ -12,12 +12,11 @@ let JpcAreaHelper = require('./helper/jpc_helper_area');
 let PDFKit = require('pdfkit');
 
 let JpcFlowTabSrv = function(){};
-//let grpPageInfo = {"segGrpRecStartIdx": 0, "insertedGrpRecAmt": 0, "preAddPageGrpInfo": null};
 JpcFlowTabSrv.prototype.createNew = function(){
+    //grpPageInfo :{"segGrpRecStartIdx": 0, "insertedGrpRecAmt": 0, "preAddPageGrpInfo": null}; //纯属解释参数grpPageInfo结构
     function private_addPageValue(ValuedIdxLst, sortedSequence, grpSequenceInfo, startRecIdx, maxRecPerPage,page_seg_map, segIdx, pageIdx, grpPageInfo, isFollow, segAutoHeightInfo, prePageLeftAutoHeightRecAmt) {
         let vIdx = [], preAmt = 0, insertedGrpAmt = 0, grp_lines = 0, followMode = (isFollow)?JV.TYPE_FOLLOW_MODE:-1, nextPageAutoHeightRecAmt = 0;
         if (grpSequenceInfo && grpPageInfo) {
-            //grpPageInfo[JV.PROP_INSERTED_GRP_REC] = 0;
             if (grpPageInfo[JV.PROP_PRE_ADD_GRP_REC_INFO].length > 0) {
                 for (let grpLineIdx of grpPageInfo[JV.PROP_PRE_ADD_GRP_REC_INFO]) {
                     vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_GROUP, grpPageInfo[JV.PROP_SEG_GRP_IDX], grpLineIdx]);
@@ -36,9 +35,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
                 ttlValAmt = segAutoHeightInfo[segIdx][startRecIdx + vi];
             }
             if (prePageLeftAutoHeightRecAmt > 0 && vi === 0) {
-                // startIdx = ttlValAmt - prePageLeftAutoHeightRecAmt;
                 startIdx = prePageLeftAutoHeightRecAmt;
-                // autoHeightAmt += prePageLeftAutoHeightRecAmt;
             }
             for (let subValIdx = startIdx; subValIdx < ttlValAmt; subValIdx++) {
                 vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_AUTO_HEIGHT, sortedSequence[startRecIdx + vi], subValIdx, ttlValAmt]);
@@ -51,66 +48,67 @@ JpcFlowTabSrv.prototype.createNew = function(){
             }
             return couldBreak;
         }
+        let private_inner_add_grp_rec = function(vi) {
+            let hasFullGrp = true, couldBreak = false;
+            for (let i = 0; i < grp_lines; i++) {
+                if ( ((vi + insertedGrpAmt * grp_lines) + i + 1) >= (maxRecPerPage - preAmt)) {
+                    for (let j = i; j < grp_lines; j++) {
+                        grpPageInfo[JV.PROP_PRE_ADD_GRP_REC_INFO].push(j);
+                    }
+                    //准备要跳出去了
+                    hasFullGrp = false;
+                    break;
+                } else {
+                    vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_GROUP, grpPageInfo[JV.PROP_SEG_GRP_IDX], i]);
+                }
+            }
+            //3. 进位下一个group信息所在位置
+            if (hasFullGrp) {
+                grpPageInfo[JV.PROP_INSERTED_GRP_REC]++;
+                insertedGrpAmt++;
+                grpPageInfo[JV.PROP_SEG_GRP_IDX]++;
+            } else {
+                couldBreak = true;
+            }
+            return couldBreak;
+        }
+        let private_normal_add_rec = function(vi) {
+            let couldBreak = false;
+            if (segAutoHeightInfo && segAutoHeightInfo.length > 0) {
+                if (segAutoHeightInfo[segIdx].length > startRecIdx + vi) {
+                    couldBreak = private_addAutoHeightPageValue(vi);
+                    // if (couldBreak) break;
+                } else if (vIdx.length < maxRecPerPage) {
+                    vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, JV.BLANK_VALUE_INDEX]);
+                }
+            } else {
+                if (sortedSequence.length > startRecIdx + vi) {
+                    vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, sortedSequence[startRecIdx + vi]]);
+                } else {
+                    vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, JV.BLANK_VALUE_INDEX]);
+                }
+            }
+            return couldBreak;
+        }
         for (let vi = 0; (vi + insertedGrpAmt * grp_lines) < maxRecPerPage - preAmt; vi++) {
             if (grpSequenceInfo && grpPageInfo) {
                 if ((startRecIdx + vi) === grpSequenceInfo[grpPageInfo[JV.PROP_SEG_GRP_IDX]]) {
                     //表示这里要插入grouping信息啦!
-                    //1. 首先push正常的记录
-                    vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, sortedSequence[startRecIdx + vi]]);
-                    //2. 然后就要push grouping记录了
-                    let hasFullGrp = true;
-                    for (let i = 0; i < grp_lines; i++) {
-                        if ( ((vi + insertedGrpAmt * grp_lines) + i + 1) >= (maxRecPerPage - preAmt)) {
-                            for (let j = i; j < grp_lines; j++) {
-                                grpPageInfo[JV.PROP_PRE_ADD_GRP_REC_INFO].push(j);
-                            }
-                            //准备要跳出去了
-                            hasFullGrp = false;
-                            break;
-                        } else {
-                            vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_GROUP, grpPageInfo[JV.PROP_SEG_GRP_IDX], i]);
-                        }
-                    }
-                    //3. 进位下一个group信息所在位置
-                    if (hasFullGrp) {
-                        grpPageInfo[JV.PROP_INSERTED_GRP_REC]++;
-                        insertedGrpAmt++;
-                        grpPageInfo[JV.PROP_SEG_GRP_IDX]++;
-                    } else {
-                        break;
-                    }
-                } else {
+                    let couldBreak = false;
+                    //1. 首先push正常的记录(要考虑自动行高调整的分支)
                     if (segAutoHeightInfo && segAutoHeightInfo.length > 0) {
-                        if (segAutoHeightInfo[segIdx].length > startRecIdx + vi) {
-                            let couldBreak = private_addAutoHeightPageValue(vi);
-                            if (couldBreak) break;
-                        } else if (vIdx.length < maxRecPerPage) {
-                            vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, JV.BLANK_VALUE_INDEX]);
-                        }
+                        couldBreak = private_addAutoHeightPageValue(vi);
                     } else {
-                        if (sortedSequence.length > startRecIdx + vi) {
-                            vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, sortedSequence[startRecIdx + vi]]);
-                        } else {
-                            vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, JV.BLANK_VALUE_INDEX]);
-                        }
-                    }
-                }
-            } else {
-                if (segAutoHeightInfo && segAutoHeightInfo.length > 0) {
-                    if (segAutoHeightInfo[segIdx].length > startRecIdx + vi) {
-                        let couldBreak = private_addAutoHeightPageValue(vi);
-                        if (couldBreak) break;
-                    } else if (vIdx.length < maxRecPerPage) {
-                        vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, JV.BLANK_VALUE_INDEX]);
-                    }
-                } else {
-                    nextPageAutoHeightRecAmt = 0;
-                    if (sortedSequence.length > startRecIdx + vi) {
                         vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, sortedSequence[startRecIdx + vi]]);
-                    } else {
-                        vIdx.push([followMode, JV.DISPLAY_VAL_TYPE_NORMAL, JV.BLANK_VALUE_INDEX]);
                     }
+                    //2. 然后就要push grouping记录了
+                    if (private_inner_add_grp_rec(vi)) break;
+                    if (couldBreak) break;
+                } else {
+                    if (private_normal_add_rec(vi)) break;
                 }
+            } else {
+                if (private_normal_add_rec(vi)) break;
             }
         }
         page_seg_map.push([pageIdx, segIdx]);
@@ -439,7 +437,7 @@ JpcFlowTabSrv.prototype.createNew = function(){
                     }
                     me.dispValueIdxLst.splice(me.dispValueIdxLst.length - 1, 1);
                 } else if (isFollow) {
-                    prePageLeftAutoHeightRecAmt = private_addPageValue(me.dispValueIdxLst, followTabEx.segments[segIdx], null, counterRowRecEx, maxRowRec, me.page_seg_map, segIdx, pageIdx, null, true, me.auto_height_info, prePageLeftAutoHeightRecAmt);
+                    prePageLeftAutoHeightRecAmt = private_addPageValue(me.dispValueIdxLst, followTabEx.segments[segIdx], null, counterRowRecEx, maxRowRec, me.page_seg_map, segIdx, pageIdx, null, true, null, 0);
                     for (let dv of me.dispValueIdxLst[me.dispValueIdxLst.length - 1]) {
                         private_chk_handle_rec_amt(dv, true);
                     }
@@ -478,7 +476,6 @@ JpcFlowTabSrv.prototype.createNew = function(){
                         adHocAutoHeightAmt += (me.auto_height_info[segIdx][loop] - 1);
                         if (me.group_node_info && me.group_node_info[segIdx]) {
                             if (me.group_node_info[segIdx][adHocAutoHeightGrpStartIdx] === loop) {
-                                me.group_node_info[segIdx][adHocAutoHeightGrpStartIdx] = me.group_node_info[segIdx][adHocAutoHeightGrpStartIdx] + adHocAutoHeightAmt;
                                 adHocAutoHeightGrpStartIdx++;
                             }
                         }
@@ -499,13 +496,13 @@ JpcFlowTabSrv.prototype.createNew = function(){
                         for (let loop = currentRecAmt; loop < currentRecAmt + maxRowRec; loop++) {
                             if (me.auto_height_info[segIdx].length > loop) {
                                 adHocAutoHeightAmt += (me.auto_height_info[segIdx][loop] - 1);
-                                recAmtForAdHocAutoHeight++;
+                                // recAmtForAdHocAutoHeight++;
                             } else {
                                 break;
                             }
                         }
                     }
-                    if ((ttlSegRecAmtNormal < ttlSegRecAmt) || (followTabEx != null)) {
+                    if ((ttlSegRecAmtNormal < ttlSegRecAmt) || (followTabEx !== null)) {
                         //有流水拓展,并且是follow mode
                         if (currentRecAmt + adHocAutoHeightAmt + recAmtForAdHocAutoHeight + maxRowRec > ttlSegRecAmtNormal) {
                             if (currentRecAmt + adHocAutoHeightAmt + recAmtForAdHocAutoHeight >= ttlSegRecAmtNormal) {

+ 5 - 4
test/unit/reports/test_cover_01.js

@@ -5,19 +5,20 @@
 let test = require('tape');
 import JpcEx from "../../../modules/reports/rpt_component/jpc_ex";
 import JV from "../../../modules/reports/rpt_component/jpc_value_define";
+let config = require("../../../config/config.js");
+config.setupDb(process.env.NODE_ENV);
 let mongoose = require("mongoose");
 let fileUtils = require("../../../modules/common/fileUtils");
 let path = require('path');
 let dbm = require("../../../config/db/db_manager");
 let rpt_cfg = require('./rpt_cfg');
-dbm.connect();
+dbm.connect(process.env.NODE_ENV);
 
 //统一引用models
 fileUtils.getGlobbedFiles('../../../modules/all_models/*.js').forEach(function(modelPath) {
     require(path.resolve(modelPath));
 });
 
-//config.setupCache();
 let cfgCacheUtil = require("../../../config/cacheCfg");
 cfgCacheUtil.setupDftCache();
 
@@ -56,7 +57,7 @@ test('测试 - 打开模板: 封-1 ', function (t) {
         rptTplDataFacade.prepareProjectData(userId_Dft, demoPrjId, filter, function (err, msg, rawDataObj) {
             if (!err) {
                 try {
-                    // fsUtil.writeObjToFile(rawDataObj, "D:/GitHome/ConstructionCost/tmp/rptTplRawDataObject.js");
+                    // fsUtil.writeObjToFile(rawDataObj, "D:/GitHome/ConstructionCost/tmp/rptTplRawDataObject.jsp");
                     let tplData = rptDataUtil.assembleData(rawDataObj);
                     //build the report
                     let printCom = JpcEx.createNew();
@@ -68,7 +69,7 @@ test('测试 - 打开模板: 封-1 ', function (t) {
                     let maxPages = printCom.totalPages;
                     let pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties);
                     if (pageRst) {
-                        // fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult.js");
+                        // fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult.jsp");
                     } else {
                         console.log("oh! no pages were created!");
                     }

+ 5 - 4
test/unit/reports/test_cover_02.js

@@ -5,19 +5,20 @@
 let test = require('tape');
 import JpcEx from "../../../modules/reports/rpt_component/jpc_ex";
 import JV from "../../../modules/reports/rpt_component/jpc_value_define";
+let config = require("../../../config/config.js");
+config.setupDb(process.env.NODE_ENV);
 let mongoose = require("mongoose");
 let fileUtils = require("../../../modules/common/fileUtils");
 let path = require('path');
 let dbm = require("../../../config/db/db_manager");
 let rpt_cfg = require('./rpt_cfg');
-dbm.connect();
+dbm.connect(process.env.NODE_ENV);
 
 //统一引用models
 fileUtils.getGlobbedFiles('../../../modules/all_models/*.js').forEach(function(modelPath) {
     require(path.resolve(modelPath));
 });
 
-//config.setupCache();
 let cfgCacheUtil = require("../../../config/cacheCfg");
 cfgCacheUtil.setupDftCache();
 
@@ -56,7 +57,7 @@ test('测试 - 打开模板: 封-1 ', function (t) {
         rptTplDataFacade.prepareProjectData(userId_Dft, demoPrjId, filter, function (err, msg, rawDataObj) {
             if (!err) {
                 try {
-                    // fsUtil.writeObjToFile(rawDataObj, "D:/GitHome/ConstructionCost/tmp/rptTplRawDataObject.js");
+                    // fsUtil.writeObjToFile(rawDataObj, "D:/GitHome/ConstructionCost/tmp/rptTplRawDataObject.jsp");
                     let tplData = rptDataUtil.assembleData(rawDataObj);
                     //build the report
                     let printCom = JpcEx.createNew();
@@ -68,7 +69,7 @@ test('测试 - 打开模板: 封-1 ', function (t) {
                     let maxPages = printCom.totalPages;
                     let pageRst = printCom.outputAsSimpleJSONPageArray(rptTpl, tplData, 1, maxPages, defProperties);
                     if (pageRst) {
-                        fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult.js");
+                        fsUtil.writeObjToFile(pageRst, "D:/GitHome/ConstructionCost/tmp/testBuiltPageResult.jsp");
                     } else {
                         console.log("oh! no pages were created!");
                     }

+ 10 - 8
test/unit/reports/test_get_prj_data.js

@@ -2,20 +2,22 @@
  * Created by Tony on 2018/3/23.
  */
 let test = require('tape');
+
+let config = require("../../../config/config.js");
+config.setupDb(process.env.NODE_ENV);
 let mongoose = require("mongoose");
 let fileUtils = require("../../../modules/common/fileUtils");
 let path = require('path');
 let dbm = require("../../../config/db/db_manager");
-dbm.connect();
 let consts = require('../../../modules/main/models/project_consts');
 let projectConsts = consts.projectConst;
+dbm.connect(process.env.NODE_ENV);
 
 //统一引用models
 fileUtils.getGlobbedFiles('../../../modules/all_models/*.js').forEach(function(modelPath) {
     require(path.resolve(modelPath));
 });
 
-
 //config.setupCache();
 let cfgCacheUtil = require("../../../config/cacheCfg");
 cfgCacheUtil.setupDftCache();
@@ -33,8 +35,8 @@ demoPrjId = 1626; //QA:
 let userId_Leng = 1142; //小冷User Id
 let userId_Dft = userId_Leng;
 /*/
-let userId_Dft = 76075;
-//*/
+ let userId_Dft = 76075;
+ //*/
 
 let fs = require('fs');
 //设置Date Format函数
@@ -46,7 +48,7 @@ fs.readFile(__dirname.slice(0, __dirname.length - 18) + '/public/web/date_util.j
 test('测试 - 获取project数据: ', function (t) {
     projectDataMdl.getData(demoPrjId, function (err, message, result) {
         if (!err) {
-            fsUtil.writeObjToFile(result, "D:/GitHome/ConstructionCost/tmp/ProjectDataFullObject.js");
+            fsUtil.writeObjToFile(result, "D:/GitHome/ConstructionCost/tmp/ProjectDataFullObject.jsp");
             t.pass('pass succeeded!');
             t.end();
         } else {
@@ -75,9 +77,9 @@ test('测试 - 获取project部分数据: ', function (t) {
                     // for (let item of results) {
                     //     newData.push(JSON.stringify(item));
                     // }
-                    // fsUtil.writeArrayToFile(newData, "D:/GitHome/ConstructionCost/tmp/getProjectData_partial.js");
-                    // fsUtil.writeObjToFile(prjObj, "D:/GitHome/ConstructionCost/tmp/getProjectObjectNew.js");
-                    fsUtil.writeObjToFile(results, "D:/GitHome/ConstructionCost/tmp/getProjectData_partialNew.js");
+                    // fsUtil.writeArrayToFile(newData, "D:/GitHome/ConstructionCost/tmp/getProjectData_partial.jsp");
+                    // fsUtil.writeObjToFile(prjObj, "D:/GitHome/ConstructionCost/tmp/getProjectObjectNew.jsp");
+                    fsUtil.writeObjToFile(results, "D:/GitHome/ConstructionCost/tmp/getProjectData_partialNew.jsp");
                     t.pass('pass succeeded!');
                     t.end();
                 } else {

+ 3 - 2
test/unit/reports/test_tpl_09.js

@@ -5,19 +5,20 @@
 let test = require('tape');
 import JpcEx from "../../../modules/reports/rpt_component/jpc_ex";
 import JV from "../../../modules/reports/rpt_component/jpc_value_define";
+let config = require("../../../config/config.js");
+config.setupDb(process.env.NODE_ENV);
 let mongoose = require("mongoose");
 let fileUtils = require("../../../modules/common/fileUtils");
 let path = require('path');
 let dbm = require("../../../config/db/db_manager");
 let rpt_cfg = require('./rpt_cfg');
-dbm.connect();
+dbm.connect(process.env.NODE_ENV);
 
 //统一引用models
 fileUtils.getGlobbedFiles('../../../modules/all_models/*.js').forEach(function(modelPath) {
     require(path.resolve(modelPath));
 });
 
-//config.setupCache();
 let cfgCacheUtil = require("../../../config/cacheCfg");
 cfgCacheUtil.setupDftCache();
 

+ 5 - 3
test/unit/reports/test_tpl_09_1.js

@@ -4,12 +4,14 @@
 let test = require('tape');
 import JpcEx from "../../../modules/reports/rpt_component/jpc_ex";
 import JV from "../../../modules/reports/rpt_component/jpc_value_define";
+let config = require("../../../config/config.js");
+config.setupDb(process.env.NODE_ENV);
 let mongoose = require("mongoose");
 let fileUtils = require("../../../modules/common/fileUtils");
 let path = require('path');
 let dbm = require("../../../config/db/db_manager");
 let rpt_cfg = require('./rpt_cfg');
-dbm.connect();
+dbm.connect(process.env.NODE_ENV);
 
 //统一引用models
 fileUtils.getGlobbedFiles('../../../modules/all_models/*.js').forEach(function(modelPath) {
@@ -56,7 +58,7 @@ test('测试 - 测试模板啦: ', function (t) {
         rptTplDataFacade.prepareProjectData(userId_Dft, demoPrjId, filter, function (err, msg, rawDataObj) {
             if (!err) {
                 try {
-                    // fsUtil.writeObjToFile(rawDataObj, "D:/GitHome/ConstructionCost/tmp/rptTplRawDataObject.js");
+                    // fsUtil.writeObjToFile(rawDataObj, "D:/GitHome/ConstructionCost/tmp/rptTplRawDataObject.jsp");
                     let tplData = rptDataUtil.assembleData(rawDataObj);
                     //it's time to build the report!!!
                     let printCom = JpcEx.createNew();
@@ -116,7 +118,7 @@ test('测试 - 显示保存小数位数问题: ', function (t) {
     rpt_decimal_mdl.find({}).then(function (rst) {
         //console.log(rst);
         if (rst.length > 0) {
-            fsUtil.writeObjToFile(rst, "D:/GitHome/ConstructionCost/tmp/testDecimalResult.js");
+            fsUtil.writeObjToFile(rst, "D:/GitHome/ConstructionCost/tmp/testDecimalResult.jsp");
         }
         t.pass('pass get decimal ok!');
         t.end();

+ 1 - 1
web/building_saas/css/main.css

@@ -104,7 +104,7 @@ body {
     margin-left: 29px;
     background: #fff
 }
-.toolsbar,.toolsbar-f {
+.toolsbar,.toolsbar-f,.toolsbar_feeRate {
     border-bottom: 1px solid #ccc
 }
 .tools-btn {

+ 21 - 13
web/building_saas/fee_rates/fee_rate.html

@@ -1,27 +1,35 @@
 
 
 <div >
-<div class="toolsbar px-1">
+<div class="toolsbar_feeRate px-1 ">
     <div class="form-inline py-1">
         <label class="mx-2" >当前使用:<span id="feeRateFileName">费率1</span>(<a href="#" id="pop-lv"><span id="projectCount">3</span> 单位工程使用</a>)
             <a class="btn btn-sm ml-1" href="#" data-toggle="modal" data-target="#change-lv" id="changFeeRateFile"><i class="fa fa-exchange"></i> 选择其他</a>
             <a class="btn btn-sm ml-1" href="#" data-toggle="modal" id="saveAs" data-target="#copy-lv"><i class="fa fa-files-o"></i> 另存单独用</a></label>
     </div>
 </div>
-<div class="container-fluid">
-        <div class="row">
-            <div class="main-content col-lg-8 p-0">
-                <div class="form-inline py-1">
-                    <label class="mx-2" >基于&nbsp;&nbsp;<span id="feeRateLibName">重庆渝建发[2016]35号</span></label>
-                    <a class="btn btn-sm ml-1" href="#" data-toggle="modal" data-target="#set-lv" id="setNewFeeRate"><i class="fa fa-cog"></i> 重选标准</a>
-                </div>
-                <div class=" grid  main-data-full-fl" id="divFee"></div>
-            </div>
-            <div class="col-lg-4 py-1">
-                <div class="py-1"><input type="checkbox" id="cascadeSet" checked >统一设置相同参数</div>
-                <div class="grid  main-data-full-fl" id="subRate"></div>
+<div class="toolsbar_feeRate px-1">
+    <div class="row" style="margin-left: 0px">
+        <div class="col-lg-8 p-0">
+            <div class="form-inline py-1">
+                <label class="mx-2" >基于&nbsp;&nbsp;<span id="feeRateLibName">重庆渝建发[2016]35号</span></label>
+                <a class="btn btn-sm ml-1" href="#" data-toggle="modal" data-target="#set-lv" id="setNewFeeRate"><i class="fa fa-cog"></i> 重选标准</a>
             </div>
         </div>
+        <div class="col-lg-4 p-0">
+            <div class="form-inline py-1" style="margin-top: 5px"><input type="checkbox" id="cascadeSet" checked >  <label class="mx-2" >统一设置相同参数</label></div>
+        </div>
+    </div>
+</div>
+<div class="container-fluid">
+    <div class="row ">
+        <div class="col-lg-8 p-0 ">
+            <div class="grid main-data-full-feeRate" id="divFee"></div>
+        </div>
+        <div class="col-lg-4 p-0">
+            <div class="grid main-data-full-feeRate" id="subRate"></div>
+        </div>
+    </div>
 </div>
 <!--弹出更换-->
 <div class="modal fade" id="change-lv" data-backdrop="static">

+ 6 - 2
web/building_saas/js/global.js

@@ -3,14 +3,18 @@ function autoFlashHeight(){
     var headerHeight = $(".header").height();
     var toolsbarHeight = $(".toolsbar").height();
     var ftoolsbarHeight = $(".toolsbar-f").height();
+   // var feeRateToolsbarHeight = $(".toolsbar_feeRate").height();
     var bottomContentHeight = $(".bottom-content").height();
     var toolsBarHeightQ = $(".tools-bar-height-q").height();
     var toolsBarHeightD = $(".tools-bar-height-d").height();
     $(".main-data-side-q").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightQ-302);
     $(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-302);
-    $(".main-data-top").height($(window).height()-headerHeight-toolsbarHeight-bottomContentHeight-1);
+    //$("#main .main-data-top").height($(window).height()-headerHeight-toolsbarHeight-bottomContentHeight-1);
+    $("#billsSpread").height($(window).height()-headerHeight-toolsbarHeight-bottomContentHeight-1);
+    $("#project_glj_sheet").height($(window).height()-headerHeight-toolsbarHeight-bottomContentHeight-1);
     $(".main-data-full").height($(window).height()-headerHeight-toolsbarHeight-1);
     $(".main-data-full-fl").height($(window).height()-headerHeight-toolsbarHeight-37);
+    $(".main-data-full-feeRate").height($(window).height()-headerHeight-78);
     $(".main-data-not").height($(window).height()-headerHeight-1);
     $(".main-data-side-search").height($(window).height()-headerHeight-toolsbarHeight-64);
     $(".side-content").height($(window).height()-headerHeight );
@@ -19,9 +23,9 @@ function autoFlashHeight(){
     $(".form-list").height($(window).height()-headerHeight-50 );
 
 };
-$(window).resize(autoFlashHeight);
 /*全局自适应高度结束*/
 $(function () {
+    $(window).resize(autoFlashHeight);
     /*侧滑*/
   /*  $(".open-sidebar").click(function () {
         $(".slide-sidebar").animate({width: "800"}).addClass("open");

+ 17 - 7
web/building_saas/main/js/main.js

@@ -21,7 +21,10 @@ $(function () {
         $(e.relatedTarget.hash).removeClass('active');
         $("#subItems").addClass('active');
         $(gljOprObj.activeTab).addClass('active');
-        // do something
+        loadSize("main", function() {
+            projectObj.refreshMainSpread();
+            refreshSubSpread();
+        });
     });
 
     slideResize($("#main"), function() {
@@ -115,16 +118,23 @@ function loadSize(tag, callback) {
     if (tag === '') {
         return;
     }
+    let o_topHeight = $("#"+ tag +" .main-data-top").height();
+    let o_bottomHeight = $("#"+ tag +" .main-data-bottom").height();
     let topHeight = getLocalCache('topHeight:' + tag);
     let bottomHeight = getLocalCache('bottomHeight:' + tag);
     if (topHeight === null || bottomHeight === null) {
-        return;
+        $("#"+ tag +" .main-data-top").height(o_topHeight);
+        $("#"+ tag +" .main-data-bottom").height(o_bottomHeight);
+    }else {
+        const navHeight = $("#"+ tag +" .bottom-content").children('ul.nav').height() + 4;
+        topHeight = parseFloat(topHeight);
+        bottomHeight = parseFloat(bottomHeight);
+        console.log(topHeight);
+        console.log(bottomHeight);
+        $("#"+ tag +" .main-data-top").height(topHeight);
+        $("#"+ tag +" .main-data-bottom").height(bottomHeight - navHeight);
     }
-    const navHeight = $("#"+ tag +" .bottom-content").children('ul.nav').height() + 4;
-    topHeight = parseFloat(topHeight);
-    bottomHeight = parseFloat(bottomHeight);
-    $("#"+ tag +" .main-data-top").height(topHeight);
-    $("#"+ tag +" .main-data-bottom").height(bottomHeight - navHeight);
+
     // $("#"+ tag +" .bottom-content").height(bottomHeight);
     callback();
 }

+ 34 - 22
web/building_saas/main/js/models/fee_rate.js

@@ -144,11 +144,12 @@ var FeeRate = {
             var errCallBack=function () {
                 me.dataRecovery();
                 $.bootstrapLoading.end();
-            }
+            };
+            $.bootstrapLoading.start();
             CommonAjax.post('/feeRates/updateRates', data, function (result) {
                 _.forEach(items,function (t) {
-                     feeRateObject.mainViews.data.updateItem(t.rateIndex,t.rate);
-                 })
+                    feeRateObject.mainFeeRateSheet.setValue(t.rateIndex, 1, t.rate.rate);
+                 });
                  me.onFeeRateFileChange();
                 $.bootstrapLoading.end();
             },errCallBack);
@@ -370,10 +371,7 @@ var FeeRate = {
                         if(data.hasOwnProperty('feeRate')){
                             rate.rate=fee_value;
                             me.onFeeRateChange(rate.ID,fee_value);
-                        }/*else {
-                            bill.feeRate=value;
-                            projectObj.mainController.refreshTreeNode([node])
-                        }*/
+                        }
                     });
                 }else {
                     projectObj.mainController.refreshTreeNode([node]);
@@ -385,7 +383,7 @@ var FeeRate = {
             var value= number_util.checkNumberValue(value,getDecimal("feeRate"));
             if(value){
                 if(editInfo.calcItem.feeRateID){
-                    var rate = projectObj.project.FeeRate.getFeeRateByID(editInfo.calcItem.feeRateID);
+                    var rate = this.getFeeRateByID(editInfo.calcItem.feeRateID);
                     if(rate!=undefined){
                         this.updateFeeRateByCalc(rate,value);
                         return;
@@ -407,20 +405,34 @@ var FeeRate = {
         };
         FeeRate.prototype.updateFeeRateByCalc=function (rate,value) {
             var me=this;
-            var data={
-                query:{
-                    'ID':this.getActivateFeeRateID(),
-                    'rates.ID':rate.ID
-                },
-                doc:{
-                    'rates.$.rate':value
-                }
-            }
-            CommonAjax.post('/feeRates/updateFeeRate', data, function (data) {
-                rate.rate=value;
+            me.updateFeeRateByID(rate.ID,{'rate':value},function () {
                 me.onFeeRateChange(rate.ID,value);
-            });
-        }
+            })
+        };
+
+        FeeRate.prototype.updateFeeRateByID = function (rateID,doc,callback) {
+          let me = this,preKey = 'rates.$.';
+          let data = {
+              query:{
+                  'ID':me.getActivateFeeRateID(),
+                  'rates.ID':rateID
+              },
+              doc:{}
+          };
+          for(let prop in doc){//做了个转换,加上前缀
+            data.doc[preKey+prop] = doc[prop];
+          }
+          CommonAjax.post('/feeRates/updateFeeRate', data, function (data) {
+              //更新缓存
+              let rate = me.getFeeRateByID(rateID);
+              for(let dkey in doc){
+                  rate[dkey] = doc[dkey];
+              }
+            if(callback){
+                callback();
+            }
+          });
+        };
 
         FeeRate.prototype.getfbUpdateData=function (rate,bill,value,editText) {
             var data=null;
@@ -486,7 +498,7 @@ var FeeRate = {
                             feeRateID:rate.ID
                         }
                     }
-                }
+                };
             this.setFeeRateToBill(data,callback);
         };
 

+ 2 - 2
web/building_saas/main/js/models/installation_fee.js

@@ -633,7 +633,7 @@ var installation_fee = {
                     'JXFTZ':{
                         rationID:data.ID,
                         billsItemID:data.billsItemID,
-                        shortName:project.projectGLJ.getShortNameByID(gljType.MACHINE_COMPOSITION),
+                        shortName:project.projectGLJ.getShortNameByID(gljType.GENERAL_MACHINE),
                         GLJID:-1,
                         projectID:data.projectID,
                         code:'JXFTZ',
@@ -641,7 +641,7 @@ var installation_fee = {
                         name:'机械费调整',
                         specs:'',
                         unit:'元',
-                        type:gljType.MACHINE_COMPOSITION,
+                        type:gljType.GENERAL_MACHINE,
                         basePrice:1,
                         adjCoe:null,
                         from:'std',

+ 0 - 1
web/building_saas/main/js/models/project.js

@@ -321,7 +321,6 @@ var PROJECT = {
         project.prototype.projectMarkChecking = function () {
             let  changeMark = projectInfoObj.projectInfo.changeMark;
             if(changeMark&&changeMark!=''){
-                $.bootstrapLoading.start();
                 this.Bills.getEngineeringCostNode(projectObj.mainController).changed = true;
                 this.calcProgram.calcAllNodesAndSave();
                 CommonAjax.post("/project/removeProjectMark",{projectID:this.ID()},function (data) {

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

@@ -323,6 +323,8 @@ ProjectGLJ.prototype.getRatioData=function(id,callback){
             if(callback){
                 callback(ratios);
             }
+        },function () {//取不到组成物的情况
+            callback([]);
         })
     }else {
         if(callback){

+ 107 - 33
web/building_saas/main/js/views/fee_rate_view.js

@@ -5,6 +5,19 @@
 
 
 var feeRateObject={
+    mainFeeRateSpread:null,
+    mainFeeRateSheet:null,
+    mainFeeRateData:null,
+    mainFeeRateSetting:{
+        header: [
+            {headerName: "专业名称", headerWidth: 550, dataCode: "name", dataType: "String"},
+            {headerName: "值%", headerWidth: 250, dataCode: "rate", dataType: "Number",hAlign: "right",decimalField:"feeRate"},
+            {headerName: "备注", dataCode: "memo", dataType: "String"}
+        ],
+        view: {
+            lockColumns: [0]
+        }
+    },
     mainViews:null,
     datas:null,
     datasBackup:null,
@@ -19,7 +32,7 @@ var feeRateObject={
     sheetSetting: {
         header: [
             {headerName: "专业名称", headerWidth: 200, dataCode: "name", dataType: "String"},
-            {headerName: "值%", headerWidth: 150, dataCode: "rate", dataType: "Number",hAlign: "right",decimalField:"feeRate"},
+            {headerName: "值%", headerWidth: 120, dataCode: "rate", dataType: "Number",hAlign: "right",decimalField:"feeRate"},
             {headerName: "备注", dataCode: "memo", dataType: "String"}
         ],
         view: {
@@ -124,10 +137,7 @@ var feeRateObject={
         feeRateObject.feeRateSheet.bind(GC.Spread.Sheets.Events.CellClick,feeRateObject.onCellClick);
         feeRateObject.feeRateSheet.bind(GC.Spread.Sheets.Events.CellDoubleClick,feeRateObject.onCellDoubleClick);
     },
-    showSelectTree:function () {
-        var sheet= feeRateObject.feeRateSheet;
-        var setting=feeRateObject.sheetSetting;
-        var data = projectObj.project.FeeRate.getActivateFeeRate().rates;
+    showSelectTree:function (sheet,setting,data) {
         var ch = GC.Spread.Sheets.SheetArea.viewport;
         var groups=[];
         sheet.suspendPaint();
@@ -370,38 +380,100 @@ var feeRateObject={
         this.mainViews.invalidate();
         document.querySelector('#divFee').focus();
     },
+    initFeeRateSpread:function (rowCount) {
+        //初始化费用项表格
+        this.mainFeeRateSpread = sheetCommonObj.buildSheet($('#divFee')[0], this.mainFeeRateSetting,rowCount);
+        this.mainFeeRateSpread.options.scrollbarMaxAlign = true;
+        this.mainFeeRateSheet = this.mainFeeRateSpread.getSheet(0);
+        sheetCommonObj.lockCells(this.mainFeeRateSheet , this.mainFeeRateSetting);
+        this.mainFeeRateSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onMainFeeRateSheetValueChange);
+        this.mainFeeRateSheet.bind(GC.Spread.Sheets.Events.SelectionChanged, this.onMainFeeRateSelectChanged);
+        this.mainFeeRateSheet.bind(GC.Spread.Sheets.Events.EditStarting, function (e,args) {
+            let me =feeRateObject, row = args.row;
+            let recode = me.mainFeeRateData[row];
+            let dataCode = me.mainFeeRateSetting.header[args.col].dataCode;
+            if(dataCode=="rate"&&me.getChildrenCount(recode.ID,me.mainFeeRateData)>0){//有子节点时不能编辑费率列
+                args.cancel = true;
+            }
+        });
+        this.mainFeeRateSheet.name('mainFeeRateSheet');
+    },
+    showMainFeeRateData:function () {
+        let me = this;
+        me.activateFeeRate = projectObj.project.FeeRate.getActivateFeeRate();
+        me.mainFeeRateData = projectObj.project.FeeRate.getActivateFeeRate().rates;
+        me.mainFeeRateSheet.setRowCount(0);
+        me.mainFeeRateSheet.setRowCount(me.mainFeeRateData.length);
+        me.showSelectTree(me.mainFeeRateSheet,me.mainFeeRateSetting,me.mainFeeRateData);
+    },
     reFreshRateViews:function() {
-        feeRateObject.createSpreadView();
+        //feeRateObject.createSpreadView();
+        feeRateObject.loadPageContent();
+        this.showMainFeeRateData();
+        if(subRateObject.subRateSpread){//如果子费率没有初始化过的话,不需要显示。
+            subRateObject.initSubRateSpread(this.mainFeeRateData[0]);
+        }
+    },
+    onMainFeeRateSheetValueChange:function (e,info) {
+        let me = feeRateObject,updateData = {},feeRate = projectObj.project.FeeRate;
+        let recode = me.mainFeeRateData[info.row];
+        let fieldID = me.mainFeeRateSetting.header[info.col].dataCode;
+        let value = info.newValue;
+        if(fieldID == 'rate'&&value != null){
+            if(number_util.isNumber(parseFloat(value))){
+                value = scMathUtil.roundForObj(value,getDecimal("feeRate"));
+            }else {
+                alert('当前输入的数据类型不正确,请重新输入。');
+                me.mainFeeRateSheet.setValue(info.row, info.col, info.oldValue);
+                return;
+            }
+        }
+        if(recode[fieldID] == value){//没有改变
+            return;
+        }
+        updateData[fieldID] = value;
+        $.bootstrapLoading.start();
+         feeRate.updateFeeRateByID(recode.ID,updateData,function () {
+            if(fieldID == 'rate'){
+                feeRate.onFeeRateChange(recode.ID,value);
+            }
+            $.bootstrapLoading.end();
+        })
+    },
+
+    onMainFeeRateSelectChanged:function (e, info) {
+        let me = feeRateObject;
+        let row = info.newSelections[0].row;
+        if(row!=-1){
+            subRateObject.initSubRateSpread(me.mainFeeRateData[row]);
+        }
     },
     updateBySelect:function (rate,selectMap,mapID) {
-       var selected = this.mainViews.getSelections()[0];
+        let selected = this.mainFeeRateSheet.getSelections()[0];
         projectObj.project.FeeRate.backupDatas();
-       var item = this.datas[selected.sourceRow];
+        let item = this.mainFeeRateData[selected.row];
         item.rate = rate;
-        _.forEach(selectMap,function (value,key) {
-            var recode =  item.subFeeRate.recodes[key];
-            var optionList = recode.optionList;
-            _.forEach(optionList,function (o) {
-                if(o.value==value){
+        for(let key in selectMap){
+            let recode =  item.subFeeRate.recodes[key];
+            let optionList = recode.optionList;
+            for(let o of optionList){
+                if(o.value==selectMap[key]){
                     o.selected=true;
                 }else {
                     o.selected = false;
                 }
-            })
-        })
+            }
+        }
         if($('#cascadeSet').prop('checked')){
-            this.cascadeSetRates(item,selected.sourceRow,mapID,selectMap)
+            this.cascadeSetRates(item,selected.row,mapID,selectMap);
         }else {
-            this.mainViews.data.updateItem(selected.sourceRow,item);
+            projectObj.project.FeeRate.batchUpdateFeeRate([{rateIndex:selected.row,rate:item}],feeRateObject.activateFeeRate);
         }
-        //projectObj.project.FeeRate.synchronizeFeeRate();
-
-        //this.views.data.updateItem()
     },
     cascadeSetRates:function(selectedItem,sourceRow,mapID,selectMap){
         var items=[];
         items.push({rateIndex:sourceRow,rate:selectedItem});
-        _.forEach(this.datas,function (recode,Index) {
+        _.forEach(this.mainFeeRateData,function (recode,Index) {
             if(Index!=sourceRow&&recode.subFeeRate){
                 var valueMaps = recode.subFeeRate.valueMaps;
                 var valueMap = _.find(valueMaps,{ID:mapID});
@@ -415,7 +487,7 @@ var feeRateObject={
                             var optionList = tempRecode.optionList;
                             _.forEach(optionList,function (o) {
                                 if(o.value==value){
-                                    o.selected=true;
+                                    o.selected = true;
                                 }else {
                                     o.selected = false;
                                 }
@@ -493,10 +565,8 @@ var feeRateObject={
     changeFeeRateStandard:function(newVal){
         $.bootstrapLoading.start();
         var callback=function () {
-            feeRateObject.createSpreadView();
-            feeRateObject.loadPageContent();
-            projectObj.project.FeeRate.synchronizeFeeRate();
-            subRateObject.destorySpreadView();
+            feeRateObject.reFreshRateViews();
+            projectObj.project.FeeRate.onFeeRateFileChange();
             $.bootstrapLoading.end();
         };
         projectObj.project.FeeRate.changeFeeRateStandard(newVal,callback);
@@ -595,8 +665,8 @@ var feeRateObject={
             name:name
         }
         var callback=function () {
-            feeRateObject.createSpreadView();
-            feeRateObject.loadPageContent();
+            //feeRateObject.createSpreadView();
+            feeRateObject.reFreshRateViews();
             projectObj.project.FeeRate.onFeeRateFileChange();
             $.bootstrapLoading.end();
         }
@@ -621,8 +691,7 @@ var feeRateObject={
     changeFeeRateFileConfirm:function(feeRateFileID,name){
         $.bootstrapLoading.start();
         var callback=function () {
-            feeRateObject.createSpreadView();
-            feeRateObject.loadPageContent();
+            feeRateObject.reFreshRateViews();
             projectObj.project.FeeRate.onFeeRateFileChange();
             $.bootstrapLoading.end();
         }
@@ -670,6 +739,7 @@ var feeRateObject={
         var data={'projectID': projectObj.project.ID(),'templatesID': calInfo.template.ID,'calcItem': calInfo.calcItem};
         $.bootstrapLoading.start();
         calcProgramManage.saveCalcItem(data,function (result) {
+            $.bootstrapLoading.end();
             calInfo.calcItem.feeRate=rate.rate;
             projectObj.project.calcProgram.compileAllTemps();
             projectObj.project.calcProgram.calcAllNodesAndSave();
@@ -716,9 +786,13 @@ $(function(){
     );
 
     $('#tab_fee_rate').on('shown.bs.tab', function (e) {
+        let me = feeRateObject;
         $(e.relatedTarget.hash).removeClass('active');
-        feeRateObject.reFreshRateViews();
-        feeRateObject.loadPageContent();
+        if(me.mainFeeRateSpread == null){
+            me.initFeeRateSpread(0);
+        }
+        me.showMainFeeRateData();
+        me.loadPageContent();
     });
 
     $('#setNewFeeRate').bind('click', function () {
@@ -845,7 +919,7 @@ $(function(){
             feeRateObject.createSheet();
         }
         feeRateObject.feeRateSelection=null;
-        feeRateObject.showSelectTree();
+        feeRateObject.showSelectTree(feeRateObject.feeRateSheet,feeRateObject.sheetSetting,projectObj.project.FeeRate.getActivateFeeRate().rates);
     });
 
     $('#fee_rate_tree').on('hidden.bs.modal', function (e) {

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

@@ -19,7 +19,7 @@ let installationFeeObj={
             {headerName: "记取位置", headerWidth: 200, dataCode: "position", hAlign: "left", dataType: "String",cellType:'selectButton',getText:'forPosition'}
         ],
         view: {
-            lockColumns: [0,1,3,4,5,6,7,8,9]
+            lockColumns: [0,1,3,4,5,6,7,8,9,10]
         },
         getText:{
             forPosition:function (item,val) {//记取位置转换
@@ -383,7 +383,7 @@ let installationFeeObj={
         sheetCommonObj.showData(this.modifyFeeRuleSheet, this.modifyFeeRuleSetting, this.modifyFeeRuleData);
         this.modifyFeeRuleSheet.setRowCount(this.modifyFeeRuleData.length);
         let positionCol = _.findIndex(this.modifyFeeRuleSetting.header,{ 'dataCode': "position"});
-        this.modifyFeeRuleSheet.getRange(-1,positionCol, -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(ration_install.feeType=='子目费用'||ration_install.unifiedSetting==1);//设置选取位置列只读
+        this.modifyFeeRuleSheet.getRange(-1,positionCol, -1, 1, GC.Spread.Sheets.SheetArea.viewport).locked(ration_install.feeType=='子目费用');//设置选取位置列只读
     },
     showRationInstallationData:function (node) {
         var installationList = [];

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

@@ -600,7 +600,6 @@ var projectObj = {
                 that.project.projectMarkChecking();//是否需要重新进行造价计算
                 installationFeeObj.engineeringTypeChecking();//检查是否安装工程
                 //初始需要触发一次点击表格事件,sheet.getAutoFitWidth值(获取单元格文本长度)才正确
-
             }
             else {
 

+ 74 - 1
web/building_saas/main/js/views/sub_fee_rate_views.js

@@ -7,6 +7,23 @@ var subRateObject={
     datas:null,
     valueMap:null,
     canEdit:true,
+    subRateSpread:null,
+    subRateSheet:null,
+    subRateSetting:{
+        header: [
+            {headerName: "参数名称", headerWidth: 250, dataCode: "name", dataType: "String"},
+            {headerName: "参数值", headerWidth: 200, dataCode: "optionValue", dataType: "String",getText:'forOption'}
+        ],
+        view: {
+            lockColumns: [0]
+        },
+        getText:{
+            forOption:function (item,val) {
+                let o = _.find(item.optionList,{'selected':true});
+                return o?o.value:'';
+            }
+        }
+    },
     columns: [
         {
             id: 'name',
@@ -59,11 +76,48 @@ var subRateObject={
         this.addComboboxOption(this.datas);
 
     },
-       reFreshRateViews:function(sender,args) {
+    reFreshRateViews:function(sender,args) {
         subRateObject.datas = projectObj.project.FeeRate.getSubViewData(args.item);
         subRateObject.valueMap=projectObj.project.FeeRate.getValueMap(args.item);
         subRateObject.createSpreadView();
     },
+    initSubRateSpread:function (item) {
+        if(this.subRateSpread == null){
+            this.subRateSpread = SheetDataHelper.createNewSpread($("#subRate")[0]);
+            this.subRateSheet = this.subRateSpread.getSheet(0);
+            sheetCommonObj.initSheet(this.subRateSheet, this.subRateSetting, 30);
+            this.subRateSheet.bind(GC.Spread.Sheets.Events.SelectionChanged, this.onSubRateSelectChanged);
+            this.subRateSheet.bind(GC.Spread.Sheets.Events.ValueChanged, this.onSubRateValueChange);
+            //this.subRateSheet.bind(GC.Spread.Sheets.Events.ValueChanged, me.onSheetValueChange);
+            this.subRateSheet.name('subRateSheet');
+        }
+        subRateObject.datas = projectObj.project.FeeRate.getSubViewData(item);
+        subRateObject.valueMap=projectObj.project.FeeRate.getValueMap(item);
+        console.log(subRateObject.datas);
+        console.log(subRateObject.valueMap);
+        subRateObject.showSubRateData();
+    },
+    showSubRateData:function () {
+        this.subRateSheet.setRowCount(0);
+        sheetCommonObj.showData(this.subRateSheet, this.subRateSetting, this.datas);
+        this.subRateSheet.setRowCount(this.datas.length);
+        for(let row =0; row < this.datas.length;row++){
+            this.setComboOptionCell(row,1,this.datas[row],this.subRateSheet);
+        }
+    },
+    onSubRateSelectChanged:function (e,info) {
+        info.sheet.repaint();
+    },
+    setComboOptionCell:function(row,col,subRate,sheet){
+        let options=[];
+        for(let op of subRate.optionList){
+            options.push({text:op.name,value:op.value});
+        }
+        let dynamicCombo = sheetCommonObj.getDynamicCombo();//new GC.Spread.Sheets.CellTypes.ComboBox();
+        dynamicCombo.items(options);
+        dynamicCombo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.value);
+        sheet.setCellType(row, col, dynamicCombo, GC.Spread.Sheets.SheetArea.viewport);
+    },
     addComboboxOption:function (datas) {
         //<option value ="volvo">Volvo</option> <option value ="saab">Saab</option> <option value="opel">Opel</option> <option value="audi">Audi</option>
         _.forEach(datas,function (item) {
@@ -94,6 +148,25 @@ var subRateObject={
             feeRateObject.updateBySelect(rate,selectMap,mapID);
         }
     },
+    onSubRateValueChange:function (e,info) {
+        console.info(info);
+        let me = subRateObject, selectValueList=[],selectMap={};
+        if(me.datas&&me.datas.length>0){
+            _.forEach(me.datas,function (d,key) {
+                if(info.row == key){
+                    selectMap[key]=info.newValue;
+                }else {
+                    let o = _.find(d.optionList,{'selected':true});
+                    selectMap[key]=o.value;
+                }
+                selectValueList.push(selectMap[key]);
+            })
+            var mapID =selectValueList.join('-');
+            var rate = me.valueMap[mapID];
+            feeRateObject.updateBySelect(rate,selectMap,mapID);
+        }
+    },
+
     destorySpreadView:function () {
         if(this.views){
             this.views.destroy();