feat(lme): 名称规格单位编辑回写与项目级联动显示
This commit is contained in:
@@ -6,10 +6,13 @@
|
||||
<style>
|
||||
:root{--c1:#123a6b;--c2:#1f5fae;--line:#c9d4e2;--head:#eef3fa;--bg:#f5f7fa;--txt:#1c2733;--muted:#5a6b7f}
|
||||
*{box-sizing:border-box}
|
||||
html,body{height:100%}
|
||||
body{font-family:"Microsoft YaHei",system-ui,sans-serif;margin:0;background:var(--bg);color:var(--txt);font-size:13px}
|
||||
.wrap{margin:0 auto;padding:10px 16px 14px}
|
||||
/* 2026-10-22 主人定:显示区按最大行撑满(去掉原 max-height:100vh-230px 的底部留白);
|
||||
行数超过可视范围走前端分页(只改显示,接口/数据逻辑不动)。 */
|
||||
.wrap{margin:0 auto;padding:10px 16px 14px;height:100%;display:flex;flex-direction:column}
|
||||
h1{font-size:19px;margin:0 0 3px;color:var(--c1)}
|
||||
.panel{background:#fff;border:1px solid var(--line)}
|
||||
.panel{background:#fff;border:1px solid var(--line);flex:1;display:flex;flex-direction:column;min-height:0}
|
||||
.bar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;padding:10px 12px;border-bottom:1px solid var(--line);background:#fafcff}
|
||||
.bar input,.bar select{padding:6px 10px;border:1px solid #b8c4d4;border-radius:6px;font-size:13px}
|
||||
.btn{padding:4px 10px;border-radius:6px;border:1px solid #b8c4d4;background:#fff;cursor:pointer;font-size:12px;line-height:1.3;text-decoration:none;display:inline-block}
|
||||
@@ -25,7 +28,7 @@ h1{font-size:19px;margin:0 0 3px;color:var(--c1)}
|
||||
.btn:disabled{opacity:.45;cursor:not-allowed}
|
||||
.ck{display:flex;align-items:center;gap:5px;font-size:12.5px;color:var(--muted);cursor:pointer}
|
||||
.tip{color:var(--muted);font-size:12px}
|
||||
.tw{overflow:auto;max-height:calc(100vh - 230px)}
|
||||
.tw{overflow:auto;flex:1;min-height:0}
|
||||
table{width:100%;border-collapse:collapse;table-layout:fixed}
|
||||
th,td{border:1px solid var(--line);padding:5px 8px;vertical-align:top}
|
||||
th{background:var(--head);position:sticky;top:0;z-index:3;box-shadow:inset 0 -1px 0 var(--line);
|
||||
@@ -37,6 +40,7 @@ td.name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
tr.duprow td{background:#fbfcfe;color:#456;font-size:11.5px}
|
||||
tr:hover td{background:#f6f9fd}
|
||||
.empty{padding:26px;text-align:center;color:var(--muted)}
|
||||
.pager{flex:none;display:none;align-items:center;justify-content:flex-end;gap:10px;padding:7px 12px;border-top:1px solid var(--line);background:#fafcff}
|
||||
.manualtag{color:#1f5fae;font-weight:600;white-space:nowrap}
|
||||
a{color:var(--c2);text-decoration:none;cursor:pointer}
|
||||
a:hover{text-decoration:underline}
|
||||
@@ -70,13 +74,14 @@ a:hover{text-decoration:underline}
|
||||
<label class="ck"><input type="checkbox" id="ckall" onchange="selAll(this)"> 全选</label>
|
||||
<button class="btn wb danger" id="bdel" disabled onclick="delSel()">删除所选 (0)</button>
|
||||
</div>
|
||||
<div class="tw">
|
||||
<div class="tw" id="tw">
|
||||
<table id="tb">
|
||||
<colgroup id="cg"></colgroup>
|
||||
<thead id="th"></thead>
|
||||
<tbody id="tbody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pager" id="pager"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -178,8 +183,22 @@ function render(){
|
||||
x.can_reparse === false, x.manual === true]); /* [13] 源文件缺失(决策 94) [14] 手工工程 */ // [1]=序号占位
|
||||
const view=sortRows(rows, ST.k, ST.dir, SES_NUM);
|
||||
view.forEach((r,i)=>{ r[1]=view.length-i; }); /* 序号倒序编号(与后台入库项目一致:第一行=总数,往下递减);默认序=打开时间越新越靠前(服务端 id 倒序=打开时间倒序,同名工程后端只留最近一次,2026-10-07 主人定) */
|
||||
/* 2026-10-22 主人定:显示区按最大行撑满(.tw flex 撑满窗口余量),行数超可视范围=前端分页
|
||||
(只改显示,接口/数据不动)。每页行数按表格区实际高度÷行高动态算,窗口缩放自动跟随。 */
|
||||
const tw=$('tw');
|
||||
const thH=$('th').getBoundingClientRect().height||30;
|
||||
const rowH=PAG.rowH||29;
|
||||
const size=Math.max(1,Math.floor(((tw?tw.clientHeight:0)-thH-4)/rowH)||1); /* 容器未就绪时兜底 1 行,绝不让 render 抛错 */
|
||||
PAG.size=size;
|
||||
let rowsToShow=view;
|
||||
if(view.length>size){
|
||||
const tp=Math.max(1,Math.ceil(view.length/size));
|
||||
if(PAG.p>tp) PAG.p=tp; if(PAG.p<1) PAG.p=1;
|
||||
const st=(PAG.p-1)*size;
|
||||
rowsToShow=view.slice(st,st+size);
|
||||
}else PAG.p=1;
|
||||
let h='';
|
||||
view.forEach(r=>{
|
||||
rowsToShow.forEach(r=>{
|
||||
const srcCell = r[14]
|
||||
? `<span class="manualtag" title="手工工程:没有源文件,不能按原格式导出/重新解析;用「打开项目」选择同名源文件可补传">手工创建</span>`
|
||||
: (r[13]
|
||||
@@ -203,8 +222,26 @@ function render(){
|
||||
</td></tr>`;
|
||||
});
|
||||
$('tbody').innerHTML=h||`<tr><td colspan="${SCOLS.length}" class="empty">没有匹配的会话</td></tr>`;
|
||||
/* 行高实测回填(行高变了且正在分页 → 重算一次;rowH 稳定后不再二次渲染) */
|
||||
const fr=$('tbody').firstElementChild;
|
||||
if(fr && !fr.classList.contains('empty')){
|
||||
const rh=fr.getBoundingClientRect().height;
|
||||
if(rh && Math.abs(rh-(PAG.rowH||0))>0.5){ PAG.rowH=rh; if(view.length>PAG.size){ render(); return; } }
|
||||
}
|
||||
/* 分页条:只有超页时显示 */
|
||||
const pg=$('pager');
|
||||
if(view.length>PAG.size){
|
||||
const tp=Math.ceil(view.length/PAG.size);
|
||||
pg.style.display='flex';
|
||||
pg.innerHTML='<span class="tip">共 '+view.length+' 行 · 第 '+PAG.p+' / '+tp+' 页 · 每页 '+PAG.size+' 行</span>'
|
||||
+'<button class="btn wb" onclick="pgGo(-1)"'+(PAG.p<=1?' disabled':'')+'>上一页</button>'
|
||||
+'<button class="btn wb" onclick="pgGo(1)"'+(PAG.p>=tp?' disabled':'')+'>下一页</button>';
|
||||
}else pg.style.display='none';
|
||||
updDel();
|
||||
}
|
||||
/* 分页翻页(前端切片,不动数据) */
|
||||
const PAG={p:1,size:0,rowH:0};
|
||||
function pgGo(d){ PAG.p+=d; render(); }
|
||||
function selAll(el){ document.querySelectorAll('.f-sel').forEach(x=>x.checked=el.checked); updDel(); }
|
||||
function updDel(){
|
||||
const n=document.querySelectorAll('.f-sel:checked').length;
|
||||
|
||||
Reference in New Issue
Block a user