Browse Source

Merge branch '1.0.0_online' of http://192.168.1.12:3000/SmartCost/ConstructionCost into 1.0.0_online

TonyKang 6 years ago
parent
commit
09258a53c5

+ 1 - 0
config/gulpConfig.js

@@ -157,6 +157,7 @@ module.exports = {
         'web/building_saas/main/js/views/sub_fee_rate_views.js',
         'web/building_saas/main/js/views/sub_fee_rate_views.js',
         'web/building_saas/main/js/views/calc_base_view.js',
         'web/building_saas/main/js/views/calc_base_view.js',
         'web/building_saas/main/js/views/project_property_labour_coe_view.js',
         'web/building_saas/main/js/views/project_property_labour_coe_view.js',
+        'web/building_saas/main/js/views/locate_view.js',
         'web/building_saas/complementary_ration_lib/js/main.js',
         'web/building_saas/complementary_ration_lib/js/main.js',
         'public/web/storageUtil.js'
         'public/web/storageUtil.js'
     ],
     ],

+ 1 - 1
modules/complementary_ration_lib/controllers/searchController.js

@@ -20,7 +20,7 @@ class SearchController extends BaseController{
 
 
     findRation(req, res){
     findRation(req, res){
         let data = JSON.parse(req.body.data);
         let data = JSON.parse(req.body.data);
-        searchDao.findRation(req.session.sessionUser.id, req.session.sessionCompilation._id, data.rationRepId, data.keyword, function (err, data) {
+        searchDao.findRation(req.session.sessionUser.id, req.session.sessionCompilation._id, data.rationRepId, data.keyword, data.skip, function (err, data) {
             callback(req, res, err, '', data);
             callback(req, res, err, '', data);
         });
         });
     }
     }

+ 40 - 23
modules/complementary_ration_lib/models/searchModel.js

@@ -62,7 +62,13 @@ class SearchDao{
         return ration;
         return ration;
     }
     }
 
 
-    async findRation(userId, compilationId, rationRepId, keyword, callback){
+    //@param {Object}skip({std: Number, comple: Number})
+    async findRation(userId, compilationId, rationRepId, keyword, skip, callback){
+        //每次限制结果数
+        const limit = 50;
+        //结果数
+        let resultCount = 0,
+            rst = {data: [], count: null};
         try{
         try{
             //是否需要查找补充定额
             //是否需要查找补充定额
             let findCompleRtion = rationRepId.length > 0 && rationRepId.includes(compleRationLib) ? true : false;
             let findCompleRtion = rationRepId.length > 0 && rationRepId.includes(compleRationLib) ? true : false;
@@ -78,16 +84,6 @@ class SearchDao{
                     '$or': [{'isDeleted': {"$exists":false}}, {'isDeleted': null}, {'isDeleted': false}, {deleteInfo: null}]
                     '$or': [{'isDeleted': {"$exists":false}}, {'isDeleted': null}, {'isDeleted': false}, {deleteInfo: null}]
                 }]
                 }]
             };
             };
-
-            let stdGljIds = [],
-                comGljIds = [];
-            let stdRations = rationRepId.length === 0 ? [] : await stdRationModel.find(filter);
-            for(let i = 0, len = stdRations.length; i < len; i++){
-                stdRations[i]._doc.type = 'std';
-                for(let glj of stdRations[i].rationGljList){
-                    stdGljIds.push(glj.gljId);
-                }
-            }
             let compleFilter = {
             let compleFilter = {
                 userId: userId,
                 userId: userId,
                 compilationId: compilationId,
                 compilationId: compilationId,
@@ -97,18 +93,39 @@ class SearchDao{
                     '$or': [{deleteInfo: null}, {'deleteInfo.deleted': false}]
                     '$or': [{deleteInfo: null}, {'deleteInfo.deleted': false}]
                 }]
                 }]
             };
             };
-            let compleRations = findCompleRtion ? await compleRationModel.find(compleFilter) : [];
-            for(let i = 0, len = compleRations.length; i <len; i++){
-                compleRations[i]._doc.type = 'complementary';
-                for(let glj of compleRations[i].rationGljList){
-                    if(glj.type === 'std'){
-                        stdGljIds.push(glj.gljId);
-                    }
-                    else {
-                        comGljIds.push(glj.gljId);
+            //结果数
+            if (skip && skip.std === 0 && skip.comple === 0) {
+                resultCount += rationRepId.length === 0 ? 0 : await stdRationModel.find(filter).count();
+                resultCount += findCompleRtion ? await compleRationModel.find(compleFilter).count() : 0;
+                rst.count = resultCount;
+            }
+            //搜索定额
+            let stdGljIds = [],
+                comGljIds = [];
+            let stdRations = rationRepId.length === 0 ? [] : await stdRationModel.find(filter).sort({code: 1}).skip(skip.std).limit(limit);
+            for(let i = 0, len = stdRations.length; i < len; i++){
+                stdRations[i]._doc.type = 'std';
+                for(let glj of stdRations[i].rationGljList){
+                    stdGljIds.push(glj.gljId);
+                }
+            }
+            let compleRations = [];
+            let residueLimit = limit - stdRations.length;
+            if (residueLimit > 0) {
+                compleRations = findCompleRtion ? await compleRationModel.find(compleFilter).sort({code: 1}).skip(skip.comple).limit(residueLimit) : [];
+                for(let i = 0, len = compleRations.length; i <len; i++){
+                    compleRations[i]._doc.type = 'complementary';
+                    for(let glj of compleRations[i].rationGljList){
+                        if(glj.type === 'std'){
+                            stdGljIds.push(glj.gljId);
+                        }
+                        else {
+                            comGljIds.push(glj.gljId);
+                        }
                     }
                     }
                 }
                 }
             }
             }
+
             //设置悬浮信息
             //设置悬浮信息
             stdGljIds = Array.from(new Set(stdGljIds));
             stdGljIds = Array.from(new Set(stdGljIds));
             comGljIds = Array.from(new Set(comGljIds));
             comGljIds = Array.from(new Set(comGljIds));
@@ -178,11 +195,11 @@ class SearchDao{
                 }
                 }
                 ration._doc.hint = hintsArr.join('<br>');
                 ration._doc.hint = hintsArr.join('<br>');
             }
             }
-
-
-            callback(0, stdRations.concat(compleRations));
+            rst.data = stdRations.concat(compleRations);
+            callback(0, rst);
         }
         }
         catch(err){
         catch(err){
+            console.log(err);
             callback(err, null);
             callback(err, null);
         }
         }
     }
     }

+ 4 - 19
modules/main/facade/ration_facade.js

@@ -172,7 +172,7 @@ async function getDefaultProgramID(data) {
     let searchDao = new SearchDao();
     let searchDao = new SearchDao();
     let programID;
     let programID;
     let std = await searchDao.getRationItem(data.userID,data.compilationId,[data.libID],data.code, null);
     let std = await searchDao.getRationItem(data.userID,data.compilationId,[data.libID],data.code, null);
-    if(std.feeType == undefined || std.feeType == null || std.feeType ==''){//定额取费专业为空的情况下,取项目属性中的定额取费专业ID
+    if(std == null||std ==undefined || std.feeType == undefined || std.feeType == null || std.feeType ==''){//定额取费专业为空的情况下,取项目属性中的定额取费专业ID
         programID = await getProgramForProject(data.projectID);
         programID = await getProgramForProject(data.projectID);
     }else {
     }else {
         programID = std.feeType;
         programID = std.feeType;
@@ -326,22 +326,7 @@ async function getCustomerCoe(projectID,rationID,seq,compilation){//取自定义
 
 
 //对于多单价,多组成物消耗量的编办,通过这个方法获取单价、组成物消耗量的字段,
 //对于多单价,多组成物消耗量的编办,通过这个方法获取单价、组成物消耗量的字段,
 function getExtendData(property,compilation) {
 function getExtendData(property,compilation) {
-    let ext = {};
-    let region = property.region;
-    let taxType = property.taxType;
-    if(compilation.priceProperties && compilation.priceProperties.length > 0){//如果是具有多单价的编办,取单价对应的字段
-          let priceProperty  = _.find(compilation.priceProperties,{region:region,taxModel:parseInt(taxType)});
-          if(priceProperty){
-              ext['priceField'] =  priceProperty.price.dataCode;
-          }
-    }
-    if(compilation.consumeAmtProperties && compilation.consumeAmtProperties.length > 0){
-          let  consumeAmt =   _.find(compilation.consumeAmtProperties,{region:region,taxModel:parseInt(taxType)});
-          if(consumeAmt){
-              ext['quantityField'] =  consumeAmt.consumeAmt.dataCode;
-          }
-    }
-    return _.isEmpty(ext)?null:ext;
+    return projectDao.getExtendData(property,compilation);
 }
 }
 
 
 
 
@@ -415,7 +400,7 @@ async function addRationGLJ(std,newRation,compilation) {
                 newGLJ.materialType = std_glj.materialType;
                 newGLJ.materialType = std_glj.materialType;
                 newGLJ.materialCoe = std_glj.materialCoe;
                 newGLJ.materialCoe = std_glj.materialCoe;
                 newGLJ.createType = 'normal';
                 newGLJ.createType = 'normal';
-                let info =  await  ration_glj_facade.getInfoFromProjectGLJ(newGLJ,unitPriceFileId,ext);
+                let info =  await ration_glj_facade.getInfoFromProjectGLJ(newGLJ,unitPriceFileId,ext);
                 newGLJ = ration_glj_facade.createNewRecord(info);
                 newGLJ = ration_glj_facade.createNewRecord(info);
                 newRationGLJList.push(newGLJ);
                 newRationGLJList.push(newGLJ);
                 rationGLJShowList.push(info);
                 rationGLJShowList.push(info);
@@ -532,7 +517,7 @@ function createRationAss(std) {
     if(std.hasOwnProperty('rationAssList')&&std.rationAssList.length>0){
     if(std.hasOwnProperty('rationAssList')&&std.rationAssList.length>0){
         for(let i=0;i<std.rationAssList.length;i++){
         for(let i=0;i<std.rationAssList.length;i++){
             let ass = std.rationAssList[i];
             let ass = std.rationAssList[i];
-            ass.actualValue = ass.stdValue;
+            ass._doc.actualValue = ass.stdValue;
             rationAssList.push(ass);
             rationAssList.push(ass);
         }
         }
     }
     }

+ 19 - 0
modules/pm/models/project_model.js

@@ -695,6 +695,25 @@ ProjectsDAO.prototype.getProjectProperty = async function (projectId) {
     return projectData.property;
     return projectData.property;
 };
 };
 
 
+ProjectsDAO.prototype.getExtendData = function(property,compilation) {
+    let ext = {};
+    let region = property.region;
+    let taxType = property.taxType;
+    if(compilation.priceProperties && compilation.priceProperties.length > 0){//如果是具有多单价的编办,取单价对应的字段
+        let priceProperty  = _.find(compilation.priceProperties,{region:region,taxModel:parseInt(taxType)});
+        if(priceProperty){
+            ext['priceField'] =  priceProperty.price.dataCode;
+        }
+    }
+    if(compilation.consumeAmtProperties && compilation.consumeAmtProperties.length > 0){
+        let  consumeAmt =   _.find(compilation.consumeAmtProperties,{region:region,taxModel:parseInt(taxType)});
+        if(consumeAmt){
+            ext['quantityField'] =  consumeAmt.consumeAmt.dataCode;
+        }
+    }
+    return _.isEmpty(ext)?null:ext;
+}
+
 
 
 /**
 /**
  * 获取当前用户的建设项目数据
  * 获取当前用户的建设项目数据

+ 157 - 13
web/building_saas/main/html/main.html

@@ -120,6 +120,9 @@
                   <div class="side-tabs">
                   <div class="side-tabs">
                       <ul class="nav nav-tabs" role="tablist">
                       <ul class="nav nav-tabs" role="tablist">
                           <li class="nav-item">
                           <li class="nav-item">
+                              <a class="nav-link px-3" href="javascript:void(0)" id = 'locateTab' relaPanel="#locate">查找定位</a>
+                          </li>
+                          <li class="nav-item">
                               <a class="nav-link px-3" href="javascript:void(0)" id = 'stdBillsGuidanceTab' relaPanel="#zy">清单指引</a>
                               <a class="nav-link px-3" href="javascript:void(0)" id = 'stdBillsGuidanceTab' relaPanel="#zy">清单指引</a>
                           </li>
                           </li>
                          <!-- <li class="nav-item">
                          <!-- <li class="nav-item">
@@ -312,6 +315,71 @@
                       <div class="main-side" style="display: inline-block">
                       <div class="main-side" style="display: inline-block">
                           <div class="resize" id="sideResize" style="width: 1%; height: 100%; resize:horizontal; cursor: w-resize; float: left; background: #F1F1F1"></div>
                           <div class="resize" id="sideResize" style="width: 1%; height: 100%; resize:horizontal; cursor: w-resize; float: left; background: #F1F1F1"></div>
                           <div class="tab-content" style="width: 99%; height: 100%; float: left">
                           <div class="tab-content" style="width: 99%; height: 100%; float: left">
+                              <!--查找定位-->
+                              <div class="tab-pane" id="locate">
+                                  <div class="sidebar-tools-bar container-fluid tools-bar-height-y">
+                                      <div class="p-1 row">
+                                          <div class="input-group input-group-sm col-12">
+                                              <input type="text" class="form-control form-control-sm" placeholder="查找内容" value="">
+                                              <div class="input-group-append">
+                                                  <button class="btn btn-secondary btn-sm" type="button"><i class="fa fa-search" aria-hidden="true"></i></button>
+                                              </div>
+                                          </div>
+                                          <div class="form-group col-12 mb-1">
+                                              <div class="form-check form-check-inline">
+                                                  <input class="form-check-input" type="radio" name="content_type" id="bills" value="option1">
+                                                  <label class="form-check-label" for="bills">分项/清单</label>
+                                              </div>
+                                              <div class="form-check form-check-inline">
+                                                  <input class="form-check-input" type="radio" name="content_type" id="ration" value="option2">
+                                                  <label class="form-check-label" for="ration">定额</label>
+                                              </div>
+                                              <div class="form-check form-check-inline">
+                                                  <input class="form-check-input" type="radio" name="content_type" id="raion_glj" value="option3">
+                                                  <label class="form-check-label" for="raion_glj">人材机</label>
+                                              </div>
+                                              <!--<div class="form-check form-check-inline">
+                                                  <input class="form-check-input" type="radio" name="inlineRadioOptions" id="bookmark" value="option4">
+                                                  <label class="form-check-label" for="bookmark">书签标注</label>
+                                              </div>-->
+                                          </div>
+                                          <!--搜索分项/清单 出现-->
+                                          <div class="col-12"  id="outstandingOptions">
+                                              <div class="form-group form-check mb-0">
+                                                  <input type="checkbox" class="form-check-input" id ="outstanding">
+                                                  <label class="form-check-label" for="outstanding">超 <input type="number" style="width:50px"> % 时突出显示</label>
+                                              </div>
+                                          </div>
+                                      </div>
+                                  </div>
+                                  <!--上下结构-->
+                                  <div class="top-content" style="overflow: hidden">
+                                      <div class="" id="locate_result" >
+                                      </div>
+                                  </div>
+                                  <div class="resize" id="locate_resize" style="background: #F1F1F1"></div>
+                                  <div class="bottom-content">
+                                      <div class="" id="locate_sub"></div>
+                                  </div>
+                                <!--  <div class="main-data-side-y">
+                                      <table class="table table-sm table-bordered">
+                                          <tr><th>编码</th><th>项目名称</th><th>工程量</th><th>单位</th><th>综合单价</th><th>综合合价</th></tr>
+                                      </table>
+                                  </div>
+                                  <div class="sidebar-bottom container-fluid">
+                                      <div class="row">
+                                          <div class="col-lg-12">
+                                              <table class="table table-sm table-bordered">
+                                                  <tr><th>定额编号</th><th>定额名称</th></tr>
+                                                  <tr><td>AA0047</td><td>人工沟槽 较硬岩 槽深4m以内</td></tr>
+                                                  <tr><td>AA0005</td><td>人工挖沟槽土方 槽深4m以内</td></tr>
+                                              </table>
+                                          </div>
+                                      </div>
+                                  </div>-->
+
+                              </div>
+
                               <!--清单指引-->
                               <!--清单指引-->
                               <div class="tab-pane" id="zy">
                               <div class="tab-pane" id="zy">
                                   <div class="sidebar-tools-bar container-fluid tools-bar-height-z">
                                   <div class="sidebar-tools-bar container-fluid tools-bar-height-z">
@@ -455,23 +523,68 @@
                                   </div>
                                   </div>
                               </div>
                               </div>
                               <!--块模板库-->
                               <!--块模板库-->
-                              <div class="tab-pane" id="kmbk">
-                                  <div class="tools-bar-height-d container-fluid">
+                              <div class="tab-pane" id="kmbk" role="tabpanel">
+                                  <div class="sidebar-tools-bar container-fluid tools-bar-height-z">
                                       <div class="p-1 row">
                                       <div class="p-1 row">
-                                          <!--<button id="btn_block_collapse" class="btn btn-primary btn-sm" type="button">展开/折叠</button>-->
-                                          <button id="btn_block_newFolder" class="btn btn-primary btn-sm" type="button">新建分类</button>
-                                          <!--<button id="btn_block_newSubFolder" class="btn btn-warning btn-sm" type="button">新建块</button>-->
+                                          <select class="form-control form-control-sm col-6" id="exampleSelect1">
+                                              <option>我的模板库</option>
+                                          </select>
+                                          <div class="col-6">
+                                              <div class="d-inline">
+                                                  <button type="button" class="btn btn-sm btn-secondary" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" id="btn_block_newFolder">
+                                                      新建分类
+                                                  </button>
+                                                  <div class="dropdown-menu dropdown-menu-right">
+                                                      <form class="px-3 py-2">
+                                                          <div class="form-group m-0">
+                                                              <div class="input-group input-group-sm">
+                                                                  <input type="text" class="form-control" placeholder="请输入分类名称" id="input_block_newFolder">
+                                                                  <div class="input-group-append">
+                                                                      <button class="btn btn-primary" type="button" id="btn_block_newFolder_add">添加</button>
+                                                                  </div>
+                                                              </div>
+                                                          </div>
+                                                      </form>
+                                                  </div>
+                                              </div>
+                                              <div class="d-inline">
+                                                  <button type="button" class="btn btn-sm btn-secondary" data-toggle="dropdown" id="btn_block_reName">
+                                                      重命名
+                                                  </button>
+                                                  <div class="dropdown-menu dropdown-menu-right">
+                                                      <form class="px-3 py-2">
+                                                          <div class="form-group m-0">
+                                                              <!--<label id="lbl_block_reName"></label>-->
+                                                              <div class="input-group input-group-sm" style="width:300px">
+                                                                  <input type="text" class="form-control  is-invalid" placeholder="请输入名称" value="重命名" id="input_block_reName">
+                                                                  <div class="input-group-append">
+                                                                      <button class="btn btn-primary" type="button" id="btn_block_reName_OK">确定</button>
+                                                                  </div>
+                                                                  <!--<div class="invalid-feedback">名称太长了,请减少一些。</div>-->
+                                                              </div>
+                                                          </div>
+                                                      </form>
+                                                  </div>
+                                              </div>
+                                          </div>
                                       </div>
                                       </div>
                                   </div>
                                   </div>
-                                  <div class="top-content" style="overflow: hidden">
-                                      <div class="main-data-side-d" id="div_block_tree">
-                                      </div>
+                                  <div class="main-data-side-m">
+                                          <div id="div_block_tree" style="height:400px;"></div>
                                   </div>
                                   </div>
                                   <div class="resize" id="kmbkResize" style="background: #F1F1F1"></div>
                                   <div class="resize" id="kmbkResize" style="background: #F1F1F1"></div>
-                                  <div class="bottom-content">
-                                      <div class="main-data-bottom" id="div_block_detail">
-
-                                      </div>
+                                  <div class="sidebar-middle container-fluid">
+                                      <table class="table table-sm table-bordered">
+                                          <tr><th>项目编码</th><th>项目名称</th><th>单位</th><th>综合单价</th><th>项目特征</th></tr>
+                                          <tr><td>010202002</td><td>咬合灌注桩</td><td>m2</td><td>18732.38</td><td></td></tr>
+                                      </table>
+                                  </div>
+                                  <div class="sidebar-bottom container-fluid">
+                                      <table class="table table-sm table-bordered">
+                                          <tr><th>编码</th><th>名称</th><th>单位</th><th>含量</th><th>取费专业</th><th>综合单价</th><th>子目换算状态</th></tr>
+                                          <tr><td>AA0043</td><td>人工沟槽 软</td><td>1000</td><td>0.01</td><td>人工土石</td><td></td><td></td></tr>
+                                          <tr><td>AA0046</td><td>人工沟槽 硬</td><td>1000</td><td>0.21</td><td>人工土石</td><td></td><td></td></tr>
+                                      </table>
                                   </div>
                                   </div>
                               </div>
                               </div>
                           </div>
                           </div>
@@ -1567,7 +1680,37 @@
         </div>
         </div>
     </div>
     </div>
 </div>
 </div>
-<img src="/web/dest/css/img/folder_open.png" id="folder_open_pic" style="display: none">
+<!--弹出 生成组价模板-->
+<div class="modal fade" id="zujiamb" data-backdrop="static">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <h5 class="modal-title">选择模板存储位置</h5>
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
+                    <span aria-hidden="true">&times;</span>
+                </button>
+            </div>
+            <div class="modal-body">
+                <div class="form-group">
+                    <label>模板分类</label>
+                    <select class="form-control" id="select_block_category"><option>1.分类1</option><option>2.分类2</option></select>
+                </div>
+                <div class="form-group">
+                    <div class="form-check form-check-inline">
+                        <input class="form-check-input" type="checkbox" name="inlineRadioOptions" id="inlinecheckbox1" value="option1">
+                        <label class="form-check-label" for="inlinecheckbox1">当存在同名模板时,提示是否覆盖</label>
+                    </div>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
+                <a href="" class="btn btn-primary" id="btn_block_createBlocks">确定生成</a>
+            </div>
+        </div>
+    </div>
+</div>
+
+    <img src="/web/dest/css/img/folder_open.png" id="folder_open_pic" style="display: none">
     <img src="/web/dest/css/img/folder_close.png" id="folder_close_pic" style="display: none">
     <img src="/web/dest/css/img/folder_close.png" id="folder_close_pic" style="display: none">
     <img src="/web/dest/css/img/project.png" id="proj_pic" style="display: none">
     <img src="/web/dest/css/img/project.png" id="proj_pic" style="display: none">
     <img src="/web/dest/css/img/engineering.png" id="eng_pic" style="display: none">
     <img src="/web/dest/css/img/engineering.png" id="eng_pic" style="display: none">
@@ -1707,6 +1850,7 @@
     <script type="text/javascript" src="/web/building_saas/main/js/views/sub_fee_rate_views.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/views/sub_fee_rate_views.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/views/calc_base_view.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/views/calc_base_view.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/views/project_property_labour_coe_view.js"></script>
     <script type="text/javascript" src="/web/building_saas/main/js/views/project_property_labour_coe_view.js"></script>
+    <script type="text/javascript" src="/web/building_saas/main/js/views/locate_view.js"></script>
     <script type="text/javascript" src="/web/building_saas/complementary_ration_lib/js/main.js"></script>
     <script type="text/javascript" src="/web/building_saas/complementary_ration_lib/js/main.js"></script>
     <script type="text/javascript" src="/public/web/storageUtil.js"></script>
     <script type="text/javascript" src="/public/web/storageUtil.js"></script>
     <!-- endinject -->
     <!-- endinject -->

+ 50 - 12
web/building_saas/main/js/views/block_lib.js

@@ -64,6 +64,7 @@ var blockLibObj = {
             me.mainTree.loadDatas(datas);
             me.mainTree.loadDatas(datas);
             me.mainTreeController.showTreeData();
             me.mainTreeController.showTreeData();
             me.mainSheet.getRange(-1, 0, -1, 1).cellType(me.getTreeCell(me.mainTree));
             me.mainSheet.getRange(-1, 0, -1, 1).cellType(me.getTreeCell(me.mainTree));
+            me.mainTree.selected = me.mainTree.items[0];
 /*            me.mainTreeController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, function (node) {
 /*            me.mainTreeController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, function (node) {
                 rationLibObj.loadSectionRations(node && node.children.length === 0 ? node.getID() : null);
                 rationLibObj.loadSectionRations(node && node.children.length === 0 ? node.getID() : null);
             });
             });
@@ -284,7 +285,7 @@ var blockLibObj = {
         };
         };
         return new TreeCell();
         return new TreeCell();
     },
     },
-    newNode: function (nodeType, nodeName){     // 1 分类  2 块文件
+    newNode: function (nodeType, nodeName, categoryID){     // 1 分类  2 块文件
         let tree = blockLibObj.mainTree;
         let tree = blockLibObj.mainTree;
         let pID = -1, nID = -1;
         let pID = -1, nID = -1;
         let select = tree.selected;
         let select = tree.selected;
@@ -299,12 +300,9 @@ var blockLibObj = {
             else if (select.data.type == 2){
             else if (select.data.type == 2){
                 nID = select.parent.getNextSiblingID();
                 nID = select.parent.getNextSiblingID();
             };
             };
-            newNode = tree.insert(pID, nID);
-            newNode.data.type = 1;
-            newNode.data.name = '分类';
         }
         }
         else if (nodeType == 2) {
         else if (nodeType == 2) {
-            if (!select) {
+/*            if (!select) {
                 pID = tree.items[0].getID();
                 pID = tree.items[0].getID();
             }
             }
             else if (select.data.type == 1){
             else if (select.data.type == 1){
@@ -313,12 +311,15 @@ var blockLibObj = {
             else if (select.data.type == 2){
             else if (select.data.type == 2){
                 pID = select.getParentID();
                 pID = select.getParentID();
                 nID = select.getNextSiblingID();
                 nID = select.getNextSiblingID();
-            };
-            newNode = tree.insert(pID, nID);
-            newNode.data.type = 2;
-            newNode.data.name = nodeName;
+            };*/
+
+            pID = categoryID;
+            nID = -1;
         }
         }
 
 
+        newNode = tree.insert(pID, nID);
+        newNode.data.type = nodeType;
+        newNode.data.name = nodeName;
         tree.selected = newNode;
         tree.selected = newNode;
 
 
         let sheet = blockLibObj.mainSheet;
         let sheet = blockLibObj.mainSheet;
@@ -333,6 +334,27 @@ var blockLibObj = {
 
 
         sheet.resumeEvent();
         sheet.resumeEvent();
         sheet.resumePaint();
         sheet.resumePaint();
+    },
+    reName: function (node, newName){
+        node.data.name = newName;
+        let nodes = blockLibObj.mainTree.items;
+        let idx = -1;
+        for (let i = 0; i < nodes.length; i++) {
+            if (node == nodes[i]){
+                idx = i;
+                break;
+            }
+        }
+        blockLibObj.mainSheet.setValue(idx, 0, newName);
+    },
+    getCategories: function () {
+        let nodes = [], node = blockLibObj.mainTree.items[0];
+        nodes.push(node);
+        while (node.nextSibling != null){
+            node = node.nextSibling;
+            nodes.push(node);
+        };
+        return nodes;
     }
     }
 };
 };
 
 
@@ -345,9 +367,25 @@ $(document).ready(function(){
         }
         }
     });
     });
     $('#btn_block_newFolder').on('click', function (){
     $('#btn_block_newFolder').on('click', function (){
-        blockLibObj.newNode(1);
+        $('#input_block_newFolder').val('');
+    });
+
+    $('#btn_block_newFolder_add').on('click', function (){
+        let name = $('#input_block_newFolder').val();
+        if (name != '') blockLibObj.newNode(1, name);
     });
     });
-    $('#btn_block_newSubFolder').on('click', function (){
-        blockLibObj.newNode(2);
+
+    $('#btn_block_reName').on('click', function (){
+        let select = blockLibObj.mainTree.selected;
+        // $('#lbl_block_reName').text(select.data.name);
+        $('#input_block_reName').val(select.data.name);
     });
     });
+
+    $('#btn_block_reName_OK').on('click', function (){
+        let select = blockLibObj.mainTree.selected;
+        let oldName = select.data.name;
+        let newName = $('#input_block_reName').val();
+        if (oldName != newName) blockLibObj.reName(select, newName);
+    });
+
 });
 });

+ 38 - 0
web/building_saas/main/js/views/locate_view.js

@@ -0,0 +1,38 @@
+/**
+ * Created by zhang on 2018/11/16.
+ */
+let locateObject={
+
+
+    init:function () {
+        let tab_content = $('#locate').parent();
+        $('#locate_result').height(tab_content.height()*0.6);
+        $('#locate_sub').height(tab_content.height()*0.4);
+
+
+    },
+
+    onshow:function () {
+
+        locateObject.init();
+        console.log('#locate is now visible');
+        console.log($("#locate").is(':visible'))
+    }
+
+}
+
+
+
+
+/*
+$("input[name='install_setting_radios']").each(function(){
+    $(this).click(function(){
+        var settingVal = $(this).val();
+        let installSetting = projectInfoObj.projectInfo.property.installSetting;
+        if(installSetting==settingVal){
+            return;
+        }
+        projectObj.project.installation_fee.updateInstallSetting(settingVal);
+        installationFeeObj.cleanPositionIfNeed(settingVal);
+    });
+});*/

+ 36 - 5
web/building_saas/main/js/views/project_view.js

@@ -1507,12 +1507,18 @@ var projectObj = {
                         return selected.sourceType != ModuleNames.bills;
                         return selected.sourceType != ModuleNames.bills;
                     },
                     },
                     callback:function(){
                     callback:function(){
-                        if (!$("#kmbk").is(":visible")){
-                            $('#blockLibTab').click()
-                        };
                         let selected = project.mainTree.selected;
                         let selected = project.mainTree.selected;
-                        let name = selected.data.code + ' ' + selected.data.name + ' ' + selected.data.unit;
-                        blockLibObj.newNode(2, name);
+                        if (selected.data.name == undefined || selected.data.name == ''){
+                            hintBox.infoBox('系统提示','清单名称为空,无法生成块模板文件!', 1);
+                            return false;
+                        }
+                        else{
+                            if (!$("#kmbk").is(":visible")){
+                                $('#blockLibTab').click()
+                            };
+
+                            $("#zujiamb").modal({show: true});
+                        }
                     },
                     },
                     visible: function(key, opt){
                     visible: function(key, opt){
                         return G_SHOW_BLOCK_LIB;
                         return G_SHOW_BLOCK_LIB;
@@ -2873,6 +2879,31 @@ $(function () {
 
 
     });
     });
 
 
+    $("#zujiamb").on('show.bs.modal', function(){
+        function getBlockCategoriesHtml(Categories) {
+            let result = '';
+            if (Categories.length <= 0) return result;
+
+            for (let c of Categories){
+                result += '<option value="'+ c.data.ID +'">'+ c.data.name +'</option>';
+            };
+            return result;
+        };
+
+        let sHtml = getBlockCategoriesHtml(blockLibObj.getCategories());
+        $("#select_block_category").html(sHtml);
+        $("#select_block_category")[0].selectedIndex = 0;
+    });
+
+    $("#btn_block_createBlocks").click(function () {
+        if ($("#select_block_category")[0].options.length < 1) return;
+        let selected = projectObj.project.mainTree.selected;
+        let name = selected.data.code + ' ' + selected.data.name + ' ' + selected.data.unit;
+        name = name.replace(/^\s+|\s+$/g, "");    // 只去两头空格
+        let cID = $("#select_block_category").val();
+        blockLibObj.newNode(2, name, cID);
+    });
+
 
 
     function spreadAutoFocus(spread,relateSpread) {
     function spreadAutoFocus(spread,relateSpread) {
         if(relateSpread&&relateSpread.getActiveSheet().isEditing()){//关联的spread不在编辑状态的情况下,才自动获得焦点;
         if(relateSpread&&relateSpread.getActiveSheet().isEditing()){//关联的spread不在编辑状态的情况下,才自动获得焦点;

+ 3 - 1
web/building_saas/main/js/views/side_tools.js

@@ -103,7 +103,7 @@ var sideToolsObj = {
                 sideResizeEles.farElement.css('width', '33.333333%');
                 sideResizeEles.farElement.css('width', '33.333333%');
             }
             }
             $('.main-side .tab-pane').hide();
             $('.main-side .tab-pane').hide();
-            tabPanel.show();
+            id === 'locateTab'?tabPanel.show(locateObject.onshow):tabPanel.show();//locateTab要等div显示后才执行刷新操作
             loadSize(sideResizeEles, 'width', function(){
             loadSize(sideResizeEles, 'width', function(){
                 if(id === 'stdBillsGuidanceTab'){//清单指引
                 if(id === 'stdBillsGuidanceTab'){//清单指引
                     loadSize(billsGuidanceLibResizeEles, 'height', function(){
                     loadSize(billsGuidanceLibResizeEles, 'height', function(){
@@ -116,6 +116,8 @@ var sideToolsObj = {
                 else if(id === 'blockLibTab'){//定额库
                 else if(id === 'blockLibTab'){//定额库
                     loadSize(blockLibResizeEles, 'height', function(){
                     loadSize(blockLibResizeEles, 'height', function(){
                     });
                     });
+                }else if(id == "locateTab"){
+
                 }
                 }
                 else{//清单库
                 else{//清单库
                     loadSize(billsLibResizeEles, 'height', function(){
                     loadSize(billsLibResizeEles, 'height', function(){

+ 61 - 16
web/building_saas/main/js/views/std_ration_lib.js

@@ -5,6 +5,7 @@
 /*var rationChapterSpread, sectionRationsSpread;*/
 /*var rationChapterSpread, sectionRationsSpread;*/
 
 
 var rationLibObj = {
 var rationLibObj = {
+    searchLimit: 50,
     libType: {complementary: 0, std: 1},
     libType: {complementary: 0, std: 1},
     compleRationLibId: 'compleRationLib',
     compleRationLibId: 'compleRationLib',
     doAfterGetRationTree: null, //获取章节树回调
     doAfterGetRationTree: null, //获取章节树回调
@@ -214,6 +215,19 @@ var rationLibObj = {
             });
             });
         }
         }
     },
     },
+    //滚动条到底部加载
+    onRationSpreadTopRowChanged: function (sender, args) {
+        let me = rationLibObj;
+        if(me.searching) {
+            return;
+        }
+        let bottomRow = args.sheet.getViewportBottomRow(1),
+            rowCount = args.sheet.getRowCount();
+        //滚到了底部
+        if (bottomRow + 1 - me.sectionRationsSetting.emptyRows === rowCount - me.sectionRationsSetting.emptyRows) {
+            seachRation();
+        }
+    },
     loadStdRationContextMenu: function () {
     loadStdRationContextMenu: function () {
         let rationSpread = rationLibObj.sectionRationsSpread, rationSheet = rationSpread.getActiveSheet(),  rationModel = projectObj.project.Ration;;
         let rationSpread = rationLibObj.sectionRationsSpread, rationSheet = rationSpread.getActiveSheet(),  rationModel = projectObj.project.Ration;;
         $.contextMenu({
         $.contextMenu({
@@ -449,6 +463,25 @@ var rationLibObj = {
         let defaultLib = _.find(ration_lib,{'isDefault':true});
         let defaultLib = _.find(ration_lib,{'isDefault':true});
         let libID = defaultLib?defaultLib.id:ration_lib[0].id;
         let libID = defaultLib?defaultLib.id:ration_lib[0].id;
         return parseInt(libID);
         return parseInt(libID);
+    },
+    //@param {Array}datas(resultCache) @return {Object}
+    //搜索skip信息,不能被每页搜索数整除,则说明上次搜索已经搜索完整
+    getSearchSkip: function (datas) {
+        if (datas.length % this.searchLimit !== 0) {
+            return null;
+        }
+        let skip = {std: 0, comple: 0};
+        if (!datas || !Array.isArray(datas) || datas.length === 0) {
+            return skip;
+        }
+        for (let data of datas) {
+            if (data.type === 'std') {
+                skip.std++;
+            } else {
+                skip.comple++;
+            }
+        }
+        return skip;
     }
     }
 };
 };
 
 
@@ -489,7 +522,7 @@ $('#rationSearchKeyword').keyup(function () {
     let keyword = $('#rationSearchKeyword').val();
     let keyword = $('#rationSearchKeyword').val();
     if(keyword === ''){
     if(keyword === ''){
         if($('#rationSearchResult').is(':visible')){
         if($('#rationSearchResult').is(':visible')){
-            rationLibObj.resultCache = null;
+            rationLibObj.resultCache = [];
             $('#rationSearchResult').hide();
             $('#rationSearchResult').hide();
             $(".main-data-side-search", $('#rationSearchResult')).height(0);
             $(".main-data-side-search", $('#rationSearchResult')).height(0);
             switchRationSearchMode(0);
             switchRationSearchMode(0);
@@ -501,6 +534,7 @@ $('#rationSearchKeyword').keyup(function () {
 
 
 //变换搜索本定额、全部定额状态
 //变换搜索本定额、全部定额状态
 function switchRationSearchMode(mode) {
 function switchRationSearchMode(mode) {
+    rationLibObj.resultCache = [];
     //搜索本定额
     //搜索本定额
     if(mode === 0){
     if(mode === 0){
         $('#curRationLib').removeClass('btn-light');
         $('#curRationLib').removeClass('btn-light');
@@ -534,11 +568,16 @@ $('#allRationLibs').click(function () {
 });
 });
 
 
 //搜索
 //搜索
-$('#rationSearch').click(function () {
+function seachRation(){
+    let skip = rationLibObj.getSearchSkip(rationLibObj.resultCache);
+    if (!skip) {
+        return;
+    }
+    rationLibObj.searching = true;
     var keyword = $('#rationSearchKeyword').val();
     var keyword = $('#rationSearchKeyword').val();
     if(keyword === ''){
     if(keyword === ''){
         if($('#rationSearchResult').is(':visible')){
         if($('#rationSearchResult').is(':visible')){
-            rationLibObj.resultCache = null;
+            rationLibObj.resultCache = [];
             $('#rationSearchResult').hide();
             $('#rationSearchResult').hide();
             $(".main-data-side-search", $('#rationSearchResult')).height(0);
             $(".main-data-side-search", $('#rationSearchResult')).height(0);
             autoFlashHeight();
             autoFlashHeight();
@@ -610,33 +649,29 @@ $('#rationSearch').click(function () {
         });
         });
     };
     };
     var showResult = function (result) {
     var showResult = function (result) {
-        rationLibObj.resultCache = result;
         if(!rationLibObj.resultSpread){
         if(!rationLibObj.resultSpread){
             let resultSpread = SheetDataHelper.createNewSpread($('.main-data-side-search')[0]);
             let resultSpread = SheetDataHelper.createNewSpread($('.main-data-side-search')[0]);
             rationLibObj.resultSpread = resultSpread;
             rationLibObj.resultSpread = resultSpread;
             bindContextmenuOpr(resultSpread.getActiveSheet());
             bindContextmenuOpr(resultSpread.getActiveSheet());
             SheetDataHelper.loadSheetHeader(rationLibObj.sectionRationsSetting, resultSpread.getActiveSheet());
             SheetDataHelper.loadSheetHeader(rationLibObj.sectionRationsSetting, resultSpread.getActiveSheet());
             resultSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, rationLibObj.onRationSpreadCellDoubleClick);
             resultSpread.bind(GC.Spread.Sheets.Events.CellDoubleClick, rationLibObj.onRationSpreadCellDoubleClick);
+            resultSpread.bind(GC.Spread.Sheets.Events.TopRowChanged, rationLibObj.onRationSpreadTopRowChanged);
         }else {
         }else {
             rationLibObj.resultSpread.refresh();
             rationLibObj.resultSpread.refresh();
         }
         }
         SheetDataHelper.loadSheetData(rationLibObj.sectionRationsSetting, rationLibObj.resultSpread.getActiveSheet(), result);
         SheetDataHelper.loadSheetData(rationLibObj.sectionRationsSetting, rationLibObj.resultSpread.getActiveSheet(), result);
         rationLibObj.setTagForHint(rationLibObj.resultSpread.getActiveSheet(), result);
         rationLibObj.setTagForHint(rationLibObj.resultSpread.getActiveSheet(), result);
+        rationLibObj.resultCache = result;
     };
     };
     $.bootstrapLoading.start();
     $.bootstrapLoading.start();
-    CommonAjax.post('/complementaryRation/api/findRation', {'user_id': userID, 'rationRepId': rationLibIDs, 'keyword': keyword}, function (result) {
-        //sort
-        result.sort(function (a, b) {
-            let rst = 0;
-            if(a.code > b.code) rst = 1;
-            else if(a.code < b.code) rst = -1;
-            return rst;
-        });
+    CommonAjax.post('/complementaryRation/api/findRation', {'user_id': userID, 'rationRepId': rationLibIDs, 'keyword': keyword, skip: skip}, function (result) {
         var resultObj = $('#rationSearchResult');
         var resultObj = $('#rationSearchResult');
-        $('#rationSearchCount').text(`搜索结果:${result.length.toString()}`);
-        $('a', result).unbind('click');
+        if (result.count !== null) {
+            $('#rationSearchCount').text(`搜索结果:${result.count}`);
+        }
+        $('a', resultObj).unbind('click');
         $('a', resultObj).bind('click', function () {
         $('a', resultObj).bind('click', function () {
-            rationLibObj.resultCache = null;
+            rationLibObj.resultCache = [];
             switchRationSearchMode(0);
             switchRationSearchMode(0);
             resultObj.hide();
             resultObj.hide();
             $(".main-data-side-search", resultObj).height(0);
             $(".main-data-side-search", resultObj).height(0);
@@ -645,9 +680,19 @@ $('#rationSearch').click(function () {
         });
         });
         resultObj.show();
         resultObj.show();
         $(".main-data-side-search", resultObj).height($(window).height() - $(".header").height() - $(".toolsbar").height() - 64);
         $(".main-data-side-search", resultObj).height($(window).height() - $(".header").height() - $(".toolsbar").height() - 64);
-        showResult(result);
+        showResult(rationLibObj.resultCache.concat(result.data));
+        rationLibObj.searching = false;
+        //以防一开始就需要加载后面的分页数据
+        if (result.data.length > 0) {
+            rationLibObj.onRationSpreadTopRowChanged({}, {sheet: rationLibObj.resultSpread.getActiveSheet()});
+        }
         $.bootstrapLoading.end();
         $.bootstrapLoading.end();
     }, function () {
     }, function () {
+        rationLibObj.searching = false;
         $.bootstrapLoading.end();
         $.bootstrapLoading.end();
     });
     });
+}
+$('#rationSearch').click(function () {
+    rationLibObj.resultCache = [];
+    seachRation();
 });
 });