Forráskód Böngészése

清单精灵悬浮提示

zhongzewei 6 éve
szülő
commit
db8e61f4ae

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

@@ -178,7 +178,7 @@ 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("padding", 5)
                             .attr("id", 'autoTip');
                         $(div).hide();

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

@@ -379,6 +379,11 @@ 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 +476,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"></div><div class="triangle-border tb-background"></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 {
                     //计算显示的初始位置
                     let top = setting.pos.y + hitinfo.cellRect.y -$(this._toolTipElement).height() -26;

+ 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():''
 };
 

+ 6 - 1
web/building_saas/main/html/main.html

@@ -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>
@@ -1641,6 +1641,11 @@
                 $("#checkCount").text(checkCount);
 
             }
+            /*$('#billsGuidance_items').keydown(function(e){
+                if(e.keyCode === 18){
+                }
+            });*/
+
             /*$(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');

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

@@ -2161,6 +2161,8 @@ $('#recColSetting').click(function () {
 $('#property_default').click(function () {
     let project = projectObj.project,
         projectID = project.ID();
+    //清除窗口拖动比例缓存
+
     CommonAjax.post('/pm/api/defaultSettings', {user_id: userID, projectID: projectID}, function (rstData) {
         window.location.href = `/main?project=${projectID}`;
     });

+ 100 - 32
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -38,6 +38,7 @@ const billsGuidance = (function () {
             cols: [{
                 width: 140,
                 readOnly: true,
+                showHint: true,
                 head: {
                     titleNames: ["项目编码"],
                     spanCols: [1],
@@ -409,7 +410,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 +454,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);
@@ -480,6 +484,7 @@ const billsGuidance = (function () {
         module.tree.loadDatas(datas);
         if(module === bills){
             initExpandStat();
+            setBillsHint(bills.tree.items, stdBillsJobData, stdBillsFeatureData);
         }
         module.controller.showTreeData();
     }
@@ -913,13 +918,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 +953,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 +970,64 @@ 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;
+        }
+        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){
+                bills.workBook.getActiveSheet().setTag(billsNode.serialNo(), 0, hintArr.join('\n'));
+            }
+        }
+    }
     //初始选择清单指引库
     //@param {Number}libID @return {void}
     function libInitSel(libID){
@@ -978,32 +1044,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();
         });

+ 4 - 4
web/building_saas/main/js/views/sub_view.js

@@ -482,14 +482,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('工作内容:');