Przeglądaj źródła

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

chenshilong 7 lat temu
rodzic
commit
d232a8fcd1

+ 1 - 1
modules/complementary_ration_lib/models/searchModel.js

@@ -62,7 +62,7 @@ class SearchDao{
     async findRation(userId, rationRepId, keyword, callback){
         try{
             let filter = {
-                'rationRepId': rationRepId,
+                'rationRepId': {$in: rationRepId},
                 '$and': [{
                     '$or': [{'code': {'$regex': keyword, $options: '$i'}}, {'name': {'$regex': keyword, $options: '$i'}}]
                 }, {

+ 17 - 2
public/web/sheet/sheet_common.js

@@ -517,17 +517,32 @@ var sheetCommonObj = {
     },
     getTipsCombo:function (forLocked,tips,setting) {
         let getTipsCombo = function () {
-
+            this.clickCom=false;
         };
         getTipsCombo.prototype = sheetCommonObj.getDynamicCombo(forLocked);
         if(tips && tips !=""){
             getTipsCombo.prototype.processMouseEnter = function(hitinfo){
-                console.log(hitinfo);
+                if(this.clickCom == true){ //点击了下拉框的三角形,则不用再显示悬浮框了
+                    this.clickCom = false;
+                    return;
+                }
                 TREE_SHEET_HELPER.delayShowTips(hitinfo,setting,tips);
             };
             getTipsCombo.prototype.processMouseLeave = function (hitinfo) {
                 TREE_SHEET_HELPER.hideTipsDiv();
             };
+            getTipsCombo.prototype.processMouseDown = function (hitinfo){
+                if(hitinfo.isReservedLocation == true){//这里是点击了下拉框的三角形才会有这个属性
+                    TREE_SHEET_HELPER.hideTipsDiv();
+                    this.clickCom = true;
+                }
+                GC.Spread.Sheets.CellTypes.ComboBox.prototype.processMouseDown.apply(this, arguments);
+            };
+
+            getTipsCombo.prototype.updateEditor = function (editorContext, cellStyle, cellRect, context){
+                TREE_SHEET_HELPER.hideTipsDiv();
+                GC.Spread.Sheets.CellTypes.ComboBox.prototype.updateEditor.apply(this, arguments);
+            };
         }
         return new getTipsCombo();
     },

+ 2 - 1
public/web/sheet/sheet_data_helper.js

@@ -178,7 +178,8 @@ var SheetDataHelper = {
                             .css("border", "1px #C0C0C0 solid")
                             .css("box-shadow", "1px 2px 5px rgba(0,0,0,0.4)")
                             .css("font", "0.9rem Calibri")
-                            .css("background", "white")
+                            .css("background", "Black")
+                            .css("color", "White")
                             .css("padding", 5)
                             .attr("id", 'autoTip');
                         $(div).hide();

+ 30 - 7
public/web/tree_sheet/tree_sheet_helper.js

@@ -379,6 +379,12 @@ var TREE_SHEET_HELPER = {
                 hitinfo.sheet.repaint();
             }
         };
+        TreeNodeCellType.prototype.processMouseEnter = function(hitinfo){
+            if(hitinfo.sheet.name() === 'stdBillsGuidance_bills'){
+
+                TREE_SHEET_HELPER.delayShowTips(hitinfo,setting);
+            }
+        };
         TreeNodeCellType.prototype.processMouseMove = function(hitinfo){//造价书主界面,当鼠标移动到单元格最右往左50个像素内时才显示悬浮提示内容
             if (hitinfo.sheet.name()!=="mainSheet") return;//只有在造价书主界面才显示
             let offset = 20;//从右向左显示的像素范围
@@ -471,30 +477,47 @@ var TREE_SHEET_HELPER = {
     },
     showTipsDiv:function (text,setting,hitinfo) {
         if (setting.pos && text && text !== '') {
+            if(text) text = replaceAll(/[\n]/,'<br>',text);
+            if(!this._fixedTipElement){
+                let div = $('#fixedTip')[0];
+                if (!div) {
+                    div = document.createElement("div");
+                    $(div).css("padding", 5)
+                        .attr("id", 'fixedTip');
+                    $(div).hide();
+                    document.body.insertBefore(div, null);
+                }
+                this._fixedTipElement = div;
+            }
+            $(this._fixedTipElement).width('');
+            $(this._fixedTipElement).html(text);
             if (!this._toolTipElement) {
                 let div = $('#autoTip')[0];
                 if (!div) {
                     div = document.createElement("div");
                     $(div).addClass("message-box");
-                    $(div) .attr("id", 'autoTip');
+                    $(div).attr("id", 'autoTip');
                     $(div).hide();
                     document.body.insertBefore(div, null);
                 }
                 this._toolTipElement = div;
+                $(this._toolTipElement).width('');
                 //实时读取位置信息
                 if(hitinfo.sheet && hitinfo.sheet.getParent().qo){
                     setting.pos = SheetDataHelper.getObjPos(hitinfo.sheet.getParent().qo);
                 }
-                if(text) text = replaceAll(/[\n]/,'<br>',text);
                 $(this._toolTipElement).html(`<span>${text}</span><div class="triangle-border tb-border_up"></div><div class="triangle-border tb-background_up"></div>`);
                 //清单指引、清单库做特殊处理
                 if($(hitinfo.sheet.getParent().qo).attr('id') === 'stdBillsSpread' || $(hitinfo.sheet.getParent().qo).attr('id') === 'billsGuidance_bills'){
-                    $(this._toolTipElement).css('top', '').css('left', '').css('width', '');
-                    let marginLeftMouse;
-                    if($(this._toolTipElement).width() < hitinfo.x){
-                        marginLeftMouse = hitinfo.x - $(this._toolTipElement).width();
+                    $(this._toolTipElement).html(`<span>${text}</span>`);
+                    let divWidth = $(this._fixedTipElement).width(),
+                        divHeight = $(this._fixedTipElement).height();
+                    if(divWidth > 600){
+                        divWidth = 590;
+                        $(this._toolTipElement).width(divWidth);
                     }
-                    $(this._toolTipElement).css("top", setting.pos.y + hitinfo.cellRect.y  -$(this._toolTipElement).height() -20).css("left", marginLeftMouse ? setting.pos.x + marginLeftMouse : setting.pos.x);
+                    let top = setting.pos.y  + hitinfo.y - divHeight / 2 < 0 ? 0 : setting.pos.y  + hitinfo.y - divHeight / 2;
+                    $(this._toolTipElement).css("top", top).css("left", setting.pos.x - divWidth);
                 } else {
                     //计算显示的初始位置
                /*   显示在单元格上方,三角形指向下的版本

+ 6 - 3
web/building_saas/complementary_glj_lib/js/glj.js

@@ -404,13 +404,16 @@ let repositoryGljObj = {
                 }
                 else {
                     $('#gljAlertBtn').click();
-                    $('#aleConfBtn').click(function () {
+                    $('#aleConfBtn').unbind('click');
+                    $('#aleConfBtn').bind('click', function () {
                         me.workBook.getSheet(0).setActiveCell(me.editingRowIdx, focusToCol);
                     });
-                    $('#gljAleClose').click(function () {
+                    $('#gljAleClose').unbind('click');
+                    $('#gljAleClose').bind('click', function () {
                         me.workBook.getSheet(0).setActiveCell(me.editingRowIdx, focusToCol);
                     });
-                    $('#aleCanceBtn').click(function () {
+                    $('#aleCanceBtn').unbind('click');
+                    $('#aleCanceBtn').bind('click', function () {
                         me.addGljObj = null;
                         me.workBook.getSheet(0).suspendPaint();
                         me.workBook.getSheet(0).suspendEvent();

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

@@ -12,7 +12,7 @@ function autoFlashHeight(){
     $(".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-data-side-zb").height(($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightZ) - $('#billsGuidance_items').height() - 5);
+    $(".main-data-side-zb").height(($(window).height()-headerHeight-toolsbarHeight-toolsBarHeightZ) - $('#billsGuidance_items').height() - $('#zyTools').height() - 12);
     /*$(".main-data-side-zi").height($(window).height()-headerHeight-toolsbarHeight- toolsBarHeightZ - $(".main-data-side-zb").height());*/
     $('.main-content').width($(window).width()-$('.main-nav').width()-$('.main-side').width()-5);
     $('#glj_tree_div .modal-content').width($(window).width() < 1020 + 20 ? $(window).width() - 20 : 1020);
@@ -31,6 +31,7 @@ function autoFlashHeight(){
     $(".share-list").height($(window).height()-headerHeight-toolsbarHeight-40);
     $(".form-view").height($(window).height()-headerHeight-ftoolsbarHeight);
     $(".form-list").height($(window).height()-headerHeight-50 );
+    $('#comments').find('textarea').height($('#comments').height() - 25);
     typeof(adaptiveTzjnrWidth)== 'function' ?adaptiveTzjnrWidth():''
 };
 

+ 8 - 3
web/building_saas/main/html/main.html

@@ -171,7 +171,7 @@
                                           <div class=" main-data-bottom ovf-hidden" style="width: 50%; float: left; margin: 0; padding:0;" id="assSpread"></div>
                                       </div>
                                       <div class="main-data-bottom ovf-hidden" style="display: none" id="comments">
-                                          <textarea class="form-control" rows="8" readonly=""></textarea>
+                                          <textarea style="font-size: 0.9rem" class="form-control" rows="8" readonly=""></textarea>
                                       </div>
                                       <div id="tzjnrCon" class="container-fluid main-data-bottom" style="background: #F1F1F1; overflow: hidden">
                                           <div class="row" style="overflow: hidden">
@@ -330,7 +330,7 @@
                                       </div>
                                   </div>
                                   <div class="resize" id="zyResize" style="background: #F1F1F1"></div>
-                                  <div class="p-1 row" style="background: #F1F1F1">
+                                  <div class="p-1 row" id="zyTools" style="background: #F1F1F1">
                                       <div class="col">
                                           <button id="guidanceInsertBills" class="btn btn-primary btn-sm" type="button">插入清单</button>
                                           <button id="guidanceInsertRation" class="btn btn-primary btn-sm" type="button">插入定额</button>
@@ -406,7 +406,11 @@
                                           <!--搜索结果窗体-->
                                           <div class="side-search-box col-12 p-0" id="rationSearchResult" style="display: none;">
                                               <div class="d-flex justify-content-between">
-                                                  <span id="rationSearchCount"></span>
+                                                  <div class="my-1">
+                                                      <span id="rationSearchCount"></span>
+                                                      <button id="curRationLib" type="button" class="btn btn-sm btn-secondary" style="margin-left: 15px;">本定额</button>
+                                                      <button id="allRationLibs" type="button" class="btn btn-sm btn-light">全部定额</button>
+                                                  </div>
                                                   <a title="关闭搜索" class="btn btn-link btn-sm" href="javascript:void(0)"><i class="fa fa-remove" aria-hidden="true"></i></a>
                                               </div>
                                               <div class="w-100 main-data-side-search"></div>
@@ -1641,6 +1645,7 @@
                 $("#checkCount").text(checkCount);
 
             }
+
             /*$(document).ready(function(){
                 document.addEventListener('visibilitychange', function() {
                     if(document.hidden){ //页面不可见状态

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

@@ -33,6 +33,7 @@ $(function () {
         projectObj.mainSpread.refresh();
         refreshSubSpread();
         zmhs_obj.refresh();
+        $('#comments').find('textarea').height($('#comments').height() - 25);
     });
 
     const projectId = scUrlUtil.GetQueryString('project');

+ 20 - 6
web/building_saas/main/js/views/fee_rate_view.js

@@ -299,14 +299,28 @@ var feeRateObject={
                         refreshVisible(sub)
                     }
                 }
-                let parent = getParent(item.ParentID,datas);
-                if(parent){
-                    let prow= datas.indexOf(parent);
-                    let visible = !sheet.getCellType(prow,0).collapsed;
-                    let trow = datas.indexOf(item);
-                    sheet.getRange(trow , -1, 1, -1).visible(visible);
+                let visible = getVisible(item);
+                let trow = datas.indexOf(item);
+                sheet.getRange(trow , -1, 1, -1).visible(visible);
+            }
+            
+            function getVisible(item) {
+                if(item.ParentID){
+                    let parent = getParent(item.ParentID,datas);
+                    if(!parent) return true;
+                    let p_row= datas.indexOf(parent);
+                    let visible = !sheet.getCellType(p_row,0).collapsed;
+                    if(visible == true){ //如果是显示的,则要再往父节点的父节点检查,只要有一个节点是隐藏的,则都是隐藏
+                        return getVisible(parent);
+                    }else {
+                        return visible
+                    }
+                }else {//如果parentID 为空则是最根节点
+                    return true;
                 }
             }
+            
+            
         };
         return new TreeNodeCellType()
 

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

@@ -255,8 +255,7 @@ let MainTreeCol = {
              if(node.sourceType == ModuleNames.bills &&projectObj.ifItemCharHiden(setting)){//清单、并且项目特征列隐藏的时候悬浮提示
                 tips = node.data.itemCharacterText?node.data.itemCharacterText:'';
              }
-             console.log(setting);
-            let dynamicCombo = sheetCommonObj.getTipsCombo(true,tips,setting);//sheetCommonObj.getDynamicCombo(true);
+                    let dynamicCombo = sheetCommonObj.getTipsCombo(true,tips,setting);//sheetCommonObj.getDynamicCombo(true);
             dynamicCombo.itemHeight(10).items(['m', 'm2', 'm3', 'km', 't', 'kg', '台班', '工日', '昼夜', '元', '项', '处', '个', '件',
                 '根', '组', '系统', '台', '套', '株', '丛', '缸', '支', '只', '块', '座', '对', '份', '樘', '攒', '榀']).editable(true);
             return dynamicCombo;

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

@@ -631,7 +631,6 @@ var projectObj = {
                 }
             }
             if(!$("#de").is(":visible"))  $('#stdRationTab').click();
-            console.log($('#stdRationLibSelect').select().val());
         }
 
     },
@@ -2162,6 +2161,8 @@ $('#recColSetting').click(function () {
 $('#property_default').click(function () {
     let project = projectObj.project,
         projectID = project.ID();
+    //todo 清除窗口拖动比例缓存
+
     CommonAjax.post('/pm/api/defaultSettings', {user_id: userID, projectID: projectID}, function (rstData) {
         window.location.href = `/main?project=${projectID}`;
     });

+ 161 - 35
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -10,6 +10,8 @@
 
 //清单指引/精灵获取完清单数据后的回调函数
 let doAfterLoadGuidance = null;
+//选项单选多选状态(按住alt为多选) 单选:0 多选:1
+let billsGuidanceSelMode = 0;
 
 const billsGuidance = (function () {
     let currentLib = null;
@@ -38,6 +40,7 @@ const billsGuidance = (function () {
             cols: [{
                 width: 140,
                 readOnly: true,
+                showHint: true,
                 head: {
                     titleNames: ["项目编码"],
                     spanCols: [1],
@@ -409,7 +412,11 @@ const billsGuidance = (function () {
             sheet.suspendPaint();
             for(let col = 0; col < headers.length; col++){
                 if(headers[col]['rateWidth'] !== undefined && headers[col]['rateWidth'] !== null && headers[col]['rateWidth'] !== ''){
-                    sheet.setColumnWidth(col, workBookWidth * headers[col]['rateWidth'], GC.Spread.Sheets.SheetArea.colHeader)
+                    let width = workBookWidth * headers[col]['rateWidth'];
+                    if(headers[col]['dataCode'] === 'options'){
+                        width = width - 70;
+                    }
+                    sheet.setColumnWidth(col, width, GC.Spread.Sheets.SheetArea.colHeader)
                 }
                 else {
                     if(headers[col]['headerWidth'] !== undefined && headers[col]['headerWidth'] !== null && headers[col]['headerWidth'] !== ''){
@@ -449,7 +456,6 @@ const billsGuidance = (function () {
             setOptions(module.workBook, options);
             buildHeader(module.workBook.getActiveSheet(), module.headers);
             if(module === elfItem){
-                console.log($('#zy').width());
                 setColumnWidthByRate(elfItem.workBook, $('#zy').width(), elfItem.headers)
             }
             bindEvent(module.workBook, module.events);
@@ -482,6 +488,9 @@ const billsGuidance = (function () {
             initExpandStat();
         }
         module.controller.showTreeData();
+        if(module === bills){
+            setBillsHint(bills.tree.items, stdBillsJobData, stdBillsFeatureData);
+        }
     }
     //项目指引表焦点控制
     //@param {Number}row @return {void}
@@ -756,15 +765,16 @@ const billsGuidance = (function () {
             this.isEscKey=false;
             this.displayText='';
         }
-        function getHtml(node, cellRect, cellStyle) {
+       /* function getHtml(node, cellRect, cellStyle, top) {
             if(!node){
                 return '';
             }
             let height = cellRect.height;
+            top = top.replace('px', '');
             let htmlArr = [];
             let options = getOptions(node.data, bills.tree.selected.elf.datas);
             //let optionsTitle = node.data.options.split(';').join('\n');
-            htmlArr.push(`<div style="height: ${height}px; background: ${cellStyle.backColor};overflow: hidden; white-space: nowrap; text-overflow: ellipsis">${node.data.options}</div><div style="background: ${cellStyle.backColor};border: 1px solid; overflow: auto; height: ${options.length > 6 ? height*6 : height*options.length+5}px; font-size: 0.9rem;">`);
+            htmlArr.push(`<div style="height: ${height}px; background: ${cellStyle.backColor};overflow: hidden; white-space: nowrap; text-overflow: ellipsis">${node.data.options}</div><div id="optDiv" style="position: fixed; width: ${cellRect.width}px; top: ${top - (options.length - 2) * height - 5}px;background: ${cellStyle.backColor};border: 1px solid; overflow: auto; height: ${options.length > 6 ? height*6 : height*options.length+5}px; font-size: 0.9rem;">`);
             for(let opt of options){
                 htmlArr.push(`<div title="${opt.name ? opt.name : ''}" class="elf-options" style="height: ${height}px;overflow: hidden; white-space: nowrap; text-overflow: ellipsis">
                         <input rank="${opt.rank}" value="${opt.ID}" style="margin-left: 5px; vertical-align: middle" type="checkbox" 
@@ -772,6 +782,39 @@ const billsGuidance = (function () {
             }
             htmlArr.push(`</div>`);
             return htmlArr.join('');
+        }*/
+        function setOptionsDiv($editor, node, cellRect, cellStyle, top) {
+            if(!node){
+                return '';
+            }
+            let height = cellRect.height;
+            top = top.replace('px', '');
+            let options = getOptions(node.data, bills.tree.selected.elf.datas);
+            let $editInput = $(`<div style="height: ${height}px; background: ${cellStyle.backColor};overflow: hidden; white-space: nowrap; text-overflow: ellipsis">${node.data.options}</div>`),
+                $optDiv = $(`<div style="position: fixed; width: ${cellRect.width}px; top: ${top - (options.length - 2) * height - 5}px;background: ${cellStyle.backColor};border: 1px solid; overflow: auto; height: ${options.length > 6 ? height*6 : height*options.length+5}px; font-size: 0.9rem;"></div>`);
+            for(let opt of options){
+                let $opt = $(`<div title="${opt.name ? opt.name : ''}" class="elf-options" style="height: ${height}px;overflow: hidden; white-space: nowrap; text-overflow: ellipsis"></div>`),
+                    $optInput = $(`<input rank="${opt.rank}" value="${opt.ID}" style="margin-left: 5px; vertical-align: middle" type="checkbox" 
+                    ${node.data.optionChecked && _.find(node.data.optionChecked, {ID: opt.ID}) ? 'checked' : ''}>`);
+                $opt.text(`${opt.name ? opt.name : ''}`);
+                $opt.prepend($optInput);
+                $optDiv.append($opt);
+                //选项复选框点击监听
+                $optInput.click(function () {
+                    //单选
+                    if(billsGuidanceSelMode === 0){
+                        let $allInput = $optDiv.find('input');
+                        for(let input of $allInput){
+                            $(input).prop('checked', false);
+                        }
+                        $(this).prop('checked', 'checked');
+                    } else {//多选
+
+                    }
+                });
+            }
+            $editor.append($editInput);
+            $editor.append($optDiv);
         }
         //选择后处理
         function doAfterSel(node) {
@@ -847,8 +890,10 @@ const billsGuidance = (function () {
                 $editor.css("background", "white");
                 $editor.css("width", cellRect.width);
                 $editor.attr("gcUIElement", "gcEditingInput");
+                let activeCellTop = $editor.parent().parent().css('top');
                 let node = bills.tree.selected.elf.tree.items[elfSheet.getActiveRowIndex()];
-                $editor.html(getHtml(node, cellRect, cellStyle));
+                setOptionsDiv($editor, node, cellRect, cellStyle, activeCellTop);
+                this.isEscKey = false;
             }
         }
         OptionsCellType.prototype.deactivateEditor = function (editorContext, context) {
@@ -913,13 +958,16 @@ const billsGuidance = (function () {
         return new OptionsCellType();
     }
     //初始化清单的工作内容和项目特征
-    //@param {Number}billsLibId @return {void}
-    function initJobAndCharacter(billsLibId){
+    //@param {Number}billsLibId {Function}callback @return {void}
+    function initJobAndCharacter(billsLibId, callback){
         CommonAjax.post('/stdBillsEditor/getJobContent', {userId: userID, billsLibId: billsLibId}, function (datas) {
             stdBillsJobData = datas;
-        });
-        CommonAjax.post('/stdBillsEditor/getItemCharacter', {userId: userID, billsLibId: billsLibId}, function (datas) {
-            stdBillsFeatureData = datas;
+            CommonAjax.post('/stdBillsEditor/getItemCharacter', {userId: userID, billsLibId: billsLibId}, function (datas) {
+                stdBillsFeatureData = datas;
+                if(callback){
+                    callback();
+                }
+            });
         });
     }
     //初始化清单展开收起状态
@@ -945,7 +993,7 @@ const billsGuidance = (function () {
         });
     }
     //根据编码定位至清单精灵库中
-    //
+    //@param {String}code @return {void}
     function locateAtBills(code) {
         let nineCode = code.substring(0, 9);
         let items = bills.tree.items;
@@ -962,6 +1010,71 @@ const billsGuidance = (function () {
         billsInitSel(locateRow);
         sheet.showRow(locateRow, GC.Spread.Sheets.VerticalPosition.center);
     }
+    //清单设置悬浮提示信息
+    //@param {Array}billsNodes(清单节点) {Array}jobs(总的工作内容数据) {Array}items(总的项目特征数据)
+    function setBillsHint(billsNodes, jobs, items) {
+        let jobsMapping = {},
+            itemsMapping = {};
+        for(let job of jobs){
+            jobsMapping[job.id] = job;
+        }
+        for(let item of items){
+            itemsMapping[item.id] = item;
+        }
+        let tagInfo = [];
+        for(let billsNode of billsNodes){
+            let hintArr = [];
+            let billsItems = billsNode.data.items;
+            if(billsItems.length > 0){
+                //项目特征
+                hintArr.push('项目特征:');
+            }
+            let itemCount = 1,
+                jobCount = 1;
+            for(let billsItem of billsItems){
+                let itemData = itemsMapping[billsItem.id];
+                if(itemData){
+                    //特征值
+                    let eigens = [];
+                    for(let eigen of itemData.itemValue){
+                        eigens.push(eigen.value);
+                    }
+                    eigens = eigens.join(';');
+                    hintArr.push(`${itemCount}.${itemData.content}${eigens === '' ? '' : ': ' + eigens}`);
+                    itemCount ++;
+                }
+            }
+            //工作内容
+            let billsJobs = billsNode.data.jobs;
+            if(billsJobs.length > 0){
+                hintArr.push('工作内容:');
+            }
+            for(let billsJob of billsJobs){
+                let jobData = jobsMapping[billsJob.id];
+                if(jobData){
+                    hintArr.push(`${jobCount}.${jobData.content}`);
+                    jobCount ++;
+                }
+            }
+            /*if(billsNode.data.ruleText && billsNode.data.ruleText !== ''){
+                hintArr.push('工程量计算规则:');
+                hintArr.push(billsNode.data.ruleText);
+            }
+            if(billsNode.data.recharge && billsNode.data.recharge !== ''){
+                hintArr.push('补注:');
+                hintArr.push(billsNode.data.recharge);
+            }*/
+            if(hintArr.length > 0){
+                tagInfo.push({row: billsNode.serialNo(), value: hintArr.join('\n')});
+            }
+        }
+        let sheet = bills.workBook.getActiveSheet();
+        renderSheetFunc(sheet, function () {
+            for(let tagI of tagInfo){
+                sheet.setTag(tagI.row, 0, tagI.value);
+            }
+        });
+    }
     //初始选择清单指引库
     //@param {Number}libID @return {void}
     function libInitSel(libID){
@@ -978,32 +1091,34 @@ const billsGuidance = (function () {
                 elfItem.workBook = null;
             }
             initViews();
-            //获取清单库中的工作内容和项目特征
-            initJobAndCharacter(rstData.guidanceLib.billsLibId);
-            initTree(bills, bills.workBook.getActiveSheet(), bills.treeSetting, rstData.bills);
-            //清单精灵
-            if(rstData.guidanceLib.type && rstData.guidanceLib.type == libType.elf){
-                $('#stdBillsGuidanceTab').text('清单精灵');
-                //每一个清单节点下挂载一棵清单精灵树
-                for(let node of bills.tree.items){
-                    node.elf = {tree: null, controller: null, datas: []}; //挂载全部数据,数据不一定全成为树节点
+            let callback = function () {
+                initTree(bills, bills.workBook.getActiveSheet(), bills.treeSetting, rstData.bills);
+                //清单精灵
+                if(rstData.guidanceLib.type && rstData.guidanceLib.type == libType.elf){
+                    $('#stdBillsGuidanceTab').text('清单精灵');
+                    //每一个清单节点下挂载一棵清单精灵树
+                    for(let node of bills.tree.items){
+                        node.elf = {tree: null, controller: null, datas: []}; //挂载全部数据,数据不一定全成为树节点
+                    }
                 }
-            }
-            //清单指引
-            else {
-                $('#stdBillsGuidanceTab').text('清单指引');
-                //每一棵项目指引树挂在清单节点上
-                for(let node of bills.tree.items){
-                    node.guidance = {tree: null, controller: null};
+                //清单指引
+                else {
+                    $('#stdBillsGuidanceTab').text('清单指引');
+                    //每一棵项目指引树挂在清单节点上
+                    for(let node of bills.tree.items){
+                        node.guidance = {tree: null, controller: null};
+                    }
                 }
-            }
-            setTagForHint(bills.tree.items);
-            //默认初始节点
-            billsInitSel(0);
-            if(doAfterLoadGuidance){
-                doAfterLoadGuidance();
-            }
-            $.bootstrapLoading.end();
+                //setTagForHint(bills.tree.items);
+                //默认初始节点
+                billsInitSel(0);
+                if(doAfterLoadGuidance){
+                    doAfterLoadGuidance();
+                }
+                $.bootstrapLoading.end();
+            };
+            //获取清单库中的工作内容和项目特征
+            initJobAndCharacter(rstData.guidanceLib.billsLibId, callback);
         }, function () {
             $.bootstrapLoading.end();
         });
@@ -1294,6 +1409,17 @@ const billsGuidance = (function () {
             billsLibObj.clearHighLight(bills.workBook);
             refreshWorkBook();
         });
+        //监听alt建,确定选项单选多选状态
+        $('#billsGuidance_items').keydown(function(e){
+            if(e.keyCode === 18){
+                billsGuidanceSelMode = 1;
+            }
+        });
+        $('#billsGuidance_items').keyup(function(e){
+            if(e.keyCode === 18){
+                billsGuidanceSelMode = 0;
+            }
+        });
     }
     //刷新表
     //@return {void}

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

@@ -225,7 +225,7 @@ var billsLibObj = {
                 that.stdBillsTree.setRootExpanded(that.stdBillsTree.roots, false);
             }
             stdBillsTreeController.showTreeData();
-            billsLibObj.setTagForHint(that.stdBillsTree.items);
+            //billsLibObj.setTagForHint(that.stdBillsTree.items);
             that.showBillsRela(that.stdBillsTree.firstNode());
             stdBillsTreeController.bind(TREE_SHEET_CONTROLLER.eventName.treeSelectedChanged, that.showBillsRela);
             that.stdBillsSpread.unbind(GC.Spread.Sheets.Events.CellDoubleClick);

+ 70 - 22
web/building_saas/main/js/views/std_ration_lib.js

@@ -67,7 +67,6 @@ var rationLibObj = {
         var that = this;
         var showRationChapterTree = function (datas) {
             var rationChapterTree = idTree.createNew({id: 'ID', pid: 'ParentID', nid: 'NextSiblingID', rootId: -1, autoUpdate: false});
-            console.log(that);
             that.tree = rationChapterTree;
             var rationChapterTreeController = TREE_SHEET_CONTROLLER.createNew(rationChapterTree, that.rationChapterSpread.getActiveSheet(), that.rationChapterTreeSetting);
             rationChapterTree.loadDatas(datas);
@@ -132,9 +131,6 @@ var rationLibObj = {
             sheet.setTag(i, 0, '');
         }
         for(let i = 0, len = datas.length; i < len; i++){
-            if(datas[i].code === 'AA0032'){
-                console.log(datas[i]);
-            }
             sheet.setTag(i, 0, datas[i].hint ? datas[i].hint : '');
         }
         sheet.resumePaint();
@@ -448,13 +444,50 @@ $('#rationSearchKeyword').keyup(function () {
         if($('#rationSearchResult').is(':visible')){
             $('#rationSearchResult').hide();
             $(".main-data-side-search", $('#rationSearchResult')).height(0);
+            switchRationSearchMode(0);
             autoFlashHeight();
             rationLibObj.refreshSpread();
         }
     }
 });
+
+//变换搜索本定额、全部定额状态
+function switchRationSearchMode(mode) {
+    //搜索本定额
+    if(mode === 0){
+        $('#curRationLib').removeClass('btn-light');
+        $('#curRationLib').addClass('btn-secondary');
+        $('#allRationLibs').removeClass('btn-secondary');
+        $('#allRationLibs').addClass('btn-light');
+    } else {//搜索全部定额
+        $('#allRationLibs').removeClass('btn-light');
+        $('#allRationLibs').addClass('btn-secondary');
+        $('#curRationLib').removeClass('btn-secondary');
+        $('#curRationLib').addClass('btn-light');
+    }
+}
+
+//搜索本定额
+$('#curRationLib').click(function () {
+    if($(this).hasClass('btn-secondary')){
+        return;
+    }
+    switchRationSearchMode(0);
+    $('#rationSearch').click();
+});
+
+//搜索全部定额
+$('#allRationLibs').click(function () {
+    if($(this).hasClass('btn-secondary')){
+        return;
+    }
+    switchRationSearchMode(1);
+    $('#rationSearch').click();
+});
+
+//搜索
 $('#rationSearch').click(function () {
-    var keyword = $('#rationSearchKeyword').val(), rationLibID = $('#stdRationLibSelect').val();
+    var keyword = $('#rationSearchKeyword').val();
     if(keyword === ''){
         if($('#rationSearchResult').is(':visible')){
             $('#rationSearchResult').hide();
@@ -464,19 +497,15 @@ $('#rationSearch').click(function () {
         }
         return;
     }
-    var getResultHtml = function (result) {
-        var html = [], i, serialNo;
-        html.push('<div class="d-flex justify-content-between">');
-        html.push('<span>搜索结果:');
-        html.push(result.length.toString());
-        html.push('</span>');
-        html.push('<a title="关闭搜索" class="btn btn-link btn-sm" href="javascript:void(0)"><i class="fa fa-remove" aria-hidden="true"></i></a>');
-        html.push('</div>');
-
-        html.push('<div class="w-100 main-data-side-search">');
-        html.push('</div>');
-        return html.join('');
-    };
+    //获取搜索定额的库:本库/所有库
+    let rationLibIDs = [];
+    if($('#curRationLib').hasClass('btn-secondary')){
+        rationLibIDs.push($('#stdRationLibSelect').val());
+    } else {
+        for(let lib of projectInfoObj.projectInfo.engineeringInfo.ration_lib){
+            rationLibIDs.push(lib.id);
+        }
+    }
     let bindContextmenuOpr = function (sheet) {
         $.contextMenu({
             selector: '#rationSearchResult',
@@ -503,7 +532,23 @@ $('#rationSearch').click(function () {
                                     $(".main-data-side-search", $('#rationSearchResult')).height(0);
                                     autoFlashHeight();
                                     rationLibObj.refreshSpread();
-                                    rationLibObj.locateAtRation(data.rationRepId, data.code);
+                                    switchRationSearchMode(0);
+                                    if($('#stdRationLibSelect').select().val() != data.rationRepId){
+                                        let libOpts = $('#stdRationLibSelect').find('option');
+                                        for(let libOpt of libOpts){
+                                            if($(libOpt).val() == data.rationRepId){
+                                                $(libOpt).prop('selected', 'selected');
+                                                break;
+                                            }
+                                        }
+                                        $('#stdRationLibSelect').change();
+                                        rationLibObj.doAfterGetRationTree = function () {
+                                            this.locateAtRation(data.rationRepId, data.code);
+                                            this.doAfterGetRationTree = null;
+                                        };
+                                    } else {
+                                        rationLibObj.locateAtRation(data.rationRepId, data.code);
+                                    }
                                 }}
                         }
                     };
@@ -528,7 +573,8 @@ $('#rationSearch').click(function () {
         SheetDataHelper.loadSheetData(rationLibObj.sectionRationsSetting, rationLibObj.resultSpread.getActiveSheet(), result);
         rationLibObj.setTagForHint(rationLibObj.resultSpread.getActiveSheet(), result);
     };
-    CommonAjax.post('/complementaryRation/api/findRation', {'user_id': userID, 'rationRepId': rationLibID, 'keyword': keyword}, function (result) {
+    $.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;
@@ -537,11 +583,10 @@ $('#rationSearch').click(function () {
             return rst;
         });
         var resultObj = $('#rationSearchResult');
-        /*resultObj.empty();
-        resultObj.append(getResultHtml(result));*/
         $('#rationSearchCount').text(`搜索结果:${result.length.toString()}`);
         $('a', result).unbind('click');
         $('a', resultObj).bind('click', function () {
+            switchRationSearchMode(0);
             resultObj.hide();
             $(".main-data-side-search", resultObj).height(0);
             autoFlashHeight();
@@ -550,5 +595,8 @@ $('#rationSearch').click(function () {
         resultObj.show();
         $(".main-data-side-search", resultObj).height($(window).height() - $(".header").height() - $(".toolsbar").height() - 64);
         showResult(result);
+        $.bootstrapLoading.end();
+    }, function () {
+        $.bootstrapLoading.end();
     });
 });

+ 6 - 5
web/building_saas/main/js/views/sub_view.js

@@ -146,10 +146,11 @@ $("#linkTZJNR").click(function () {
     $("#tzjnrCon").show();
     adaptiveTzjnrWidth();
     pageCCOprObj.resizeWidth();
-    //$("#add-rule").show();
     $("#add-rule p").not(":first").css('margin-bottom', 4);
     pageCCOprObj.active = true;
     refreshSubSpread();
+    contentOprObj.workBook.getActiveSheet().showColumn(0, GC.Spread.Sheets.HorizontalPosition.left);
+    characterOprObj.workBook.getActiveSheet().showColumn(0, GC.Spread.Sheets.HorizontalPosition.left);
     let selectedNode = projectObj.mainController.tree.selected;
     if (projectObj.project.property.addRule !== undefined) {
         setRule(projectObj.project.property.addRule);
@@ -482,14 +483,14 @@ let subViewObj = {
         if (node) {
             if (node.sourceType === projectObj.project.Bills.getSourceType() &&
                 (node.data.type === billType.FX || node.data.type === billType.BX || node.data.type === billType.BILL)) {
-                if(node.data.comments && node.data.comments !== ''){
-                    comments.push('清单注释:');
-                    comments.push(node.data.comments);
-                }
                 if(node.data.ruleText && node.data.ruleText !== ''){
                     comments.push('工程量计算规则:');
                     comments.push(node.data.ruleText);
                 }
+                if(node.data.comments && node.data.comments !== ''){
+                    comments.push('清单注释:');
+                    comments.push(node.data.comments);
+                }
             } else if (node.sourceType === projectObj.project.Ration.getSourceType()) {
                 if(node.data.content && node.data.content !== ''){
                     comments.push('工作内容:');