浏览代码

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

TonyKang 7 年之前
父节点
当前提交
50a32d286d

+ 1 - 1
modules/all_models/ration.js

@@ -55,7 +55,7 @@ let rationSchema = new Schema({
     rationAssList: [rationAssItemSchema],
     content: String,                            // 工作内容
     ruleText: String,                            // 计算规则
-    prefix: {type: Number, default: 0},                              //定额是补充、借用时用 1 complementary 2 borrow
+    prefix: {type: String, default: ''},                              //定额是补充、借用时用  补 借
 
     //工料机特有属性
     projectGLJID:Number,  //项目工料机ID

+ 6 - 6
modules/main/facade/ration_facade.js

@@ -80,13 +80,13 @@ async function insertNewRation(newData,firstLibID,std,calQuantity) {//插入新
             newData.comments = std.chapter.explanation;
             newData.ruleText = std.chapter.ruleText;
         }
-        newData.prefix = 0;
+        newData.prefix = '';
         newData.from = std.type === 'complementary' ? 'cpt' : 'std';
         if(firstLibID !== std.rationRepId){//借
-            newData.prefix = 2;
+            newData.prefix = '借';
         }
         else if(std.rationRepId === firstLibID && newData.from === 'cpt') {
-            newData.prefix = 1;
+            newData.prefix = '补';
         }
         newData.programID = std.feeType;
         newData.rationAssList =  createRationAss(std);
@@ -317,13 +317,13 @@ async function  updateRation(std,firstLibID,rationID,billsItemID,projectID,calQu
     }
     ration.from = std.type === 'complementary' ? 'cpt' : 'std';
     //定额前缀 none:0, complementary:1, borrow: 2
-    ration.prefix = 0;
+    ration.prefix = '';
     //借用优先级比补充高
     if(std.rationRepId !== parseInt(firstLibID)){//借用
-        ration.prefix = 2;
+        ration.prefix = '借';
     }
     else if(std.rationRepId === firstLibID && ration.from === 'cpt') {
-        ration.prefix = 1;
+        ration.prefix = '补';
     }
     ration.programID = std.feeType;
     ration.rationAssList = createRationAss(std);//生成辅助定额

+ 9 - 0
public/web/id_tree.js

@@ -679,6 +679,15 @@ var idTree = {
             }
             return data;
         };
+        //非叶子节点默认收起展开
+        Tree.prototype.setRootExpanded = function(nodes, expanded){
+            for(let node of nodes){
+                if(node.children.length > 0){
+                    node.setExpanded(expanded);
+                    this.setRootExpanded(node.children, expanded);
+                }
+            }
+        };
 
         /*Tree.prototype.editedData = function (field, id, newText) {
             var node = this.findNode(id), result = {allow: false, nodes: []};

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

@@ -10,7 +10,7 @@ label.title{
 
 
 div.resize{
-    height: 4px;
+    height: 6px;
     background: #f7f7f9;
     width: 100%;
     cursor: s-resize;

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

@@ -8,8 +8,11 @@ function autoFlashHeight(){
     let gljBottomContentHeight = $("#project-glj-main .bottom-content").height();
     let toolsBarHeightQ = $(".tools-bar-height-q").height();
     let toolsBarHeightD = $(".tools-bar-height-d").height();
-    $(".main-data-side-q").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightQ-302);
-    $(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-302);
+    //$(".main-data-side-q").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightQ-302);
+    $(".main-data-side-q").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightQ-$('#qd').find('.bottom-content').find('.p-0').height()-5);
+    //$(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-302);
+    $(".main-data-side-d").height($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightD-$('#stdSectionRations').height()-5);
+    $('.main-content').width($(window).width()-$('.main-nav').width()-$('.main-side').width()-5);
     //$("#main .main-data-top").height($(window).height()-headerHeight-toolsbarHeight-bottomContentHeight-1);
     $("#billsSpread").height($(window).height()-headerHeight-toolsbarHeight-mainBottomContentHeight-1);
     $("#project_glj_sheet").height($(window).height()-headerHeight-toolsbarHeight-gljBottomContentHeight-25);

+ 15 - 12
web/building_saas/main/html/main.html

@@ -101,7 +101,8 @@
               </div>
               <div class="container-fluid">
                   <div class="row">
-                      <div class="main-content col-lg-12 p-0" id="main">
+                      <!--col-lg-12 p-0-->
+                      <div class="main-content" style="width: 100%; display: inline-block" id="main">
                           <div class="top-content">
                               <div class="main-data-top" id="billsSpread"></div>
                           </div>
@@ -209,9 +210,9 @@
                               </div>
                           </div>
                       </div>
-                      <div class="main-side col-lg-0 p-0">
-                          <div class="resize col-lg-0 p-0"></div>
-                          <div class="tab-content">
+                      <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="tab-content" style="width: 99%; height: 100%; float: left">
                               <!--清单规则-->
                               <div class="tab-pane" id="qd">
                                   <div class="tools-bar-height-q container-fluid">
@@ -234,9 +235,11 @@
                                           </div>
                                       </div>
                                   </div>
-                                  <div class="main-data-side-q" id="stdBillsSpread">
+                                  <div class="top-content">
+                                      <div class="main-data-side-q" id="stdBillsSpread"></div>
                                   </div>
-                                  <div class="sidebar-bottom container-fluid">
+                                  <div class="resize" id="qdResize" style="background: #F1F1F1"></div>
+                                  <div class="bottom-content">
                                       <div class="row" id="stdBillsJobTab">
                                           <div class="col-lg-6 p-0" id="stdBillsJobs"></div>
                                           <div class="col-lg-6 p-0" id="stdBillsFeatures"></div>
@@ -265,13 +268,13 @@
                                           </div>
                                       </div>
                                   </div>
-                                  <div class="main-data-side-d" id="stdRationChapter">
+                                  <div class="top-content" style="overflow: hidden">
+                                      <div class="main-data-side-d" id="stdRationChapter">
                                   </div>
-                                  <div class="resize" style="background: #F1F1F1"></div>
-                                  <div class="sidebar-bottom container-fluid">
-                                      <div class="row">
-                                          <div class="col-lg-12 p-0" id="stdSectionRations"></div>
-                                      </div>
+                                  </div>
+                                  <div class="resize" id="deResize" style="background: #F1F1F1"></div>
+                                  <div class="bottom-content">
+                                      <div class="main-data-bottom" id="stdSectionRations"></div>
                                   </div>
                               </div>
                           </div>

+ 95 - 56
web/building_saas/main/js/main.js

@@ -4,9 +4,18 @@
 
 $(function () {
     // 读取本地存储的高度(必须放在载入spread之前)
-    loadSize("main", function() {
+    let mainResizeEles = {};
+    mainResizeEles.id = '#main';
+    mainResizeEles.resize = $('#main').find('.resize');
+    mainResizeEles.nearElement = $('#main').find('.top-content');
+    mainResizeEles.nearSpread = mainResizeEles.nearElement.children(".main-data-top");
+    mainResizeEles.farElement = $('#main').find('.bottom-content');
+    mainResizeEles.farSpread = mainResizeEles.farElement.children().find(".main-data-bottom");
+    mainResizeEles.nav = mainResizeEles.farElement.children('ul.nav');
+    loadSize(mainResizeEles, 'height', function() {
         refreshSubSpread();
     });
+
     $("#header-menu").removeAttr('style');
     projectInfoObj.showProjectInfo();
     projectObj.checkMainSpread();
@@ -23,13 +32,9 @@ $(function () {
         $(gljOprObj.activeTab).addClass('active');
         autoFlashHeight();
         projectObj.refreshMainSpread();
-        /*loadSize("main", function() {
-            projectObj.refreshMainSpread();
-            refreshSubSpread();
-        });*/
     });
 
-    slideResize($("#main"), function() {
+    slideResize(mainResizeEles, {min: 170, max: 700}, 'height', function() {
         projectObj.mainSpread.refresh();
         refreshSubSpread();
     });
@@ -47,49 +52,66 @@ $(function () {
 /**
  * 拖动更改div大小
  *
- * @param {Object} rootElement - 最顶层div
+ * @param {Object} eles - id:存储本地的标记 resize:拖动条 nearElement:左上外层div nearSpread:左上spread farElement:右下外层div evFixedSize:造价书左右拖动用
+ * @param {Object} limit - min/max
+ * @param {String} type - height/width
  * @param {function} callback - 成功后执行
  * @return {void}
  */
-function slideResize(rootElement, callback) {
-    let startY = 0;
+function slideResize(eles, limit, type, callback) {
+    if(type !== 'height' && type !== 'width'){
+        return;
+    }
+    //nearElement:左上, farElement:右下
+    let startP = 0;
     let drag = false;
-    const element = rootElement.find('.resize');
-    const topContentEle = rootElement.find(".top-content");
-    const bottomContentEle = rootElement.find(".bottom-content");
-    let topContentHeight = 0;
-    let bottomContentHeight = 0;
-    let navHeight = 0;
-    let topChangeHeight = 0;
-    let bottomChangeHeight = 0;
+    const resizeElement = eles.resize;
+    const nElement = eles.nearElement;
+    const fElement = eles.farElement;
+    const navContentEle = eles.nav ? eles.nav : null;
+    let nEleSize = 0;
+    let fEleSize = 0;
+    let navSize = 0;
+    let nEleChangeSize = 0;
+    let fEleChangeSize = 0;
 
     // 鼠标点下时
-    element.mousedown(function(e) {
+    resizeElement.mousedown(function(e) {
         drag = true;
-        startY = e.clientY;
-        // 获取上部分的高度
-        topContentHeight = topContentEle.height();
-        // 获取下部分的高度
-        bottomContentHeight = bottomContentEle.height();
-        // nav高度部分
-        navHeight = bottomContentEle.children('ul.nav').height() + 4;
-        element.tooltip('hide');
+        startP = type === 'height' ? e.clientY : e.clientX;
+        // 获取左(上)部分的宽度(高度)
+        nEleSize = nElement[type]();
+        // 获取右(下)部分的宽度(高度)
+        fEleSize = fElement[type]();
+        // nav宽(高度)部分
+        if(navContentEle){
+            navSize = navContentEle[type]() + 4;
+        }
+        resizeElement.tooltip('hide');
     });
 
     // 鼠标移动
     $("body").mousemove(function(e) {
         if (drag) {
-            let moveHeight = e.clientY - startY;
+            let moveSize = type === 'height' ? e.clientY - startP : e.clientX - startP;
             // 判断拖动范围不能超出
-            topChangeHeight = topContentHeight + moveHeight;
-            topChangeHeight = topChangeHeight < 170 ? 170 : topChangeHeight;
-            topChangeHeight = topChangeHeight > 700 ? 709 : topChangeHeight;
-            topContentEle.children(".main-data-top").height(topChangeHeight);
+            nEleChangeSize = nEleSize + moveSize;
+            nEleChangeSize = nEleChangeSize < limit.min ? limit.min : nEleChangeSize;
+            nEleChangeSize = nEleChangeSize > limit.max ? limit.max + 9 : nEleChangeSize;
 
-            bottomChangeHeight = bottomContentHeight - moveHeight;
-            bottomChangeHeight = bottomChangeHeight < 170 ? 170 : bottomChangeHeight;
-            bottomChangeHeight = bottomChangeHeight > 700 ? 709 : bottomChangeHeight;
-            bottomContentEle.children().find(".main-data-bottom").height(bottomChangeHeight - navHeight);
+            fEleChangeSize = fEleSize - moveSize;
+            fEleChangeSize = fEleChangeSize < limit.min ? limit.min : fEleChangeSize;
+            fEleChangeSize = fEleChangeSize > limit.max ? limit.max + 9 : fEleChangeSize;
+
+            if(type === 'width'){
+                let rePercent = getResizeWidthPercent(nEleChangeSize, fEleChangeSize);
+                eles.nearElement.css(type, rePercent.nearPercent);
+                eles.farElement.css(type, rePercent.farPercent);
+            }
+            else{
+                eles.nearSpread[type](nEleChangeSize);
+                eles.farSpread[type](fEleChangeSize - navSize);
+            }
         }
     });
 
@@ -99,11 +121,11 @@ function slideResize(rootElement, callback) {
             callback();
             drag = false;
             // 存入本地缓存
-            const id = rootElement.attr('id');
-            topChangeHeight = topChangeHeight >= 700 ? 709 : topChangeHeight;
-            bottomChangeHeight = bottomChangeHeight >= 700 ? 709 : bottomChangeHeight;
-            setLocalCache('topHeight:' + id, topChangeHeight);
-            setLocalCache('bottomHeight:' + id, bottomChangeHeight);
+            const id = eles.id;
+            nEleChangeSize = nEleChangeSize >= limit.max ? limit.max + 9  : nEleChangeSize;
+            fEleChangeSize = fEleChangeSize >= limit.max ? limit.max + 9  : fEleChangeSize;
+            setLocalCache(`near${type}:${id}`, nEleChangeSize);
+            setLocalCache(`far${type}:${id}`, fEleChangeSize);
         }
     });
 }
@@ -115,25 +137,42 @@ function slideResize(rootElement, callback) {
  * @param {function} callback - 回调函数
  * @return {void}
  */
-function loadSize(tag, callback) {
+
+function loadSize(eles, type, callback) {
+    let tag = eles.id;
     if (tag === '') {
         return;
     }
-    let o_topHeight = $("#"+ tag +" .main-data-top").height();
-    let o_bottomHeight = $("#"+ tag +" .main-data-bottom").height();
-    let topHeight = getLocalCache('topHeight:' + tag);
-    let bottomHeight = getLocalCache('bottomHeight:' + tag);
-    if (topHeight === null || bottomHeight === null) {
-        $("#"+ tag +" .main-data-top").height(o_topHeight);
-        $("#"+ tag +" .main-data-bottom").height(o_bottomHeight);
+    if(type !== 'height' && type !== 'width'){
+        return;
+    }
+    let o_nearSize = eles.nearSpread[type]();
+    let o_farSize = eles.farSpread[type]();
+    let nearSize = getLocalCache(`near${type}:${tag}`);
+    let farSize = getLocalCache(`far${type}:${tag}`);
+    if (nearSize === null || farSize === null) {
+        eles.nearSpread[type](o_nearSize);
+        eles.farSpread[type](o_farSize);
     }else {
-        const navHeight = $("#"+ tag +" .bottom-content").children('ul.nav').height() + 4;
-        topHeight = parseFloat(topHeight);
-        bottomHeight = parseFloat(bottomHeight);
-        $("#"+ tag +" .main-data-top").height(topHeight);
-        $("#"+ tag +" .main-data-bottom").height(bottomHeight - navHeight);
+        nearSize = parseFloat(nearSize);
+        farSize = parseFloat(farSize);
+        if(type !== 'width') {
+            const navSize = eles.nav ? eles.nav[type]() + 4 : 0;
+            eles.nearSpread[type](nearSize);
+            eles.farSpread[type](farSize - navSize);
+        }
+    }
+    if(type === 'width'){//使用百分比
+        let rePercent = getResizeWidthPercent(nearSize ? nearSize : o_nearSize, farSize ? farSize : o_farSize);
+        eles.nearElement.css(type, rePercent.nearPercent);
+        eles.farElement.css(type, rePercent.farPercent);
     }
-
-    // $("#"+ tag +" .bottom-content").height(bottomHeight);
     callback();
-}
+}
+
+function getResizeWidthPercent(nearSize, farSize){
+    const resizeWidth = 6;
+    let nearPercent = (nearSize / (resizeWidth + nearSize + farSize) * 100) + '%';
+    let farPercent = (farSize / (resizeWidth + nearSize + farSize) * 100) + '%';
+    return {nearPercent, farPercent};
+}

+ 7 - 3
web/building_saas/main/js/models/main_consts.js

@@ -159,9 +159,13 @@ const rationType = {
     install:4
 };
 const rationPrefix = { //定额前缀,补/借
-    none: 0,
-    complementary: 1,
-    borrow: 2
+    none: '',
+    complementary: '补',
+    borrow: '借'
+};
+const rationFrom = {
+    std: 'std',
+    cpt: 'cpt'
 };
 const leafBillGetFeeType = {
     rationContent: 0,

+ 12 - 1
web/building_saas/main/js/models/ration.js

@@ -417,7 +417,7 @@ var Ration = {
                    }
                 }
                 project.projectGLJ.loadData(function () {
-                    gljOprObj.showDataIfRationSelect(projectObj.project.mainTree.selected);
+                    gljOprObj.showDataIfRationSelect(projectObj.project.mainTree.selected,"-111111111");//这里第二个参数是为了使改前和改后selectedID不一样,删除了的话下方的定额工料机不会刷新
                     project.calcProgram.calcRationsAndSave(refershNodes);
                     projectObj.mainController.refreshTreeNode(refershNodes, true);
                     $.bootstrapLoading.end();
@@ -630,6 +630,17 @@ var Ration = {
                 return 0;
             }
         } ;
+        //获取定额前缀
+        ration.prototype.getRationPrefix = function(firstLibID, ration){
+            if(firstLibID !== ration.libID){
+                return rationPrefix.borrow;
+            }
+            if(ration.from && ration.from === rationFrom.cpt){
+                return rationPrefix.complementary;
+            }
+            return rationPrefix.none;
+        };
+
         return new ration(project);
     }
 };

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

@@ -43,15 +43,9 @@ let MainTreeCol = {
         },
         code: function (node) {
             if(node.sourceType === projectObj.project.Ration.getSourceType() && node.data.type === rationType.ration
-                && isDef(node.data.code) && isDef(node.data.prefix)){
-                if(node.data.prefix === rationPrefix.complementary){
-                    return '补' +  node.data.code.replace(new RegExp('补'), '');
-                }
-                if(node.data.prefix === rationPrefix.borrow){
-                    return '借' +  node.data.code.replace(new RegExp('借'), '');
-                }
+                && isDef(node.data.code) && isDef(node.data.prefix) && node.data.prefix !== ''){
+                return node.data.prefix + node.data.code.replace(new RegExp(node.data.prefix, 'g'), '');
             }
-
             return isDef(node.data.code) ? node.data.code : '';
         },
         marketPrice:function (node) {

+ 13 - 5
web/building_saas/main/js/views/project_glj_view.js

@@ -496,6 +496,18 @@ projectGljObject={
 
 
 $(function () {
+    let pojGljResizeEles = {};
+    pojGljResizeEles.id = '#project-glj-main';
+    pojGljResizeEles.resize = $('#project-glj-main').find('.resize');
+    pojGljResizeEles.nearElement = $('#project-glj-main').find('.top-content');
+    pojGljResizeEles.nearSpread = pojGljResizeEles.nearElement.children(".main-data-top");
+    pojGljResizeEles.farElement = $('#project-glj-main').find('.bottom-content');
+    pojGljResizeEles.farSpread = pojGljResizeEles.farElement.children().find(".main-data-bottom");
+    pojGljResizeEles.nav = pojGljResizeEles.farElement.children('ul.nav');
+    slideResize(pojGljResizeEles, {min: 170, max: 700}, 'height', function () {
+        projectGljObject.projectGljSpread.refresh();
+        projectGljObject.mixRatioSpread?projectGljObject.mixRatioSpread.refresh():'';
+    });
     $('#tab_project_glj').on('shown.bs.tab', function (e) {
         let me = projectGljObject;
         $(e.relatedTarget.hash).removeClass('active');
@@ -505,7 +517,7 @@ $(function () {
         me.unitPriceFileInit();
         //projectObj.project.projectGLJ.calcQuantity(); 在工程量有更新的地方调用
         me.showProjectGljData();
-        loadSize("project-glj-main", function () {
+        loadSize(pojGljResizeEles, 'height', function () {
             me.projectGljSpread.refresh();
             me.mixRatioSpread?me.mixRatioSpread.refresh():'';
         });
@@ -527,10 +539,6 @@ $(function () {
         me.showProjectGljData();
         me.initMixRatio();
     });
-    slideResize($("#project-glj-main"), function () {
-        projectGljObject.projectGljSpread.refresh();
-        projectGljObject.mixRatioSpread?projectGljObject.mixRatioSpread.refresh():'';
-    });
     $('#pop-used-list').popover({
             placement: "bottom",
             html: true,

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

@@ -364,6 +364,9 @@ var projectObj = {
         if (node.sourceType === project.Bills.getSourceType()) {
             this.updateBillsCode(node, value);   // 新清单不适合实时计算,下面套什么还不能确定,无数量计算也无意义
         } else if (node.sourceType === project.Ration.getSourceType()) {
+            if(value && typeof(value) == 'string'){//小写转换成大写
+                value = value.toUpperCase();
+            }
             project.Ration.updateRationCodes([{'node':node,value:value}]);
           //  this.updateRationCode(node, value);  // 新套定额适合实时计算
             // 这里因异步问题暂时缺少工料机价格。该过程移到:ration_glj.js的refreshAfterSave方法中。
@@ -921,7 +924,39 @@ var projectObj = {
                     callback: function () {
                         project.calcProgram.calcAllNodesAndSave();
                     }
-                }
+                }/*,
+                "spr2":'--------',
+                "copyBlock": {
+                    name: '复制整块',
+                    icon: 'fa-copy',
+                    disabled: function () {
+                        let selected = project.mainTree.selected;
+                        if(selected.sourceType == project.Bills.getSourceType() && selected.data.type == billType.DXFY){//焦点行是大项费用则无效;
+                            return true;
+                        }
+                        if(selected.sourceType == project.ration_glj.getSourceType()){// 焦点行是定额下的主材设备则无效;
+                            return true;
+                        }
+                        return false;
+                    },
+                    callback: function () {
+                        $.bootstrapLoading.start();
+                        let selected = project.mainTree.selected;
+                        setTimeout(function () {
+                            BlockController.copyBlock(selected);
+                            $.bootstrapLoading.end();
+                        },100)
+
+                    }
+                },
+                "spr2":'--------',
+                "pasteBlock": {
+                    name: '粘贴整块',
+                    icon: 'fa-paste',
+                    callback: function () {
+
+                    }
+                }*/
             }
         });
     },
@@ -1830,6 +1865,4 @@ $(function () {
             spread?spread.focus():'';
         }
     }
-
-
 });

+ 77 - 15
web/building_saas/main/js/views/side_tools.js

@@ -1,20 +1,85 @@
 /**
  * Created by Mai on 2017/6/16.
  */
+//造价书与清单定额库左右拖动
+let sideResizeEles = {};
+sideResizeEles.id = 'stdRationTab';
+sideResizeEles.resize = $('#sideResize');
+sideResizeEles.evFixedSize = `$(window).width()-$('.main-nav').width()-5`;
+sideResizeEles.nearElement = $('.main-content');
+sideResizeEles.nearSpread = $('.main-content');
+sideResizeEles.farElement = $('.main-side');
+sideResizeEles.farSpread = $('.main-side');
+sideResizeEles.nav = null;
+slideResize(sideResizeEles, {min: 250, max: $('#zaojiashu').width()-260}, 'width', function(){
+    projectObj.refreshMainSpread();
+    refreshSubSpread();
+    if(sideResizeEles.id === 'stdRationTab'){
+        rationLibObj.refreshSpread();
+    }
+    else{
+        billsLibObj.refreshBillsSpread();
+        billsLibObj.refreshBillsRelaSpread();
+    }
+});
+//定额库上下拖动
+let rationLibResizeEles = {};
+rationLibResizeEles.id = '#de';
+rationLibResizeEles.resize = $('#deResize');
+rationLibResizeEles.nearElement = $('#de').find('.top-content');
+rationLibResizeEles.nearSpread = $('#stdRationChapter');
+rationLibResizeEles.farElement = $('#de').find('.bottom-content');
+rationLibResizeEles.farSpread = $('#stdSectionRations');
+rationLibResizeEles.nav = null;
+slideResize(rationLibResizeEles, {min: 147, max: 680}, 'height', function() {
+    rationLibObj.refreshSpread();
+});
+
+//清单库上下拖动
+let billsLibResizeEles = {};
+billsLibResizeEles.id = '#qd';
+billsLibResizeEles.resize = $('#qdResize');
+billsLibResizeEles.nearElement = $('#qd').find('.top-content');
+billsLibResizeEles.nearSpread = $('#stdBillsSpread');
+billsLibResizeEles.farElement = $('#qd').find('.bottom-content');
+billsLibResizeEles.farSpread = billsLibResizeEles.farElement.find('.p-0');
+billsLibResizeEles.nav = null;
+slideResize(billsLibResizeEles, {min: 147, max: 680}, 'height', function() {
+    billsLibObj.refreshBillsSpread();
+    billsLibObj.refreshBillsRelaSpread();
+});
+
 
 var sideToolsObj = {
-    showSideTools: function (show) {
-        var main = $('.main-content'), side = $('.main-side');
+    showSideTools: function (tabPanel, show, id) {
+        sideResizeEles.id = id;
         if (show) {
-            main.removeClass('col-lg-12');
-            main.addClass('col-lg-8');
-            side.removeClass('col-lg-0');
-            side.addClass('col-lg-4');
+            sideResizeEles.nearElement.css('width', '66.666667%');
+            sideResizeEles.farElement.css('width', '33.333333%');
+            $('.main-side .tab-pane').hide();
+            tabPanel.show();
+            loadSize(sideResizeEles, 'width', function(){
+                refreshSubSpread();
+                if(id === 'stdRationTab'){//定额库
+                    autoFlashHeight();
+                    loadSize(rationLibResizeEles, 'height', function(){
+                        rationLibObj.refreshSpread();;//subSpread、jobSpread、itemSpread显示问题
+                    });
+                }
+                else{//清单库
+                    loadSize(billsLibResizeEles, 'height', function(){
+                        autoFlashHeight();
+                        billsLibObj.refreshBillsSpread();
+                        billsLibObj.refreshBillsRelaSpread();
+                    });
+                }
+            });
+
         } else {
-            main.removeClass('col-lg-8');
-            main.addClass('col-lg-12');
-            side.removeClass('col-lg-4');
-            side.addClass('col-lg-0');
+            sideResizeEles.nearElement.css('width', '100%');
+            sideResizeEles.farElement.css('width', '0%');
+            tabPanel.hide();
+            refreshSubSpread();
         }
     }
 };
@@ -24,13 +89,10 @@ $('.side-tabs ul li a').bind('click', function () {
     if (!tab.hasClass('active')) {
         $('.side-tabs ul li a').removeClass('active');
         tab.addClass('active');
-        sideToolsObj.showSideTools(tab.hasClass('active'));
-        $('.main-side .tab-pane').hide();
-        tabPanel.show();
+        sideToolsObj.showSideTools(tabPanel, tab.hasClass('active'), tab.attr('id'));
     } else {
         tab.removeClass('active');
-        sideToolsObj.showSideTools(tab.hasClass('active'));
-        tabPanel.hide();
+        sideToolsObj.showSideTools(tabPanel, tab.hasClass('active'), tab.attr('id'));
     }
     projectObj.refreshMainSpread();
 });

+ 10 - 6
web/building_saas/main/js/views/std_bills_lib.js

@@ -165,10 +165,9 @@ var billsLibObj = {
         CommonAjax.post('/stdBillsEditor/getBills', {userId: userID, billsLibId: stdBillsLibID}, function (datas) {
             stdBills = datas;
             stdBillsTree.loadDatas(stdBills);
-            //第一层默认收起
-            for(let root of stdBillsTree.roots){
-                root.setExpanded(false);
-            }
+            //非叶子节点默认收起
+            stdBillsTree.setRootExpanded(stdBillsTree.roots, false);
+
             stdBillsTreeController.showTreeData();
             billsLibObj.setTagForHint(datas);
             showBillsRela(stdBillsTree.firstNode());
@@ -397,10 +396,15 @@ function addEventOnResize(fn){
     }
 }
 addEventOnResize(billsLibObj.refreshSettingForHint);
+//赋初始高度
+if($('#stdBillsSpread').height() === 0 || $('#qd').find('.bottom-content').height() === 0){
+    $('#stdBillsSpread').height($(window).height()-$(".header").height()-$(".toolsbar").height()-$(".tools-bar-height-q").height()-312);
+    $('#qd').find('.bottom-content').find('.p-0').height(270);
+}
 
 $('#stdBillsTab').bind('click', function () {
     refreshSubSpread();//subSpread、jobSpread、itemSpread显示问题
-    $(".main-data-side-q").height($(window).height() - $(".header").height() - $(".toolsbar").height() -  $(".tools-bar-height-q").height() - 202);
+    //$(".main-data-side-q").height($(window).height() - $(".header").height() - $(".toolsbar").height() -  $(".tools-bar-height-q").height() - 202);
     var select = $('#stdBillsLibSelect');
     billsLibObj.refreshBillsSpread();
     billsLibObj.refreshBillsRelaSpread();
@@ -411,7 +415,7 @@ $('#stdBillsTab').bind('click', function () {
 });
 $('#stdBillsLibSelect').change(function () {
     $('#stdBillsSearchResult').hide();
-    $(".main-data-side-q").height($(window).height() - $(".header").height() - $(".toolsbar").height() -  $(".tools-bar-height-q").height() - 202);
+    //$(".main-data-side-q").height($(window).height() - $(".header").height() - $(".toolsbar").height() -  $(".tools-bar-height-q").height() - 202);
     billsLibObj.clearHighLight(billsLibObj.stdBillsSpread);
 
     var select = $(this);

+ 10 - 10
web/building_saas/main/js/views/std_ration_lib.js

@@ -50,10 +50,8 @@ var rationLibObj = {
             that.tree = rationChapterTree;
             var rationChapterTreeController = TREE_SHEET_CONTROLLER.createNew(rationChapterTree, that.rationChapterSpread.getActiveSheet(), that.rationChapterTreeSetting);
             rationChapterTree.loadDatas(datas);
-            //第一层默认收起
-            for(let root of that.tree.roots){
-                root.setExpanded(false);
-            }
+            //非叶子节点默认收起
+            that.tree.setRootExpanded(that.tree.roots, false);
             rationChapterTreeController.showTreeData();
 
             rationChapterTreeController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, function (node) {
@@ -75,8 +73,6 @@ var rationLibObj = {
     },
     //双击隐藏显示
     onChapterSpreadCellDoubleClick: function (sender, args) {
-        console.log(args);
-        console.log(sender);
         let me = rationLibObj;
         let node = me.tree.items[args.row];
         if (!node || node.children.length === 0)
@@ -296,11 +292,14 @@ var rationLibObj = {
 };
 
 addEventOnResize(rationLibObj.refreshSettingForHint);
+//赋初始高度
+if($('#stdRationChapter').height() === 0 || $('#stdSectionRations').height() === 0){
+    $('#stdRationChapter').height($(window).height()-$(".header").height()-$(".toolsbar").height()-$(".tools-bar-height-q").height()-312);
+    $('#stdSectionRations').height(270);
+}
+
 $('#stdRationTab').bind('click', function () {
-    refreshSubSpread();//subSpread、jobSpread、itemSpread显示问题
     var select = $('#stdRationLibSelect');
-    $(".main-data-side-d").height($(window).height() - $(".header").height() - $(".toolsbar").height() -  $(".tools-bar-height-d").height() - 202);
-    rationLibObj.refreshSpread();
     rationLibObj.checkSpread();
     if (select[0].options.length === 0) {
         rationLibObj.loadStdRationLibs();
@@ -349,7 +348,8 @@ $('#rationSearch').click(function () {
         resultObj.append(getResultHtml(result));
         $('a', resultObj).click(function () {
             resultObj.hide();
-            $(".main-data-side-d").height($(window).height() - $(".header").height() - $(".toolsbar").height() -  $(".tools-bar-height-d").height() - 202);
+            //$(".main-data-side-d").height($(window).height() - $(".header").height() - $(".toolsbar").height() -  $(".tools-bar-height-d").height() - 202);
+            rationLibObj.refreshSpread();
             $(".main-data-side-search", resultObj).height(0);
         });
         resultObj.show();

+ 1 - 1
web/building_saas/pm/js/pm_newMain.js

@@ -139,9 +139,9 @@ const projTreeObj = {
     setSelStyle: function (sel, backColor,sheet) {
         let me = this;
         //let sheet = me.workBook.getSheet(0);
+        sel.row = sel.row === -1 ? 0 : sel.row;
         me.renderSheetFuc(sheet, function () {
             let style = me.getSelStyle(backColor);
-            /*sel.row = sel.row === -1 ? 0 : sel.row;*/
             for(let i = 0; i < sel.rowCount; i++){
                 let row = i + sel.row;
                 sheet.setStyle(row, -1, style);