diff --git a/src/main/webapp/static/pages/css/pageLogs.css b/src/main/webapp/static/pages/css/pageLogs.css index 620c5c473..dd2e66f2e 100644 --- a/src/main/webapp/static/pages/css/pageLogs.css +++ b/src/main/webapp/static/pages/css/pageLogs.css @@ -3,7 +3,7 @@ table.logTb { table-layout: fixed; } -table.logTb td { +table.logTb td ~td { width: 100px; overflow: hidden; white-space: nowrap; diff --git a/src/main/webapp/static/pages/scripts/pageLogs.js b/src/main/webapp/static/pages/scripts/pageLogs.js index 9a173ab32..c7c18cd8c 100644 --- a/src/main/webapp/static/pages/scripts/pageLogs.js +++ b/src/main/webapp/static/pages/scripts/pageLogs.js @@ -3,21 +3,38 @@ $(document).ready(function() { $("table.logTb").find("td").not(":has(a)").bind("mouseover", function(){ this.title=$(this).html(this.innerHTML.trim()).text(); }); - + var fontSize = 0; $("table.logTb th").each(function(){ // 判断是否支持currentStyle属性 是:IE 否:FF or Chrome var finalStyle = this.currentStyle ? this.currentStyle : document.defaultView.getComputedStyle(this , null); - var fontSize = (finalStyle.fontSize).replace("px",""); - + fontSize = (finalStyle.fontSize).replace("px",""); + // 设置界面标题宽度(不包括第一列) var px = getPixelsCount($(this).text(),fontSize)+32; this.setAttribute('width',px+'px'); }); -}) + + var tdString = ""; + $("table.logTb tbody tr").each(function(){ + tdString = $(this).find('td:first').text(); + }); + + $("table.logTb th:lt(1)").each(function(){ + // 设置界面第一列标题宽度 + var thString = $(this).text(); + if(tdString.trim().length < thString.length){ + var thPx = getPixelsCount(thString,fontSize)+32; + this.setAttribute('width',thPx+'px'); + }else{ + var tdPx = getPixelsCount(tdString,fontSize)+45; + this.setAttribute('width',tdPx+'px'); + } + }); +}); -// 获取界面标题字符串对等的像素值 +// 获取字符串对等的像素值 function getPixelsCount(str, strFontSize){ - // 字符串字符个数 + // 字符个数 var stringCharsCount = str.length; // 像素值