Browse Source

Merge branch '1.0.0_online' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost into 1.0.0_online

zhongzewei 6 years ago
parent
commit
2e80c0dfa4

+ 2 - 3
public/web/tree_sheet/tree_sheet_helper.js

@@ -510,7 +510,7 @@ var TREE_SHEET_HELPER = {
         };
         TreeNodeCellType.prototype.processMouseMove = function(hitinfo){//造价书主界面,当鼠标移动到单元格最右往左50个像素内时才显示悬浮提示内容
             if (hitinfo.sheet.name()!=="mainSheet") return;//只有在造价书主界面才显示
-            let offset = 20;//从右向左显示的像素范围
+            let offset = hitinfo.cellRect.width//20;从右向左显示的像素范围   2018-11-22 这里需求又改成不悬停在编码单元格右边一部分才弹出,整个单元格都弹出,所以offset先改成单元格的宽度,防止以后又改回来
             let leftX = hitinfo.cellRect.x + hitinfo.cellRect.width;//最右边的坐标
             if(leftX - hitinfo.x <= offset){//如果鼠标移动到的位置是在显示的范围内显示悬浮提示
                 TREE_SHEET_HELPER.delayShowTips(hitinfo,setting);
@@ -659,8 +659,7 @@ var TREE_SHEET_HELPER = {
                     //显示在下方,三角形指
                     let top = setting.pos.y  +hitinfo.cellRect.y+ hitinfo.cellRect.height+10;
                     let left =  setting.pos.x + hitinfo.cellRect.x;
-                    $(this._toolTipElement).css("top", top).css("left", left);
-
+                    $(this._toolTipElement).css("top", top).css("left", left).css("max-width","500px");
                 }
                 $(this._toolTipElement).show("fast");
                 TREE_SHEET_HELPER.tipDiv = 'show';//做个标记

+ 5 - 2
web/building_saas/css/custom.css

@@ -254,15 +254,18 @@ legend.legend{
     color: black;
 }
 .ration_glj_spread{
-    width: 70%;
+    width: 83%;
     float: left;
 }
 
 .item_spread{
     width: 29.8%;
     float: left;
-    background: #F1F1F1
+    white-space:nowrap;
+    margin-top: -5px;
+    background: #F1F1F1;
 }
+
 input.text-right{
     text-align: right;
 }

+ 24 - 24
web/building_saas/main/html/main.html

@@ -150,7 +150,7 @@
                               <div class="main-data-top" id="billsSpread"></div>
                           </div>
                           <div class="resize"></div>
-                          <div class="bottom-content">
+                          <div class="bottom-content" id="bottom_div">
                               <ul class="nav nav-tabs" role="tablist">
                                   <li class="nav-item" id="GLJ_div">
                                       <a class="nav-link sub-item active" id="linkGLJ" data-toggle="tab" href="#subSpread" role="tab">人材机</a>
@@ -184,8 +184,17 @@
                               <div class="tab-content" id="tabCon">
                                   <div class="tab-pane active" id="subItems" role="tabpanel">
                                       <div class="main-data-bottom ovf-hidden" id="subSpread" style="display: none" tabindex="0"></div>
-                                      <div class="main-data-bottom ovf-hidden" id="rgResize" style="width: 0.2%; height: 100%; resize:horizontal; cursor: w-resize; float: left; background: #F1F1F1"></div>
-                                      <div class="item_spread main-data-bottom ovf-hidden " id="replaceM" style="display: none" ></div>
+                                      <div class="main-data-bottom ovf-hidden" id="rgResize" style="width: 0.2%; height: 100%; resize:horizontal; cursor: w-resize; float: left; background: #F1F1F1;display: none"></div>
+                                      <div class="item_spread main-data-bottom ovf-hidden " id="replaceM" style="display: none" >
+                                          <div class="p-0" id="openItemText" style="height:100%;white-space:normal;width: 40px">
+                                              <div class="tn-nav d-flex align-items-start flex-column" data-toggle="tooltip" data-placement="left" title="" data-original-title="打开项目特征">
+                                                  <span class="mt-3 ml-2 text-primary">项目特征</span>
+                                                  <i class="fa fa-arrow-left mt-auto mb-3 text-primary ml-2"></i>
+                                              </div>
+                                          </div>
+                                          <a id="closeItemText" style="float: right;width: auto;display: none"  data-toggle="tooltip" data-placement="bottom" data-original-title="关闭项目特征" class="col-7 col-form-label" href="javascript:void(0);"><i class="fa fa-arrow-right"></i></a>
+                                          <div id="replaceText" style="display: none;padding-bottom: 10px"></div>
+                                      </div>
                                       <div class="main-data-bottom ovf-hidden" id="tabZMHS" style="display: none">
                                           <div class=" main-data-bottom ovf-hidden" style="width: 60%; float: left; margin: 0; padding:0;" id="coeSpread"></div>
                                           <div  id="zmhsResize" style="width: 0.2%; height: 100%; resize:horizontal; cursor: w-resize; float: left; background: #F1F1F1"></div>
@@ -208,6 +217,7 @@
                                                       <a href="javascript:void(0);" id="jobUp" class="btn btn-sm disabled" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="上移"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
                                                   </div>
                                               </div>
+                                              <div class="p-0" id="TZJNRResize" style="position:relative; width: 0.2%; resize:horizontal; cursor: w-resize; background: #F1F1F1"></div>
                                               <div class="p-0" id="itemDiv" style="position:relative">
                                                   <div class="main-data-bottom ovf-hidden"  id="itemSpread">
                                                   </div>
@@ -324,7 +334,7 @@
                                           <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>
+                                                  <button class="btn btn-secondary btn-sm" type="button" id="locate_btn"><i class="fa fa-search" aria-hidden="true"></i></button>
                                               </div>
                                           </div>
                                           <div class="form-group col-12 mb-1">
@@ -516,8 +526,7 @@
                                       </div>
                                   </div>
                                   <div class="top-content" style="overflow: hidden">
-                                      <div class="main-data-side-d" id="stdRationChapter">
-                                  </div>
+                                      <div class="main-data-side-d" id="stdRationChapter"></div>
                                   </div>
                                   <div class="resize" id="deResize" style="background: #F1F1F1"></div>
                                   <div class="bottom-content">
@@ -525,8 +534,8 @@
                                   </div>
                               </div>
                               <!--块模板库-->
-                              <div class="tab-pane" id="kmbk" role="tabpanel">
-                                  <div class="sidebar-tools-bar container-fluid tools-bar-height-z">
+                              <div class="tab-pane" id="kmbk">
+                                  <div class="tools-bar-height-d container-fluid">
                                       <div class="p-1 row">
                                           <select class="form-control form-control-sm col-6" id="exampleSelect1">
                                               <option>我的模板库</option>
@@ -571,22 +580,13 @@
                                           </div>
                                       </div>
                                   </div>
-                                  <div class="main-data-side-m">
-                                          <div id="div_block_tree" style="height:400px;"></div>
-                                  </div>
-                                  <div class="resize" id="kmbkResize" style="background: #F1F1F1"></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 class="top-content" style="overflow: hidden">
+                                      <div class="main-data-side-d" id="div_block_tree"></div>
                                   </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 class="resize" id="kmbkResize" style="background-color:#dfdcdc;"></div>
+                                  <div class="bottom-content" style="background-color:#ff7e0e">
+                                      <div id="div_block_bill" style="height:90px"></div>
+                                      <div id="div_block_ration" style="height:100%"></div>
                                   </div>
                               </div>
                           </div>
@@ -1706,7 +1706,7 @@
             </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>
+                <button type="button" class="btn btn-primary" data-dismiss="modal" id="btn_block_createBlocks">确定生成</button>
             </div>
         </div>
     </div>

+ 44 - 2
web/building_saas/main/js/controllers/material_controller.js

@@ -3,6 +3,7 @@
  */
 let MaterialController = {
     subSpreadDivWidth:"",
+    showItemText:false,
     //规则相关映射
     rule1: function (node) {
         let itemText = node.data.itemCharacterText;
@@ -178,6 +179,7 @@ let MaterialController = {
         refreshSubSpread();
     },
     showReplaceSpread:function(node){
+        $("#replaceM").addClass("ovf-hidden");
         this.initSpread();
         this.showData(node);
     },
@@ -219,8 +221,32 @@ let MaterialController = {
             $('#subSpread').css('width','');
             return;
         }
-        $('#subSpread').css('width',MaterialController.subSpreadDivWidth);
-        $("#replaceM").html(text);
+        $('#replaceM').css('margin-top',0);
+        this.toggleItemInit();
+        $("#replaceText").html(text);
+    },
+    toggleItemInit:function () {
+        if(this.showItemText == true){
+            $("#replaceM").removeClass("ovf-hidden");
+            $("#openItemText").hide();
+            $("#replaceText").show();
+            $("#closeItemText").show();
+            $("#rgResize").show();
+            let swidth =  this.subSpreadDivWidth == ""? $("#bottom_div").width()*0.83:this.subSpreadDivWidth;
+            swidth = parseFloat(swidth);
+            $('#subSpread').css('width',swidth);
+            $('#replaceM').css('width',$("#bottom_div").width()-$("#rgResize").width()-swidth);
+        }else {
+            $("#replaceM").addClass("ovf-hidden");
+            $("#openItemText").show();
+            $("#replaceText").hide();
+            $("#closeItemText").hide();
+            $("#rgResize").hide();
+            $('#replaceM').css('width',30);
+            $('#subSpread').css('width',$("#bottom_div").width()-30);
+
+
+        }
     },
     getItems:function(characterText){
         if(!characterText) return;
@@ -271,3 +297,19 @@ slideResize(rg_sideResizeEles, {min: 100, max: $('#tabCon').width()-100}, 'width
     MaterialController.subSpreadDivWidth = $('#subSpread').css('width');
     refreshSubSpread();
 });
+
+
+$(function (){
+    $("#openItemText").click(function () {
+        MaterialController.showItemText = true;
+        MaterialController.toggleItemInit();
+        refreshSubSpread();
+    });
+
+    $("#closeItemText").click(function () {
+        MaterialController.showItemText = false;
+        MaterialController.toggleItemInit();
+        refreshSubSpread();
+    });
+
+})

+ 11 - 6
web/building_saas/main/js/main.js

@@ -126,12 +126,17 @@ function slideResize(eles, limit, type, callback) {
             fEleChangeSize = fEleSize - moveSize;
             fEleChangeSize = fEleChangeSize < limit.min ? limit.min : fEleChangeSize;
             fEleChangeSize = fEleChangeSize > limit.max ? limit.max + 9 : fEleChangeSize;
-
+            let rePercent = {};
             if(type === 'width'){
-                let rePercent = getResizeWidthPercent(nEleChangeSize, fEleChangeSize);
-                console.log(rePercent);
-                eles.nearElement.css(type, rePercent.nearPercent);
-                eles.farElement.css(type, rePercent.farPercent);
+                 rePercent = getResizeWidthPercent(nEleChangeSize, fEleChangeSize);
+                if(limit.no_proportion === true){//如果只需要记算百分比,但不按页分比设置(还有其它兄弟div和情况)
+                    eles.nearElement.css(type, nEleChangeSize);
+                    eles.farElement.css(type, fEleChangeSize);
+                }else {
+                    eles.nearElement.css(type, rePercent.nearPercent);
+                    eles.farElement.css(type, rePercent.farPercent);
+                }
+
             }
             else{
                 eles.nearSpread[type](nEleChangeSize);
@@ -141,7 +146,7 @@ function slideResize(eles, limit, type, callback) {
             //实时刷新页面
             mouseMoveCount+=Math.abs(moveSize);//取移动的决对值
             if(mouseMoveCount >=5){//当累计移动超过5个像素时,才刷新,减少刷新次数
-                if(callback) callback();
+                if(callback) callback(rePercent);
                 mouseMoveCount = 0;
             }
         }

+ 1 - 1
web/building_saas/main/js/models/calc_program.js

@@ -761,7 +761,7 @@ let calcTools = {
         // 定额大类
         if (me.isRationCategory(treeNode)) {
             data.isSubcontract = treeNode.data.isSubcontract;
-
+            data.evaluationProject = treeNode.data.evaluationProject;
             //定额类型的工料机做特殊处理
             if(me.isGljRation(treeNode)){
                 data.code = treeNode.data.code;

+ 1 - 1
web/building_saas/main/js/models/quantity_detail.js

@@ -384,7 +384,7 @@ var quantity_detail = {
                     query.billID = recode.billID;
                     doc.billID=recode.billID;
                 }
-                if(this.checkAndCalcResult(args.editingText,args.row,doc) === false){
+                if(gljUtil.isDef(args.editingText)&&this.checkAndCalcResult(args.editingText,args.row,doc) === false){
                     gljOprObj.showQuantityDetailData();
                     return;
                 }

+ 87 - 36
web/building_saas/main/js/views/block_lib.js

@@ -1,4 +1,5 @@
 /**
+ * 块模板库管理。
  * Created by CSL on 2018-09-19.
  */
 var blockLibObj = {
@@ -34,23 +35,66 @@ var blockLibObj = {
         }]
     },
     mainDatas: [],
+    billSpread: null,
+    billSheet: null,
+    billSetting: {
+        header: [
+            {headerName: "项目编码", headerWidth: 90, dataCode: "code", dataType: "String", hAlign: "center"},
+            {headerName: "项目名称", headerWidth: 100, dataCode: "name", dataType: "String"},
+            {headerName: "单位", headerWidth: 40, dataCode: "unit", dataType: "String", hAlign: "center"},
+            {headerName: "综合单价", headerWidth: 60, dataCode: "quantity", dataType: "Number"},
+            {headerName: "项目特征", headerWidth: 120, dataCode: "itemCharacterText", dataType: "String"}
+        ],
+        view: {
+            lockColumns: [0, 1, 2, 3, 4]
+        }
+    },
+    rationSpread: null,
+    rationSheet: null,
+    rationSetting: {
+        header: [
+            {headerName: "编码", headerWidth: 45, dataCode: "code", dataType: "String", hAlign: "center"},
+            {headerName: "名称", headerWidth: 100, dataCode: "name", dataType: "String"},
+            {headerName: "单位", headerWidth: 40, dataCode: "unit", dataType: "String", hAlign: "center"},
+            {headerName: "含量", headerWidth: 40, dataCode: "contain", dataType: "Number"},
+            {headerName: "取费专业", headerWidth: 60, dataCode: "programID", dataType: "Number"},
+            {headerName: "综合单价", headerWidth: 60, dataCode: "quantity", dataType: "Number"},
+            {headerName: "子目换算状态", headerWidth: 90, dataCode: "adjustState", dataType: "String"}
+        ],
+        view: {
+            lockColumns: [0, 1, 2, 3, 4, 5, 6]
+        }
+    },
+
     buildSheet: function () {
         $.bootstrapLoading.start();
         let me = this;
         me.mainDatas = [
+            {ID: 1, ParentID: -1, NextSiblingID: 2, name: '分类1', type: 1},
             {ID: 2, ParentID: -1, NextSiblingID: 3, name: '分类2', type: 1},
-            {ID: 3, ParentID: -1, NextSiblingID: -1, name: '分类3', type: 1},
-            {ID: 6, ParentID: 2, NextSiblingID: 7, name: '块1', type: 2},
-            {ID: 7, ParentID: 2, NextSiblingID: -1, name: '块2', type: 2},
-            {ID: 52, ParentID: -1, NextSiblingID: 53, name: '分类52', type: 1},
-            {ID: 55, ParentID: -1, NextSiblingID: -1, name: '分类55', type: 1},
-            {ID: 88, ParentID: 52, NextSiblingID: -1, name: '块88', type: 2}
+            {ID: 3, ParentID: -1, NextSiblingID: 4, name: '分类3', type: 1},
+            // {ID: 105, ParentID: 1, NextSiblingID: 106, name: '块1', type: 2},
+            // {ID: 106, ParentID: 1, NextSiblingID: 107, name: '块2', type: 2},
+            {ID: 7, ParentID: -1, NextSiblingID: 8, name: '分类7', type: 1},
+            {ID: 9, ParentID: -1, NextSiblingID: -1, name: '分类9', type: 1}//,
+            // {ID: 201, ParentID: 52, NextSiblingID: -1, name: '块201', type: 2}
         ];
 
         if (me.mainSpread) {
             me.mainSpread.destroy();
             me.mainSpread = null;
         };
+
+        if (me.billSpread) {
+            me.billSpread.destroy();
+            me.billSpread = null;
+        };
+
+        if (me.rationSpread) {
+            me.rationSpread.destroy();
+            me.rationSpread = null;
+        };
+
         me.mainSpread = SheetDataHelper.createNewSpread($('#div_block_tree')[0]);
         // me.mainSpread = TREE_SHEET_HELPER.createNewSpread($('#div_block_tree')[0]);
         me.mainSheet = me.mainSpread.getSheet(0);
@@ -65,14 +109,9 @@ var blockLibObj = {
             me.mainTreeController.showTreeData();
             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) {
-                rationLibObj.loadSectionRations(node && node.children.length === 0 ? node.getID() : null);
+            me.mainTreeController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, function (node) {
+                blockLibObj.loadDetailDatas(node);
             });
-            if (me.mainTree.firstNode() && me.mainTree.firstNode().length === 0) {
-                rationLibObj.loadSectionRations(me.mainTree.firstNode().getID());
-            } else {
-                rationLibObj.loadSectionRations();
-            };*/
         };
 
 /*        CommonAjax.post('/complementaryRation/api/getRationTree', {userId: userID, rationRepId: rationLibID}, function (datas) {
@@ -84,8 +123,38 @@ var blockLibObj = {
         });*/
 
         showblockTree(me.mainDatas);
+
+        me.billSpread = sheetCommonObj.buildSheet($('#div_block_bill')[0], me.billSetting, 1);
+        me.billSheet = me.billSpread.getSheet(0);
+        sheetCommonObj.spreadDefaultStyle(me.billSpread);
+        me.billSheet.setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
+
+        me.rationSpread = sheetCommonObj.buildSheet($('#div_block_ration')[0], me.rationSetting, 1);
+        me.rationSheet = me.rationSpread.getSheet(0);
+        sheetCommonObj.spreadDefaultStyle(me.rationSpread);
+        me.rationSheet.setColumnWidth(0, 20, GC.Spread.Sheets.SheetArea.rowHeader);
+
         $.bootstrapLoading.end();
     },
+    loadDetailDatas: function (node){
+        let me = this;
+        if (node.data.type == 2){
+            let sourceNode = node.data.sourceNode;
+            let rations = sourceNode.children;
+            let rationDatas = [];
+            for (let r of rations){
+                rationDatas.push(r.data);
+            };
+            sheetCommonObj.showData(me.billSheet, me.billSetting, [sourceNode.data]);
+            let rCount = (rationDatas.length > 0) ? rationDatas.length : 1;
+            me.rationSheet.setRowCount(rCount, GC.Spread.Sheets.SheetArea.viewport);
+            sheetCommonObj.showData(me.rationSheet, me.rationSetting, rationDatas);
+        }
+        else{
+            sheetCommonObj.cleanSheet(me.billSheet, me.billSetting, 1);
+            sheetCommonObj.cleanSheet(me.rationSheet, me.rationSetting, 1);
+        }
+    },
     getTreeCell: function (tree) {
         let me = this;
         let indent = 20, levelIndent = -5, halfBoxLength = 5, halfExpandLength = 3, imgWidth = 14, imgHeight = 14;
@@ -285,11 +354,10 @@ var blockLibObj = {
         };
         return new TreeCell();
     },
-    newNode: function (nodeType, nodeName, categoryID){     // 1 分类  2 块文件
+    newNode: function (nodeType, nodeName, categoryID, sourceNode){     // 1 分类(只用前两个参数)  2 块文件
         let tree = blockLibObj.mainTree;
         let pID = -1, nID = -1;
         let select = tree.selected;
-        let newNode = null;
         if (nodeType == 1){
             if (!select) {
                 nID = -1;
@@ -302,24 +370,15 @@ var blockLibObj = {
             };
         }
         else if (nodeType == 2) {
-/*            if (!select) {
-                pID = tree.items[0].getID();
-            }
-            else if (select.data.type == 1){
-                pID = select.getID();
-            }
-            else if (select.data.type == 2){
-                pID = select.getParentID();
-                nID = select.getNextSiblingID();
-            };*/
-
             pID = categoryID;
             nID = -1;
         }
 
-        newNode = tree.insert(pID, nID);
+        let newNode = tree.insert(pID, nID);
         newNode.data.type = nodeType;
         newNode.data.name = nodeName;
+        if (nodeType == 2)
+            newNode.data.sourceNode = sourceNode;
         tree.selected = newNode;
 
         let sheet = blockLibObj.mainSheet;
@@ -337,14 +396,7 @@ var blockLibObj = {
     },
     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;
-            }
-        }
+        let idx = blockLibObj.mainTree.items.indexOf(node);
         blockLibObj.mainSheet.setValue(idx, 0, newName);
     },
     getCategories: function () {
@@ -377,7 +429,6 @@ $(document).ready(function(){
 
     $('#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);
     });
 

+ 3 - 3
web/building_saas/main/js/views/glj_col.js

@@ -6,7 +6,7 @@ let gljCol = {
         header: [
             {headerName: "编码", headerWidth: 130, dataCode: "code", dataType: "String", formatter: "@"},
             {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String",cellType:'tipsCell'},
-            {headerName: "规格型号", headerWidth: 160, dataCode: "specs", dataType: "String", hAlign: "left",cellType:'tipsCell'},
+            {headerName: "规格型号", headerWidth: 120, dataCode: "specs", dataType: "String", hAlign: "left",cellType:'tipsCell'},
             {headerName: "单位", headerWidth: 45, dataCode: "unit", dataType: "String", hAlign: "center"},
             {headerName: "市场价", headerWidth: 65, dataCode: "marketPrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"
             {headerName: "调整价", headerWidth: 65, dataCode: "adjustPrice", dataType: "Number", hAlign: "right"},//, decimalField: "glj.unitPrice"1
@@ -22,7 +22,7 @@ let gljCol = {
             rowHeaderWidth:25
         },
         getStyle:function (data) {
-            if(data.type == gljType.MAIN_MATERIAL){//是主材的话字体蓝色显示
+            if(data&&data.type == gljType.MAIN_MATERIAL){//是主材的话字体蓝色显示
                 return {foreColor:"#4D7BFF"};
             }
             return null;
@@ -35,7 +35,7 @@ let gljCol = {
         header: [
             {headerName: "编码", headerWidth: 80, dataCode: "code", dataType: "String"},
             {headerName: "名称", headerWidth: 160, dataCode: "name", dataType: "String",cellType:'tipsCell'},
-            {headerName: "规格型号", headerWidth: 160, dataCode: "specs", hAlign: "left", dataType: "String",cellType:'tipsCell'},
+            {headerName: "规格型号", headerWidth: 120, dataCode: "specs", hAlign: "left", dataType: "String",cellType:'tipsCell'},
             {headerName: "单位", headerWidth: 45, dataCode: "unit", hAlign: "center", dataType: "String"},
             {headerName: "类型", headerWidth: 45, dataCode: "short_name", hAlign: "center", dataType: "String"},
             {headerName: "市场价", headerWidth: 70, dataCode: "marketPrice", hAlign: "right", dataType: "Number",validator:"number"},//,decimalField:"glj.unitPrice"

+ 12 - 3
web/building_saas/main/js/views/glj_view.js

@@ -17,6 +17,8 @@ var gljOprObj = {
     selectedGLJClass: null,
     parentNodeIds: {},
     activeTab: '#linkGLJ',
+    rationTab:'#linkGLJ',
+    billsTab:'#linkJSCX',
     setting: {},
     detailSetting: {
         header: [
@@ -155,7 +157,7 @@ var gljOprObj = {
         function enterKeyAction(spd,sheeName) {
             let editRow = sheet.getActiveRowIndex(),orgCol = sheet.getActiveColumnIndex();
             let fieldID = me.setting.header[orgCol].dataCode;
-            if(me.setting.navigationRightCol.indexOf(fieldID) != -1){
+            if(sheeName=="ration_glj" && me.setting.navigationRightCol.indexOf(fieldID) != -1){
                 if(sheet.isEditing()) sheet.endEdit();
                 GC.Spread.Sheets.Commands.navigationRight.execute(spd,sheeName);
             }else {
@@ -608,8 +610,6 @@ var gljOprObj = {
         let ration_glj = this.sheetData[selected.row];
         return ration_glj;
     },
-
-
     getUnitPriceCodeMap : function () {//取单价文件中,编码前缀一样的映射表
         let codeMap = {};
         let priceMap = projectObj.project.projectGLJ.datas.unitPriceMap;
@@ -758,6 +758,7 @@ var gljOprObj = {
         return data;
 
     },
+
     getBasePrice:function (treeNode) {//造价书中的工料机修改的节点要用到
         let proGLJ =  projectObj.project.projectGLJ;
         let glj =_.find(proGLJ.datas.gljList, {'id': treeNode.data.projectGLJID});
@@ -1397,6 +1398,14 @@ var gljOprObj = {
     },
     isExtraType:function (type) {
         return _.includes(gljUtil.extraType,type)
+    },
+    setNodeShowTab:function () {
+        let node = projectObj.project.mainTree.selected;
+        if(node && node.sourceType==ModuleNames.ration){
+            gljOprObj.rationTab = gljOprObj.activeTab;
+        }else {
+            gljOprObj.billsTab = gljOprObj.activeTab;
+        }
     }
 }
 

+ 118 - 19
web/building_saas/main/js/views/locate_view.js

@@ -2,37 +2,136 @@
  * Created by zhang on 2018/11/16.
  */
 let locateObject={
+    bills_setting:{
+        header:[
+            {headerName: "编码", headerWidth: 120, dataCode: "code", dataType: "String"},
+            {headerName: "项目名称", headerWidth: 100, dataCode: "name", dataType: "String"},
+            {headerName: "单位", headerWidth: 50, dataCode: "unit", dataType: "String",hAlign: "center"},
+            {headerName: "工程量", headerWidth: 65, dataCode: "quantity", dataType: "Number", hAlign: "right"},
+            {headerName: "综合单价", headerWidth: 65, dataCode: "unitPrice", dataType: "Number", hAlign: "right"},
+            {headerName: "综合合价", headerWidth: 65, dataCode: "totalPrice", dataType: "Number", hAlign: "right"}
+        ],
+        view: {
+            lockColumns: [0,1,2,3,4,5],
+            colHeaderHeight:30
+        }
+    },
+    ration_setting:{
+        header:[
+            {headerName: "定额编码", headerWidth: 100, dataCode: "code", dataType: "String"},
+            {headerName: "定额名称", headerWidth: 180, dataCode: "name", dataType: "String"},
+            {headerName: "单位", headerWidth: 50, dataCode: "unit", dataType: "String",hAlign: "center"},
+            {headerName: "工程量", headerWidth: 65, dataCode: "quantity", dataType: "Number", hAlign: "right",decimalField: "ration.quantity"}
+        ],
+        view: {
+            lockColumns: [0,1,2,3],
+            colHeaderHeight:30
+        }
+    },
+    ration_glj_setting:{
+        header:[
+            {headerName: "编码", headerWidth: 120, dataCode: "code", dataType: "String"},
+            {headerName: "名称", headerWidth: 80, dataCode: "name", dataType: "String"},
+            {headerName: "规格型号", headerWidth: 80, dataCode: "code", dataType: "String"},
+            {headerName: "单位", headerWidth: 50, dataCode: "unit", dataType: "String",hAlign: "center"},
+            {headerName: "市场价", headerWidth: 65, dataCode: "marketPrice", dataType: "Number", hAlign: "right"}
+        ],
+        view: {
+            lockColumns: [0,1,2,3,4],
+            colHeaderHeight:30
+        }
+    },
+    initMainSpread:function(){
+        if(!this.mainSpread){
+            this.mainSpread = SheetDataHelper.createNewSpread($("#locate_result")[0],3);
+            sheetCommonObj.spreadDefaultStyle(this.mainSpread);
+            this.initMainSheet();
+        }else {
+            this.mainSpread.refresh();
+        }
+    },
+    initMainSheet:function () {
+       // this.mainSheet = this.mainSpread .getSheet(0);
+        //this.spread.bind(GC.Spread.Sheets.Events.ButtonClicked, this.onReplaceButtonClick);
+       //初始化清单表格
+        sheetCommonObj.initSheet(this.mainSpread .getSheet(0),this.bills_setting);
+        this.mainSpread .getSheet(0).setRowCount(0);
+        //初始化定额表格
+        sheetCommonObj.initSheet(this.mainSpread .getSheet(1),this.ration_setting);
+        this.mainSpread .getSheet(1).setRowCount(0);
 
-
+        //初始化人材机表格
+        sheetCommonObj.initSheet(this.mainSpread.getSheet(2),this.ration_glj_setting);
+        this.mainSpread .getSheet(2).setRowCount(0);
+    },
+    initSubSpread:function () {
+        if(!this.subSpread){
+            this.subSpread = SheetDataHelper.createNewSpread($("#locate_sub")[0]);
+            sheetCommonObj.spreadDefaultStyle(this.subSpread);
+            this.initSubSheet();
+        }else {
+            this.subSpread.refresh();
+        }
+    },
+    initSubSheet:function () {
+        this.subSheet = this.subSpread .getSheet(0);
+        sheetCommonObj.initSheet( this.subSheet, this.ration_setting);
+        this.subSheet.setRowCount(0);
+        //this.spread.bind(GC.Spread.Sheets.Events.ButtonClicked, this.onReplaceButtonClick);
+        this.subSheet.name('locate_sub');
+    },
+    showMainData:function () {
+        let datas = [];
+        //sheetCommonObj.showData(this.mainSheet,this.mainSettiong,datas);
+        this.mainSpread.getActiveSheet().setRowCount(datas.length);
+    },
     init:function () {
-        let tab_content = $('#locate').parent();
-        $('#locate_result').height(tab_content.height()*0.6);
-        $('#locate_sub').height(tab_content.height()*0.4);
-
+        let me = this;
+        let options = $("input[name='content_type']:checked").val();
+        let callback = function () {
+            let mainHeight = $(window).height()-$(".header").height()-$(".toolsbar").height()-$("#searchPanel").height();
+            let subHeight = 0;
+            if(options == "ration_glj"){
+                subHeight = mainHeight*0.4;
+                mainHeight = mainHeight*0.6;
+            }
+            console.log(mainHeight);
+            $('#locate_result').height(mainHeight);
+            $('#locate_sub').height(subHeight - 7);
+            me.initMainSpread();
+            me.initSubSpread();
+            me.showMainData();
+        };
+        options == "bills"?$("#outstandingOptions").show(0,callback):$("#outstandingOptions").hide(0,callback);
 
     },
+    findRecodes:function () {
 
+    },
     onshow:function () {
-
         locateObject.init();
-        console.log('#locate is now visible');
-        console.log($("#locate").is(':visible'))
     }
-
 }
 
 
+$("#locate_btn").click(function () {
+    locateObject.findRecodes();
+});
 
-
-/*
-$("input[name='install_setting_radios']").each(function(){
+$("input[name='content_type']").each(function(){
     $(this).click(function(){
-        var settingVal = $(this).val();
-        let installSetting = projectInfoObj.projectInfo.property.installSetting;
-        if(installSetting==settingVal){
-            return;
+        let optins = $(this).val();
+        switch (optins){
+            case "bills":
+                locateObject.mainSpread.setActiveSheetIndex(0);
+                break;
+            case "ration":
+                locateObject.mainSpread.setActiveSheetIndex(1);
+                break;
+            case "ration_glj":
+                locateObject.mainSpread.setActiveSheetIndex(2);
+                break;
         }
-        projectObj.project.installation_fee.updateInstallSetting(settingVal);
-        installationFeeObj.cleanPositionIfNeed(settingVal);
+        locateObject.init();
     });
-});*/
+});

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

@@ -434,14 +434,14 @@ let MainTreeCol = {
                     return '0.######';
                 default:
                     return '0';
-            }
-            ;
+            };
         }
     },
     getRationUnitTips:function (node) {
         let tips="";
         let ration_glj = projectObj.project.ration_glj;
         let gljList = gljOprObj.filterGljByRation(node.data, ration_glj.datas);
+        gljList = sortRationGLJ(gljList);
         for(let glj of gljList){
             tips += `${glj.code} ${glj.name}${glj.specs ? '&nbsp;&nbsp;&nbsp;' + glj.specs : ''}&nbsp;&nbsp&nbsp;${glj.unit}&nbsp;&nbsp;&nbsp;${glj.quantity}<br>`;
         }

+ 34 - 16
web/building_saas/main/js/views/project_view.js

@@ -183,6 +183,7 @@ var projectObj = {
     },
     checkFormulaValidField: function (editingText, colSetting) {
         let value = Number(editingText);
+        if(isNaN(value)) return value;
         if (!value) {
             try {
                 let exp = new Expression('');
@@ -976,7 +977,6 @@ var projectObj = {
                 if(!projectReadOnly){
                     that.loadMainSpreadContextMenu();
                 }
-                that.loadFocusLocation();
                 socketObject.connect();//连接socket服务器
                 let endTime = +new Date();
                 console.log(`其它时间——${endTime - endShowTime}`);
@@ -984,6 +984,7 @@ var projectObj = {
                 console.log(`时间——${endTime - startTime}`);
                 that.project.projectMarkChecking();//是否需要重新进行造价计算
                 autoFlashHeight();
+                that.loadFocusLocation();
                 projectObj.refreshMainSpread();
                 //定位到会话中的选项
                 let mainTabFocus = sessionStorage.getItem('mainTab') ? sessionStorage.getItem('mainTab') : '#tab_zaojiashu';
@@ -1507,18 +1508,11 @@ var projectObj = {
                         return selected.sourceType != ModuleNames.bills;
                     },
                     callback:function(){
-                        let selected = project.mainTree.selected;
-                        if (selected.data.name == undefined || selected.data.name == ''){
-                            hintBox.infoBox('系统提示','清单名称为空,无法生成块模板文件!', 1);
-                            return false;
-                        }
-                        else{
-                            if (!$("#kmbk").is(":visible")){
-                                $('#blockLibTab').click()
-                            };
+                        if (!$("#kmbk").is(":visible")){
+                            $('#blockLibTab').click()
+                        };
 
-                            $("#zujiamb").modal({show: true});
-                        }
+                        $("#zujiamb").modal({show: true});
                     },
                     visible: function(key, opt){
                         return G_SHOW_BLOCK_LIB;
@@ -2897,11 +2891,35 @@ $(function () {
 
     $("#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);
+        let selected = projectObj.project.mainTree.selected;
+
+        function createBlocks(aNode, categoryID){
+            function createBlock(node) {
+                if (node.data.name == undefined || node.data.name == '') return;  // 清单名称为空,不生成块模板文件
+                let name = node.data.code + ' ' + node.data.name + ' ' + node.data.unit;
+                name = name.replace(/^\s+|\s+$/g, "");    // 只去两头空格
+                blockLibObj.newNode(2, name, categoryID, node);
+            };
+
+            function createRecursion(node){
+                if (!node) return;
+
+                if (calcTools.isLeafBill(node)) createBlock(node);
+
+                if (node.firstChild()) createRecursion(node.firstChild());
+                if (node.nextSibling) createRecursion(node.nextSibling);
+            };
+
+            if (calcTools.isLeafBill(aNode))
+                createBlock(aNode)
+            else
+                createRecursion(aNode.firstChild());
+        };
+
+        createBlocks(selected, cID);
+        blockLibObj.loadDetailDatas(blockLibObj.mainTree.selected);
+        $("#zujiamb").modal("hide");
     });
 
 

+ 44 - 10
web/building_saas/main/js/views/sub_view.js

@@ -9,6 +9,7 @@
 
 let subSpread = null;
 let subObj = {
+    TZJNRrePercent:null,
     initSubSpread:function () {
         contentOprObj.buildSheet($("#jobSpread")[0]);
         //sheetCommonObj.bindEscKey(contentOprObj.workBook, [{sheet: contentOprObj.workBook.getSheet(0), editStarting: contentOprObj.onEditStart, editEnded: contentOprObj.onEditEnded}]);
@@ -73,14 +74,14 @@ let subObj = {
             installationFeeObj.engineeringTypeChecking();//检查是否安装工程
             $("#TZJNR_div").hide();
             $("#linkGLJ").addClass();
-            $("#linkGLJ").click();
+            $(gljOprObj.rationTab).click();
 
         }else {
             $("#GLJ_div").hide();
             $("#ZMHS_div").hide();
             $("#AZZJF_div").hide();
             $("#TZJNR_div").show();
-            $("#linkJSCX").click();
+            $(gljOprObj.billsTab).click();
         }
         projectObj.mainSpread.focus();
     }
@@ -98,12 +99,10 @@ $("#linkGLJ").click(function(){
     refreshSubSpread();
     subSpread.setActiveSheetIndex(0);
     gljOprObj.activeTab='#linkGLJ';
+    gljOprObj.setNodeShowTab();
 });
 
 
-
-
-
 $("#linkAZZJF").click(function(){
     $("#subItems").children().hide();
     MaterialController.hideReplaceDiv();
@@ -112,6 +111,7 @@ $("#linkAZZJF").click(function(){
     refreshSubSpread();
     subSpread.setActiveSheetIndex(3);
     gljOprObj.activeTab='#linkAZZJF';
+    gljOprObj.setNodeShowTab();
 });
 
 $("#linkGCLMX").click(function(){
@@ -123,6 +123,7 @@ $("#linkGCLMX").click(function(){
     refreshSubSpread();
     subSpread.setActiveSheetIndex(1);
     gljOprObj.activeTab='#linkGCLMX';
+    gljOprObj.setNodeShowTab();
 });
 
 $("#linkJSCX").click(function(){        // 计算程序
@@ -139,6 +140,7 @@ $("#linkJSCX").click(function(){        // 计算程序
     let sel = projectObj.mainController.tree.selected;
     calcProgramObj.refreshCalcProgram(sel, 3);
     gljOprObj.activeTab='#linkJSCX';
+    gljOprObj.setNodeShowTab();
 });
 
 
@@ -150,25 +152,42 @@ $("#linkZMHS").click(function(){        // 子目换算
     refreshSubSpread();
 
     gljOprObj.activeTab='#linkZMHS';
+    gljOprObj.setNodeShowTab();
 });
 //特征及内容各模块宽度自适应
 function adaptiveTzjnrWidth() {
     if(gljOprObj.activeTab !== '#linkTZJNR'){
         return;
     }
+    let job_proportion = 0.25;
+    let item_proportion = 0.75;
+    if(subObj.TZJNRrePercent){
+        job_proportion = parseFloat(subObj.TZJNRrePercent.nearPercent)/100;
+        item_proportion = 1- job_proportion;
+    }
+
     //排版规则工具条宽度
     const typeSettingWidth = 30;
-    let tzjnrWidth = $('#tzjnrCon').width() + 30;
+    let tzjnrWidth = $('#tabCon').width();
+    console.log("set jobDiv");
+    console.log(subObj.TZJNRrePercent);
     //let tzjnrWidth = $(window).width() - $('.main-nav').width() - $('.main-side').width();
-    if($('#add-rule').is(':visible')){
-        $('#jobDiv').css('width', tzjnrWidth / 3);
-        $('#itemDiv').css('width', tzjnrWidth / 3);
+    //2018-11-23 zhang 需求两个表格默认占比为25%:75%  还要可拖动
+    let extWidth = $('#add-rule').is(':visible')? tzjnrWidth / 3:typeSettingWidth;
+    let totalWidth = tzjnrWidth - extWidth - $('#TZJNRResize').width();
+    $('#jobDiv').css('width', totalWidth*job_proportion);
+    $('#itemDiv').css('width', totalWidth*item_proportion);
+    $('#add-rule').is(':visible')?$('#add-rule').css('width', extWidth): $('#openTypeSetting').css('width', extWidth);
+  /*  if($('#add-rule').is(':visible')){
+        let totalWidth = tzjnrWidth - tzjnrWidth / 3;
+        $('#jobDiv').css('width', totalWidth*0.25);
+        $('#itemDiv').css('width', totalWidth*0.75);
         $('#add-rule').css('width', tzjnrWidth / 3);
     } else{
         $('#jobDiv').css('width', tzjnrWidth / 2);
         $('#itemDiv').css('width', tzjnrWidth / 2 - typeSettingWidth);
         $('#openTypeSetting').css('width', typeSettingWidth);
-    }
+    }*/
     pageCCOprObj.resizeWidth();
     refreshSubSpread();
 }
@@ -190,6 +209,7 @@ $("#linkTZJNR").click(function () {
     }
     pageCCOprObj.mainActiveCell = projectObj.mainSpread.getActiveSheet().getSelections()[0];
     pageCCOprObj.setCacheAndShow(selectedNode);
+    gljOprObj.setNodeShowTab();
 });
 //打开排版规则
 $('#openTypeSetting').click(function () {
@@ -578,3 +598,17 @@ $('#linkGCLMX').on('shown.bs.tab', function () {
 $('#linkAZZJF').on('shown.bs.tab', function () {
     gljOprObj.showDataIfRationSelect(projectObj.project.mainTree.selected, '111111');
 });
+
+let TZJNR_sideResizeEles = {};
+TZJNR_sideResizeEles.id = 'linkTZJNR';
+TZJNR_sideResizeEles.resize = $('#TZJNRResize');
+TZJNR_sideResizeEles.nearElement = $('#jobDiv');
+TZJNR_sideResizeEles.nearSpread = $('#jobSpread');
+TZJNR_sideResizeEles.farElement = $('#itemDiv');
+TZJNR_sideResizeEles.farSpread = $('#itemSpread');
+TZJNR_sideResizeEles.nav = null;
+slideResize(TZJNR_sideResizeEles, {min: 100, max: $('#tabCon').width() - 30,no_proportion:true}, 'width', function(rePercent){
+    if(rePercent) subObj.TZJNRrePercent = rePercent;
+    adaptiveTzjnrWidth();
+    refreshSubSpread();
+});

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

@@ -219,7 +219,7 @@ let zmhs_obj = {
         let me = zmhs_obj;
         let height = cellRect.height;
         let offect = 0;
-        let newString = "<form style='margin-top:1px' ><table  width='100%'  cellpadding='0'  border='1px' bordercolor='#CCCCCC' cellspacing='0px' style='border-collapse:collapse;font-size: 10px;'>";
+        let newString = "<form style='margin-top:1px' ><table  width='100%'  cellpadding='0'  border='1px' bordercolor='#CCCCCC' cellspacing='0px' style='border-collapse:collapse;'>";
         let cus_coe =  me.coeSheetData[context.row];
         if(cus_coe){
             for(let i =0;i< cus_coe.coes.length;i++){