feat(ui): 决策50-58 规格批次——打开工程弹框清理、分组过滤优化、最近审核改版、原数据汇总分析改版、公共拖列/弹框拖动
This commit is contained in:
@@ -177,24 +177,39 @@ a:hover{text-decoration:underline}
|
||||
.pnode.on{background:#2563eb;color:#fff}
|
||||
.pnode.on .cnt{color:#dbe7ff}
|
||||
.pnode .ops{display:none;flex:none;gap:2px}
|
||||
.pnode:hover .ops,.pnode.ops-on .ops,.pnode.on .ops{display:inline-flex}
|
||||
/* ↑ 选中目录的按钮排常显(2026-10-13 主人找不到"+子目录"入口):
|
||||
悬停可见照旧,选中的那一行不用悬停也能看到全部按钮 */
|
||||
/* 2026-10-13 主人定(决策 48):目录行内不再挂操作按钮——
|
||||
+子 +平级 ✎ ↑ ↓ ✕ 全部收编到根目录工具排(.rtbar),作用于「当前选中的目录」。
|
||||
.ops 现在只剩两处行内状态 UI:改名输入行的 ✓✕、上下移/删除的二次确认条。 */
|
||||
.pnode .ops.ops-on{display:inline-flex}
|
||||
/* 展开 / 折叠把手(2026-10-13 主人定):有子级 ▸/▾ 可点;叶子透明占位保持同级对齐 */
|
||||
.pnar{flex:none;width:14px;height:15px;line-height:13px;text-align:center;cursor:pointer;
|
||||
color:#6b7280;font-size:10px;border-radius:3px;user-select:none}
|
||||
.pnar:hover{background:#dbe5f2;color:var(--c1)}
|
||||
.pnar.em{visibility:hidden}
|
||||
.pkids{margin-left:16px;border-left:1px dotted #cbd5e1;padding-left:4px}
|
||||
/* 目录栏宽度拖动条(2026-10-13 主人定:左右拖动调整目录容器宽度) */
|
||||
#presizer{width:6px;flex:none;cursor:col-resize;background:transparent}
|
||||
#presizer:hover,#presizer.on{background:#c9d4e2}
|
||||
/* 目录栏分隔条(2026-10-13 决策 49 主人定):外观/收展与原数据左树 .rawsplit 完全同款
|
||||
(样式在 common.css,这里只补价格布局的收起态与拖动光标两条);
|
||||
旧的 #presizer 裸条样式已删(被 .rawsplit 取代)。
|
||||
⚠️ 收起必须 !important:detLayout 给 #dside 写了行内 display(弹框显隐单一写入点),
|
||||
类规则 otherwise 压不过它;收起态跟原数据树一样在本页存续(重开明细不弹回,刷新才复位)。 */
|
||||
#dbody.pclosed #dside{display:none !important}
|
||||
#dbody.pclosed #presizer{width:14px;margin-left:0} /* 收起后把手条加宽,好点 */
|
||||
body.rawcol-dragging #dside{pointer-events:none} /* 拖过目录树表面不选中文字(同 .rawtree 规则) */
|
||||
.pnode .ops span{min-width:17px;height:17px;padding:0 2px;border-radius:4px;background:#fff;border:1px solid #c9d4e2;
|
||||
color:#34506f;font-size:11px;line-height:15px;text-align:center;cursor:pointer;white-space:nowrap}
|
||||
.pnode .ops span:hover{background:var(--c2);color:#fff;border-color:var(--c2)}
|
||||
.pnode .ops span.pd:hover{background:#c0392b;border-color:#c0392b} /* 删除 / 取消:红 */
|
||||
.pnode .ops span.pk:hover{background:#1a7f37;border-color:#1a7f37} /* 确认:绿 */
|
||||
.pnode input.ren{width:120px;padding:1px 6px;font-size:12px;border-radius:4px;border:1px solid #9fb6d4}
|
||||
/* 根目录工具排(2026-10-13 决策 48 主人定):+子目录 +平级 ✎ ↑ ↓ ✕ 常驻在此,
|
||||
作用于选中的目录;(未分类)被选中时除「+子目录」外全部禁用(灰 + 禁止光标 + 提示) */
|
||||
.rtbar{display:flex;align-items:center;gap:3px;flex-wrap:wrap;padding:2px 6px 7px 22px}
|
||||
.rtbar span{min-width:17px;height:17px;padding:0 4px;border-radius:4px;background:#fff;border:1px solid #c9d4e2;
|
||||
color:#34506f;font-size:11px;line-height:15px;text-align:center;cursor:pointer;white-space:nowrap;user-select:none}
|
||||
.rtbar span:hover{background:var(--c2);color:#fff;border-color:var(--c2)}
|
||||
.rtbar span.pd:hover{background:#c0392b;border-color:#c0392b} /* 删除:红 */
|
||||
.rtbar span.dis{color:#b8c2cf;background:#f4f6f9;border-color:#e2e8f0;cursor:not-allowed}
|
||||
.rtbar span.dis:hover{color:#b8c2cf;background:#f4f6f9;border-color:#e2e8f0}
|
||||
.pnode .cfm{display:inline-flex;gap:3px;align-items:center;background:#fff7e6;border:1px solid #f0d9a8;
|
||||
border-radius:4px;padding:1px 4px;font-size:11px;color:#8a6d1a;flex:none}
|
||||
/* .pkids 的缩进规则统一放上面把手那组(16px,2026-10-13 加深层级),这里不再重复定义 */
|
||||
@@ -290,8 +305,9 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
<div class="tabs" id="dtabs"></div>
|
||||
<div class="db" id="dbody">
|
||||
<div id="dside" style="display:none"></div>
|
||||
<!-- 价格明细目录栏宽度拖动条(2026-10-13 主人定:左右拖动调宽;与 dside 同步显隐) -->
|
||||
<div id="presizer" style="display:none"></div>
|
||||
<!-- 价格明细目录栏分隔条(2026-10-13 决策 49 主人定:换原数据左树同款把手及形式——
|
||||
6px 分隔条 + 正中 ◀ 小把手点一下收起/展开目录栏;拖动调宽照旧、宽度照记忆) -->
|
||||
<div id="presizer" class="rawsplit" style="display:none"><span class="splitbtn" title="收起/展开目录树">◀</span></div>
|
||||
<!-- 类似清单(p2)的左组目录树(2026-10-08 主人定:后台同工作台;仅该标签显示) -->
|
||||
<div id="simtree" style="display:none"></div>
|
||||
<div id="dright">
|
||||
@@ -322,6 +338,8 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
<a id="reloadsim" style="display:none;margin-left:14px" href="javascript:void(0)"
|
||||
onclick="ldWrap('','正在重新分组(不用缓存,工程大要稍等)…',()=>loadTab('p2',true))"
|
||||
title="不用缓存,按当前批次数据与分组规则重新分组(工程大要稍等)">⟳ 重载</a>
|
||||
<!-- 原数据单位工程级的层级按钮挂点(2026-10-13 决策 58:分组/清单/定额/默认列宽 迁到这里最右) -->
|
||||
<span id="rawLvMount" style="margin-left:auto;display:inline-flex;gap:4px;align-items:center"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -534,7 +552,7 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="common.js?v=20261013e"></script>
|
||||
<script src="common.js?v=20261013m"></script>
|
||||
<script src="period.js"></script>
|
||||
<script>
|
||||
const $=id=>document.getElementById(id);
|
||||
@@ -720,7 +738,12 @@ async function load(p){
|
||||
const tw=document.querySelector('.tw');
|
||||
if(tw) tw.style.maxHeight=availHeight()+'px'; // 容器高与行数同源:不空白、不出竖向滚动条
|
||||
// 伸缩列定宽:用户拖过的比例记忆优先(2026-10-11 主人定),无记忆才按内容定宽(期次不再过宽、名称不再截断)
|
||||
requestAnimationFrame(()=>{ if(!flexMemApply($('tb'),cols)) fitFlexByContent(cols); });
|
||||
// 2026-10-13 决策 49:先摘掉上次「拖动那一刻」转出的 sumw 态与表宽(公共拖动器所见)——
|
||||
// 不摘的话残留的 style.width 会压过本次撑满计算,拖过一次就再也回不到撑满。
|
||||
requestAnimationFrame(()=>{
|
||||
delete $('tb').dataset.sumw; $('tb').style.width='';
|
||||
if(!flexMemApply($('tb'),cols)) fitFlexByContent(cols);
|
||||
});
|
||||
// 行高校准(只自校正一次,防循环):首行实测高度回填 ROWH;仍溢出就按实测减行数重取本页
|
||||
requestAnimationFrame(()=>{
|
||||
const rows=tb.tBodies[0].rows;
|
||||
@@ -871,19 +894,42 @@ function renderTree(){
|
||||
dside.innerHTML=`
|
||||
<div class="tot${PD.fold[0]?' collapsed':''}">
|
||||
<div class="lab"><span class="ar" onclick="pdFold(0)" title="展开 / 折叠">▾</span>${esc(dt.textContent)}
|
||||
<span style="font-weight:400;color:#6b7280;font-size:11.5px">(${grand} 条)</span>
|
||||
<span class="ops" style="display:inline-flex"><span onclick="event.stopPropagation();dirAddRoot()" title="新增一级目录">+子目录</span></span>
|
||||
</div>
|
||||
<span style="font-weight:400;color:#6b7280;font-size:11.5px">(${grand} 条)</span></div>
|
||||
${rootBarHTML()}
|
||||
<div class="children">${renderNodes(PD.tree,0,0)}
|
||||
<div class="pnode${PD.cur===0?' on':''}" style="${PD.cur===0?'':'color:#9aa4b2'}" onclick="pickDir(0)">
|
||||
<span class="pnar em"></span><span class="nm">(未分类)</span><span class="cnt">${PD.nUncat}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="treefoot"><div class="tipp">
|
||||
点 ▸/▾ 展开 / 折叠;悬停目录出按钮(选中的常显):+子 +平级 ✎ ↑ ↓ ✕(↑↓✕ 均需二次确认)。<br>
|
||||
只有最底层目录(没有子目录)可以挂价格行、新增行。拖动右侧分隔条可调目录栏宽度。
|
||||
先点选目录,再用上方根目录按钮:+子目录 +平级 ✎ ↑ ↓ ✕(↑↓✕ 均需二次确认)。<br>
|
||||
只有最底层目录(没有子目录)可以挂价格行、新增行。拖右侧分隔条调目录栏宽度(会记住),正中小把手可收起/展开。
|
||||
</div></div>`;
|
||||
}
|
||||
/* ---- 根目录工具排(2026-10-13 决策 48 主人定:行内按钮全部收编到这里)----
|
||||
六个按钮作用于「当前选中的目录」(PD.cur);(未分类)是虚拟节点不可改删移 ——
|
||||
除「+子目录」(此时=新增一级目录,与旧根按钮行为一致)外全部禁用并说明原因。 */
|
||||
function rtBtn(txt,title,fn,pd,on){
|
||||
const off=(on===false);
|
||||
const cls=((off?'dis ':'')+(pd?'pd':'')).trim();
|
||||
return `<span${cls?` class="${cls}"`:''} title="${off?'(未分类)不是真实目录:请先点选一个目录':title}"`
|
||||
+ (off?'':` onclick="event.stopPropagation();${fn}"`)+`>${txt}</span>`;
|
||||
}
|
||||
function rootBarHTML(){
|
||||
const ok=!!PDMAP[PD.cur];
|
||||
return `<div class="rtbar">`
|
||||
+ rtBtn('+子目录', ok?'在选中目录下新增子目录':'新增一级目录', 'dirAddSel()')
|
||||
+ rtBtn('+平级','在选中目录后面插入平级目录','dirAddSibSel()',0,ok)
|
||||
+ rtBtn('✎','重命名选中目录','dirRenSel()',0,ok)
|
||||
+ rtBtn('↑','上移选中目录(需确认)','dirCfmSel(\'up\')',0,ok)
|
||||
+ rtBtn('↓','下移选中目录(需确认)','dirCfmSel(\'down\')',0,ok)
|
||||
+ rtBtn('✕','删除选中目录(需确认)','dirCfmSel(\'del\')',1,ok)
|
||||
+ `</div>`;
|
||||
}
|
||||
function dirAddSel(){ if(PDMAP[PD.cur]) dirAddChild(PD.cur); else dirAddRoot(); }
|
||||
function dirAddSibSel(){ if(PDMAP[PD.cur]) dirAddSib(PD.cur); }
|
||||
function dirRenSel(){ if(PDMAP[PD.cur]) dirRen(PD.cur); }
|
||||
function dirCfmSel(op){ if(PDMAP[PD.cur]) dirCfm(PD.cur,op); }
|
||||
function pdFold(id){ PD.fold[id]=!PD.fold[id]; renderTree(); }
|
||||
function renderNodes(ns,parent,depth){
|
||||
let h='';
|
||||
@@ -923,15 +969,9 @@ function nodeHTML(n){
|
||||
<span class="cfm">${lbl}<span class="pk" onclick="${stop}dirGo(${n.id},'${PD.cfm.op}')">确认</span>
|
||||
<span class="pd" onclick="${stop}pdClear();renderTree()">取消</span></span>`;
|
||||
} else {
|
||||
mid=`<span class="nm" title="${esc(PDMAP[n.id].path)}">${esc(n.name)}</span><span class="cnt">${cnt}</span>
|
||||
<span class="ops">
|
||||
<span title="新增子目录" onclick="${stop}dirAddChild(${n.id})">+子</span>
|
||||
<span title="新增平级目录" onclick="${stop}dirAddSib(${n.id})">+平级</span>
|
||||
<span title="改名" onclick="${stop}dirRen(${n.id})">✎</span>
|
||||
<span title="上移(需确认)" onclick="${stop}dirCfm(${n.id},'up')">↑</span>
|
||||
<span title="下移(需确认)" onclick="${stop}dirCfm(${n.id},'down')">↓</span>
|
||||
<span class="pd" title="删除(需确认)" onclick="${stop}dirCfm(${n.id},'del')">✕</span>
|
||||
</span>`;
|
||||
// 2026-10-13 决策 48:行内不再挂 +子/+平级/✎/↑/↓/✕ —— 全部收编到根目录工具排(rootBarHTML),
|
||||
// 这里只留名称 + 条数;改名输入、二次确认两类「状态 UI」仍就地显示在行内。
|
||||
mid=`<span class="nm" title="${esc(PDMAP[n.id].path)}">${esc(n.name)}</span><span class="cnt">${cnt}</span>`;
|
||||
}
|
||||
return `<div class="pnode${cur?' on':''}" onclick="pickDir(${n.id})">${ar}${mid}</div>`;
|
||||
}
|
||||
@@ -980,7 +1020,12 @@ async function dirGo(id,op){
|
||||
function renderRows(){
|
||||
const cg=$('dcg'), th=$('dth'), tb=$('dtbd');
|
||||
cg.innerHTML=COL_PRICE.map(c=>`<col style="width:${c.w}px">`).join('');
|
||||
th.innerHTML='<tr>'+COL_PRICE.map(c=>`<th>${c.t}</th>`).join('')+'</tr>';
|
||||
// 表头挂 .rs 拖动把手(headHTML 同款):2026-10-12 重做时漏了把手,价格表列宽此前根本拖不动
|
||||
th.innerHTML='<tr>'+COL_PRICE.map(c=>`<th class="${c.a}">${c.t}<span class="rs"></span></th>`).join('')+'</tr>';
|
||||
// 2026-10-13 决策 48:价格明细表也入「全列宽都记」口径 —— ① sumw 摘掉工料机视图可能残留的
|
||||
// flex 状态(一张表轮画三视图,不摘会导致拖列拿上一视图的列定义分摊);② colwApply 回套记忆,
|
||||
// 此前拖完只存不套(切目录/换批次重画即还原,主人报「拉宽不见了」的另一半原因)。
|
||||
sumw($('dtb')); colwApply($('dtb'));
|
||||
// 工具行状态:新增行只在最底层目录可用;编辑/新增时显示「所属目录」下拉
|
||||
const b=$('padd');
|
||||
if(PD.curLeaf){ b.classList.remove('dis'); b.disabled=false; b.title=''; }
|
||||
@@ -1513,17 +1558,32 @@ document.querySelectorAll('#mask .tab').forEach(t=>t.onclick=()=>{
|
||||
ldWrap('', TAB_STAGE[t.dataset.p]||'正在加载…', ()=>loadTab(t.dataset.p));
|
||||
});
|
||||
|
||||
/* 价格明细目录栏:拖动右侧分隔条调宽(2026-10-13 主人定),180~560px 之间 */
|
||||
/* 价格明细目录栏分隔条(2026-10-13 决策 49 主人定:与原数据左树 rawSplitInit 同款形式)——
|
||||
① 按住左右拖 = 调目录栏宽(180~560px,panelMem 记忆);
|
||||
② 正中 ◀ 小把手点一下 = 收起/展开目录栏(收起后把手仍在,随时点回来);
|
||||
③ 拖动中 body 挂 rawcol-dragging(光标钉住 + 目录树不选中文字,与原数据同一套 CSS)。 */
|
||||
(function(){
|
||||
var pz=document.getElementById('presizer');
|
||||
if(!pz) return;
|
||||
var ds=document.getElementById('dside');
|
||||
var box=document.getElementById('dbody');
|
||||
var btn=pz.querySelector('.splitbtn');
|
||||
// 进页面先恢复上次拖的宽(元素一直在 DOM 里,套一次内联宽即可,显隐不影响)
|
||||
if(ds){ var mw=panelMemLoad('price_dir',180,560); if(mw) ds.style.width=mw+'px'; }
|
||||
btn.addEventListener('click', function(){
|
||||
var closed=box.classList.toggle('pclosed');
|
||||
btn.textContent=closed?'▶':'◀';
|
||||
btn.title=closed?'展开目录树':'收起目录树';
|
||||
});
|
||||
pz.addEventListener('mousedown', function(e){
|
||||
if(e.target===btn) return; // 小把手只管收展,不参与拖动(同原数据)
|
||||
e.preventDefault();
|
||||
var ds=document.getElementById('dside');
|
||||
document.body.classList.add('rawcol-dragging');
|
||||
var x0=e.clientX, w0=ds.getBoundingClientRect().width;
|
||||
function mv(ev){ ds.style.width=Math.min(560,Math.max(180,w0+ev.clientX-x0))+'px'; }
|
||||
function up(){ document.removeEventListener('mousemove',mv); document.removeEventListener('mouseup',up); pz.classList.remove('on'); }
|
||||
pz.classList.add('on');
|
||||
function up(){ document.removeEventListener('mousemove',mv); document.removeEventListener('mouseup',up);
|
||||
document.body.classList.remove('rawcol-dragging');
|
||||
var w=parseFloat(ds.style.width); if(w>0) panelMemSave('price_dir',w); }
|
||||
document.addEventListener('mousemove',mv);
|
||||
document.addEventListener('mouseup',up);
|
||||
});
|
||||
|
||||
@@ -241,10 +241,12 @@ function billSortDOM(tb) {
|
||||
拖一列的手柄 → 改 colgroup 里对应 <col> 的宽度;table-layout:fixed 下整列跟着变,
|
||||
不用逐行改宽度。委托在 document 上:4 个标签 + 原数据里新画的表格都能直接拖,
|
||||
重画表格后不必重新绑定。
|
||||
2026-10-07 起**全项目统一**「拖列只动被拖列」:带 data-sumw 的表,表宽 = 列宽之和
|
||||
(sumw() 在每次重建 colgroup 后设置),拖动器同步总宽 —— 其余列一毫米不动。 */
|
||||
2026-10-13 决策 49(主人定「默认撑满没有问题,但是拉动的时候,按拉动」):
|
||||
撑满/补宽表在**拖动那一刻**就地转「拖列只动被拖列」——摘掉 flex 分摊 / attrfill 补宽,
|
||||
转 sumw(表宽=列宽和),拖动只改被拖列、表右缘跟着走(超宽出横向滚动条,同原数据)。
|
||||
各页默认渲染照旧撑满(重画/换视图即恢复),这里不碰任何 load 逻辑。 */
|
||||
(function () {
|
||||
let cur = null, col = null, cg = null, x0 = 0, w0 = 0;
|
||||
let cur = null, col = null, cg = null, x0 = 0, w0 = 0, flexCols = null;
|
||||
document.addEventListener('mousedown', function (e) {
|
||||
const h = e.target.closest && e.target.closest('.rs');
|
||||
if (!h) return; // 点在别处:不动
|
||||
@@ -256,6 +258,30 @@ function billSortDOM(tb) {
|
||||
col = cg.children[idx];
|
||||
if (!col) return;
|
||||
cur = h; x0 = e.clientX; w0 = parseFloat(col.style.width) || th.offsetWidth || 80;
|
||||
flexCols = null;
|
||||
// 撑满分摊表(flex)/ 项目特征补宽表(attrfill):转「拖列只动被拖列」
|
||||
if (tb.dataset.flex === '1' || tb._attrCol != null) {
|
||||
flexCols = tb._cols || null; // mouseup 据此更新比例记忆(flexMemSave 认 _cols)
|
||||
if (tb._attrRO) { tb._attrRO.disconnect(); tb._attrRO = null; }
|
||||
tb._attrCol = null; tb._attrBase = null; tb._attrCols = null;
|
||||
delete tb.dataset.attrfill;
|
||||
sumw(tb); // 摘 flex/_cols/flexfit,标记 data-sumw,表宽=列宽和
|
||||
}
|
||||
// 2026-10-13 主人定(原数据 BUG「右边框钉死在屏幕边」):混宽表(含 auto/百分名列,
|
||||
// 如汇总分析/工料机的名称、规格列)拖动前把非 px 列**就地冻结成实宽**再转 sumw ——
|
||||
// 否则 fixed+100% 布局下拖列其他列回缩,右边框永远不动。
|
||||
if (!tb.dataset.sumw && tb.dataset.flex !== '1' && tb._attrCol == null) {
|
||||
const colsArr = Array.prototype.slice.call(cg.children);
|
||||
if (!colsArr.every(c => /px\s*$/.test((c.style.width || '').trim()))) {
|
||||
colsArr.forEach((c, i) => {
|
||||
if (!/px\s*$/.test((c.style.width || '').trim())) {
|
||||
const thw = (th.parentNode.children[i] || {}).offsetWidth;
|
||||
c.style.width = Math.max(30, thw || 80) + 'px';
|
||||
}
|
||||
});
|
||||
sumw(tb);
|
||||
}
|
||||
}
|
||||
document.body.style.cursor = 'col-resize';
|
||||
e.preventDefault();
|
||||
});
|
||||
@@ -268,15 +294,40 @@ function billSortDOM(tb) {
|
||||
document.addEventListener('mouseup', function () {
|
||||
if (!cur) return;
|
||||
const tb = col && col.closest('table');
|
||||
const idx = (col && cg) ? Array.prototype.indexOf.call(cg.children, col) : -1;
|
||||
const wasFlexCols = flexCols; flexCols = null;
|
||||
cur = null; col = null; cg = null; document.body.style.cursor = '';
|
||||
if (!tb) return;
|
||||
// 固定+伸缩列表(data-flex):拖动=从其它伸缩列等量挪,总宽贴合容器,不做记忆;
|
||||
// 其余表照旧记入 localStorage(2026-10-07)
|
||||
if (tb.dataset.flex === '1') { if (typeof flexRedistribute === 'function') flexRedistribute(tb, idx); }
|
||||
// 撑满表拖过:按拖后实际列宽更新**比例**记忆(下次撑满按新比例回放);
|
||||
// 绝对列宽记忆对撑满表无意义(重画即被撑满逻辑盖掉),不写。
|
||||
// 其余表(本来就走 sumw+colw 口径)照旧记入 localStorage(2026-10-07)。
|
||||
if (wasFlexCols) { tb._cols = wasFlexCols; flexMemSave(tb); tb._cols = null; }
|
||||
else colwSave(tb);
|
||||
// 补宽列表(attrFillBind)拖完立刻重贴伸缩列:拖宽其他列时余量跟着走,不挤出横向滚动条
|
||||
if (tb._attrCol != null) attrRefill(tb);
|
||||
});
|
||||
/* 2026-10-13 主人定(公共功能):双击列宽把手 = 该表回「软件默认列宽」——清 绝对列宽/撑满比例
|
||||
两种记忆,套回首次干净渲染存下的默认宽(DEF_COLW);撑满表就地重分摊回默认。 */
|
||||
document.addEventListener('dblclick', function (e) {
|
||||
const h = e.target.closest && e.target.closest('.rs');
|
||||
if (!h) return;
|
||||
const tb = h.parentNode.closest && h.parentNode.closest('table');
|
||||
if (!tb || !tb.querySelector('colgroup')) return;
|
||||
const wasSumw = !!tb.dataset.sumw;
|
||||
const wasFlex = tb.dataset.flex === '1' || tb._attrCol != null;
|
||||
colwClear(tb);
|
||||
try { localStorage.removeItem('flexr|' + location.pathname + '|' + _colk(tb)); } catch (err) {}
|
||||
const defs = DEF_COLW[_colk(tb)];
|
||||
const cg = tb.querySelector('colgroup');
|
||||
if (defs && defs.length === cg.children.length) {
|
||||
Array.prototype.forEach.call(cg.children, (c, i) => { c.style.width = defs[i]; });
|
||||
if (defs.every(w => /px\s*$/.test(w))) {
|
||||
if (wasSumw) sumw(tb);
|
||||
} else {
|
||||
// 默认宽含弹性列:回自然布局(表宽随容器),摘掉拖动转出的 sumw 态
|
||||
delete tb.dataset.sumw;
|
||||
tb.style.width = '';
|
||||
}
|
||||
} else if (wasFlex && typeof flexRedistribute === 'function') {
|
||||
try { flexRedistribute(tb); } catch (err) {}
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -295,6 +346,7 @@ function _colkFromTexts(texts) {
|
||||
function _colk(tb) {
|
||||
return _colkFromTexts([...tb.querySelectorAll('thead th')].map(t => t.textContent || ''));
|
||||
}
|
||||
const DEF_COLW = {}; // 表头指纹 → 软件默认列宽(首次无记忆渲染时存;双击 .rs 把手回默认用)
|
||||
function _colwKey(tb) { return 'colw|' + location.pathname + '|' + _colk(tb); }
|
||||
function colwSave(tb) {
|
||||
const cg = tb.querySelector('colgroup');
|
||||
@@ -315,7 +367,11 @@ function colwApply(tb, deferred) {
|
||||
if (!cg || !cg.children.length) return;
|
||||
let saved = null;
|
||||
try { saved = JSON.parse(localStorage.getItem(_colwKey(tb)) || 'null'); } catch (e) {}
|
||||
if (!saved || saved.length !== cg.children.length) return;
|
||||
if (!saved || saved.length !== cg.children.length) {
|
||||
// 无记忆 = 当前就是软件默认列宽,存档供「双击把手回默认」(2026-10-13 公共功能)
|
||||
DEF_COLW[_colk(tb)] = Array.prototype.map.call(cg.children, c => c.style.width || 'auto');
|
||||
return;
|
||||
}
|
||||
Array.prototype.forEach.call(cg.children, (c, i) => { if (saved[i]) c.style.width = saved[i] + 'px'; });
|
||||
if (tb.dataset.sumw) sumw(tb); // 表宽=列宽和的表:套用后总宽重算
|
||||
if (tb._attrCol != null) attrRefill(tb); // 补宽列:套用记忆(只存基础宽)后重新贴合
|
||||
@@ -330,6 +386,27 @@ function colwClear(tb) {
|
||||
try { localStorage.removeItem(_colwKey(tb)); } catch (e) {}
|
||||
}
|
||||
|
||||
/* ---- 面板拖宽/拖高记忆(2026-10-13 决策 48,主人定:全项目公共功能)----
|
||||
分隔条拖出来的尺寸(目录栏宽 / 左树宽 / 面板高)按「页面 + 面板名」存 localStorage:
|
||||
前后台切换(整页跳转)、关掉明细再开、甚至关窗重开都照记忆恢复 ——
|
||||
不再「拖完切个页就丢」(此前只有列宽有记忆,面板拖宽一条都没有)。
|
||||
键口径与列宽记忆一致(panw| + location.pathname + 面板名),两侧页面各自记各自的。 */
|
||||
function panelMemSave(name, px) {
|
||||
const v = Math.round(+px);
|
||||
if (!isFinite(v) || v <= 0) return;
|
||||
try { localStorage.setItem('panw|' + location.pathname + '|' + name, String(v)); } catch (e) {}
|
||||
}
|
||||
function panelMemLoad(name, min, max) {
|
||||
try {
|
||||
const v = parseFloat(localStorage.getItem('panw|' + location.pathname + '|' + name));
|
||||
if (isFinite(v)) return Math.min(max, Math.max(min, v));
|
||||
} catch (e) {}
|
||||
return 0;
|
||||
}
|
||||
function panelMemClear(name) {
|
||||
try { localStorage.removeItem('panw|' + location.pathname + '|' + name); } catch (e) {}
|
||||
}
|
||||
|
||||
/* ---- 固定+伸缩列(2026-10-08 主人定:项目工料机全部字段撑满屏幕)----
|
||||
sumw 是 2026-10-07 定的全项目口径(表宽=列宽和);项目工料机是**例外**:
|
||||
固定列(标 'F')锁宽,伸缩列(名称/规格型号/备注)平分容器剩余宽度,
|
||||
@@ -800,8 +877,13 @@ function rawTbl(cols, head, body, al, sort) {
|
||||
// 列宽记忆回套(2026-10-11 主人定:原数据表拖完也要记住):构建期按表头指纹取记忆宽,
|
||||
// px 列替换默认宽;记忆里的 0 = 弹性列(见 colwSave 按列存),保持 auto 吸收余宽。
|
||||
let saved = null;
|
||||
try { saved = JSON.parse(localStorage.getItem('colw|' + location.pathname + '|' + _colkFromTexts(keep.map(i => Array.isArray(head[i]) ? head[i][0] : head[i]))) || 'null'); } catch (e) {}
|
||||
if (!saved || saved.length !== keep.length) saved = null;
|
||||
const fk = _colkFromTexts(keep.map(i => Array.isArray(head[i]) ? head[i][0] : head[i]));
|
||||
try { saved = JSON.parse(localStorage.getItem('colw|' + location.pathname + '|' + fk) || 'null'); } catch (e) {}
|
||||
if (!saved || saved.length !== keep.length) {
|
||||
saved = null;
|
||||
// 无记忆渲染 = 软件默认列宽,存档供「双击把手回默认」(2026-10-13 公共功能)
|
||||
DEF_COLW[fk] = keep.map(i => typeof cols[i] === 'number' ? cols[i] + 'px' : (cols[i] || 'auto'));
|
||||
}
|
||||
const cg = keep.map((i, k) => {
|
||||
let w;
|
||||
if (saved && saved[k] > 0) w = saved[k] + 'px';
|
||||
@@ -832,7 +914,7 @@ function rawKV(rows, tip) {
|
||||
if (!rows || !rows.length) return '<div class="empty">没有数据</div>';
|
||||
return (tip ? '<div class="hint">' + esc(tip) + '</div>' : '')
|
||||
+ '<table class="kvtb"><colgroup><col style="width:220px"><col></colgroup>'
|
||||
+ '<thead><tr><th>字段</th><th>值</th></tr></thead><tbody>'
|
||||
+ '<thead><tr><th>名称</th><th>值</th></tr></thead><tbody>' // 2026-10-13 主人定:字段→名称
|
||||
+ rows.map(r => '<tr><td>' + esc(r[0]) + '</td><td>' + esc(r[1] == null || r[1] === '' ? '—' : r[1]) + '</td></tr>').join('')
|
||||
+ '</tbody></table>';
|
||||
}
|
||||
@@ -846,7 +928,7 @@ function rawKV(rows, tip) {
|
||||
其余按中文比。排序状态跨重画保留(切单位工程后维持同一排序),换工程/重开明细复位。 */
|
||||
let RV_LME_SORT = { k: -1, dir: 1 };
|
||||
let RV_LME_ROWS = null, RV_LME_TIP = '';
|
||||
const RV_LME_NUM = new Set([5, 6, 7]); // 消耗量 / 除税价 / 含税价
|
||||
const RV_LME_NUM = new Set([6, 7, 8]); // 消耗量 / 除税价 / 含税价(2026-10-13 前移加序号列后 +1)
|
||||
function rawLmeSort(k) {
|
||||
if (RV_LME_SORT.k === k) RV_LME_SORT.dir = -RV_LME_SORT.dir;
|
||||
else { RV_LME_SORT.k = k; RV_LME_SORT.dir = 1; }
|
||||
@@ -857,19 +939,20 @@ function rawLmeTbl(rows, tip, qtyLabel) {
|
||||
rows = rows || [];
|
||||
RV_LME_ROWS = rows; RV_LME_TIP = tip || '';
|
||||
const view = sortRows(rows, RV_LME_SORT.k, RV_LME_SORT.dir, RV_LME_NUM); // 共用比较器(2026-10-09 收编)
|
||||
const body = view.map(r => {
|
||||
const body = view.map((r, i) => {
|
||||
const kind = RAW_LME_KIND
|
||||
? '<td class="c">' + esc(r[4] == null ? '—' : ({ 1: '人工', 2: '材料', 3: '机械', 4: '主材', 5: '设备' }[Number(r[4])] || r[4])) + '</td>'
|
||||
: '';
|
||||
return '<tr><td class="c">' + ell(r[0], '—') + '</td><td class="l">' + ell(r[1], '—') + '</td>'
|
||||
// 2026-10-13 主人定:加「序号」列(视图行号,随排序重排)
|
||||
return '<tr><td class="c">' + (i + 1) + '</td><td class="c">' + ell(r[0], '—') + '</td><td class="l">' + ell(r[1], '—') + '</td>'
|
||||
+ '<td class="l">' + ell(r[2], '—') + '</td>' + kind
|
||||
+ '<td class="c u">' + esc(r[3] || '—') + '</td><td class="r">' + r3(r[5]) + '</td>'
|
||||
+ '<td class="r">' + rm(r[6]) + '</td><td class="r">' + rm(r[7]) + '</td></tr>';
|
||||
}).join('');
|
||||
// 2026-10-08 主人定:名称/规格两列都给弹性宽('')—— fixed 布局下自动列均摊剩余空间,
|
||||
// 两列严格等宽、随容器自适应;其余列宽不变。表头统一居中见 common.css。
|
||||
const cols = RAW_LME_KIND ? [110, '', '', 60, 52, 90, 100, 100] : [110, '', '', 0, 52, 90, 100, 100];
|
||||
const head = [['编码', 'c'], ['名称', 'l'], ['规格', 'l'], ['类别', 'c'], ['单位', 'c'],
|
||||
const cols = RAW_LME_KIND ? [40, 110, '', '', 60, 52, 90, 100, 100] : [40, 110, '', '', 0, 52, 90, 100, 100];
|
||||
const head = [['序号', 'c'], ['编码', 'c'], ['名称', 'l'], ['规格', 'l'], ['类别', 'c'], ['单位', 'c'],
|
||||
[qtyLabel || '消耗量', 'r'], ['除税价', 'r'], ['含税价', 'r']];
|
||||
return (tip ? '<div class="hint">' + esc(tip) + '</div>' : '')
|
||||
+ rawTbl(cols, head, body || '<tr><td class="empty">没有工料机数据</td></tr>', null,
|
||||
@@ -884,16 +967,21 @@ function rawTabs() {
|
||||
st.style.display = 'flex';
|
||||
const T = RVSEL.k === 'proj' ? RAW_PT : RAW_UT;
|
||||
let h = T.map(t => '<div class="stab' + (RVTAB === t[0] ? ' on' : '') + '" onclick="rawTab(\'' + t[0] + '\')">' + t[1] + '</div>').join('');
|
||||
if (RVSEL.k === 'uw' && (RVTAB === 'item' || RVTAB === 'prelim')) {
|
||||
// 层级按钮:一键把所有节点重置到该档默认(分部=只到分部 / 清单=只到清单 / 定额=全展开);
|
||||
// 「默认列宽」是动作按钮,不做选中态
|
||||
h += '<div class="lvgrp">'
|
||||
+ ['1_分部', '2_清单', '3_定额'].map(x => {
|
||||
// 2026-10-13 主人定:层级按钮(分组/清单/定额/默认列宽)迁到「类似清单」⟳ 重载行的最右
|
||||
// (挂点 #rawLvMount,两页同款),原数据标签行内不再显示;非该挂点的页面走旧路兜底。
|
||||
// 层级按钮:一键把所有节点重置到该档默认(分组=只到分部 / 清单=只到清单 / 定额=全展开);
|
||||
// 「默认列宽」是动作按钮,不做选中态
|
||||
const lv = (RVSEL.k === 'uw' && (RVTAB === 'item' || RVTAB === 'prelim'))
|
||||
? '<div class="lvgrp">'
|
||||
+ ['1_分组', '2_清单', '3_定额'].map(x => {
|
||||
const v = Number(x[0]), nm = x.slice(2);
|
||||
return '<div class="lvbtn' + (RVLV === v ? ' on' : '') + '" onclick="rawLv(' + v + ')">' + nm + '</div>';
|
||||
}).join('')
|
||||
+ '<div class="lvbtn rst" onclick="rawRst()" title="把拖过的列宽全部还原">默认列宽</div></div>';
|
||||
}
|
||||
+ '<div class="lvbtn rst" onclick="rawRst()" title="把拖过的列宽全部还原">默认列宽</div></div>'
|
||||
: '';
|
||||
const mount = document.getElementById('rawLvMount');
|
||||
if (mount) mount.innerHTML = lv;
|
||||
else h += lv;
|
||||
st.innerHTML = h;
|
||||
}
|
||||
function rawTab(t) { RVTAB = t; rawTabs(); rawDraw(); }
|
||||
@@ -1008,7 +1096,7 @@ async function rawDraw() {
|
||||
if (RVSEL.k === 'proj') {
|
||||
const d = await rawFetch('/proj', _qid(RVO.idParam, oid) + '&tab=' + encodeURIComponent(RVTAB));
|
||||
if (RVTAB === 'sum') html = rawProj('sum', d.rows);
|
||||
else if (RVTAB === 'lme') html = rawLmeTbl(d.rows, '项目级 · 工料机汇总(读原文件 Project.xml 的项目级汇总原样,数量=总数量;点列名可排序)', '总数量');
|
||||
else if (RVTAB === 'lme') html = rawLmeTbl(d.rows, '', '总数量'); // 2026-10-13 主人定:取消顶部说明行
|
||||
else if (RVTAB === 'info') html = rawKV(Object.entries(d.rows || {}), '项目级 · 基本信息(Project.xml 根节点属性)');
|
||||
else html = rawKV((d.rows || []).map(f => [f.n, f.v]), '项目级 · 项目特征信息(Project.xml 的 AttrInfo / AddiInfo 条目,最多 60 条)');
|
||||
} else if (RVSEL.k === 'sec') {
|
||||
@@ -1017,7 +1105,7 @@ async function rawDraw() {
|
||||
const d = await rawFetch('/uw', 'uw_id=' + encodeURIComponent(RVSEL.id) + '&tab=' + encodeURIComponent(RVTAB));
|
||||
if (RVTAB === 'item' || RVTAB === 'prelim') html = rawTreeHTML(d);
|
||||
else if (RVTAB === 'lme') html = rawLmeTbl(d.rows,
|
||||
d.src === 'summary' ? '单位工程级 · 工料机汇总(读本单位工程 xml 的工料机汇总原样,数量=总数量;点列名可排序)'
|
||||
d.src === 'summary' ? '' // 2026-10-13 主人定:读 xml 原样口径取消说明行
|
||||
: '单位工程级 · 工料机汇总(按本单位工程的清单→定额→消耗量归集;点列名可排序)',
|
||||
d.src === 'summary' ? '总数量' : '消耗量');
|
||||
else html = rawUw('cost', d.rows);
|
||||
@@ -1160,8 +1248,8 @@ function rawTreeHTML(d) {
|
||||
};
|
||||
walk(divs, '', 0);
|
||||
loose.forEach(b => billRow(b, 'loose', 0));
|
||||
const tip = (d.n_div || 0) + ' 个分部 · ' + (d.n_bill || 0) + ' 条清单(原文件全量,未做任何过滤)';
|
||||
return '<div class="hint">' + esc(tip) + '</div>' + rawTbl(cols, head, rows, null, 'auto');
|
||||
// 2026-10-13 主人定:取消「N 个分部 · N 条清单(原文件全量,未做任何过滤)」提示行
|
||||
return rawTbl(cols, head, rows, null, 'auto');
|
||||
}
|
||||
function rawProj(tab, rows) {
|
||||
if (!rows || !rows.length) return '<div class="empty">没有数据</div>';
|
||||
@@ -1176,23 +1264,23 @@ function rawProj(tab, rows) {
|
||||
if (last && last.key === key) last.rows.push(r);
|
||||
else groups.push({ key: key, rows: [r] });
|
||||
});
|
||||
// 2026-10-13 主人定:加「序号」列——只有单位工程参与编号(单项工程标题行不编);
|
||||
// 取消 分部分项/措施项目/税金 三列与顶部 hint 行;名称列弹性吃余宽(≈65%),拖列走公共 .rs。
|
||||
let no = 0;
|
||||
const body = groups.map(g => {
|
||||
const sum = g.rows.reduce((a, r) => a + (r.Total || 0), 0);
|
||||
return '<tr class="gsec"><td class="l" colspan="6">' + esc(g.key)
|
||||
return '<tr class="gsec"><td class="l" colspan="4">' + esc(g.key)
|
||||
+ ' · ' + g.rows.length + ' 个单位工程 · 合计 ' + rm(sum) + '</td></tr>'
|
||||
+ g.rows.map(r =>
|
||||
'<tr><td class="l">' + ell(r.Name, '—') + '</td>'
|
||||
+ '<td class="r">' + rm(r.DivisionalAndElementalWorks) + '</td>'
|
||||
+ '<td class="r">' + rm(r.Preliminaries) + '</td><td class="r">' + rm(r.Tax) + '</td>'
|
||||
'<tr><td class="c">' + (++no) + '</td>'
|
||||
+ '<td class="l">' + ell(r.Name, '—') + '</td>'
|
||||
+ '<td class="r">' + rm(r.Total) + '</td>'
|
||||
+ '<td class="r">' + ((r.Total || 0) / tot * 100).toFixed(3) + '</td></tr>').join('');
|
||||
}).join('');
|
||||
return '<div class="hint">项目级 · 汇总分析 —— 与左侧目录同结构同序(合计 ' + rm(tot)
|
||||
+ ',与项目总造价的差额=税金/其他项目/安全生产费)</div>'
|
||||
// 单位工程名称列弹性宽('')填满容器,其余列固定宽(2026-10-08 口径不变)
|
||||
+ rawTbl(['', 100, 100, 90, 110, 60],
|
||||
[['单位工程名称', 'l'], ['分部分项', 'r'], ['措施项目', 'r'], ['税金', 'r'], ['总造价', 'r'], ['占总价%', 'r']],
|
||||
body);
|
||||
// 单位工程名称列弹性宽('')吸收余宽(≈65%),其余固定;拖列/列宽记忆走公共 rawTbl 口径
|
||||
return rawTbl([40, '', 110, 60],
|
||||
[['序号', 'c'], ['单位工程名称', 'l'], ['总造价', 'r'], ['占总价%', 'r']],
|
||||
body);
|
||||
}
|
||||
function rawSec(d) {
|
||||
const s = d.sec || {}, rows = d.rows || [];
|
||||
@@ -1211,7 +1299,7 @@ function rawUw(tab, rows) {
|
||||
const r = rows || {};
|
||||
const K = [['Total', '总造价'], ['Construction', '建筑安装工程费'], ['DivisionalAndElementalWorks', '分部分项工程费'],
|
||||
['Preliminaries', '措施项目费'], ['CostForHSE', '绿色施工安全防护费'], ['SundryCosts', '其他项目费'], ['Tax', '税金']];
|
||||
return rawKV(K.map(x => [x[1], r[x[0]] == null ? '—' : rm(r[x[0]])]), '单位工程级 · 汇总分析(造价构成,来自原文件)');
|
||||
return rawKV(K.map(x => [x[1], r[x[0]] == null ? '—' : rm(r[x[0]])]), ''); // 2026-10-13 主人定:取消说明行
|
||||
}
|
||||
|
||||
/* ---- 点定额行 → 下方「子目工料机」面板 ----
|
||||
@@ -1246,9 +1334,11 @@ function rawNorm(nid, name, tr) {
|
||||
// 列序(后端 _norm_res):0编码 1名称 2规格 3单位 4类别 5含量 6除税价 7含税价 8有下一级
|
||||
// 2026-10-07 改版:① ± 把手**单独一列放最左**(与全软件的展开把手同款);
|
||||
// ② 「类别」列整个不输出(主人定;同 rawLmeTbl 的 RAW_LME_KIND=0 口径)。
|
||||
const body = rows.map(x => {
|
||||
const body = rows.map((x, i) => {
|
||||
const has = x[8] === 1 || x[8] === '1';
|
||||
// 2026-10-13 主人定:把手右边加「序号」列(视图行号)
|
||||
return '<tr><td class="tgc">' + (has ? '<span class="tgi" title="展开/收起组成">+</span>' : '') + '</td>'
|
||||
+ '<td class="c">' + (i + 1) + '</td>'
|
||||
+ '<td class="c">' + ell(x[0], '—') + '</td>'
|
||||
+ '<td class="l">' + ell(x[1], '—') + '</td>'
|
||||
+ '<td class="l">' + ell(x[2], '—') + '</td>'
|
||||
@@ -1258,8 +1348,8 @@ function rawNorm(nid, name, tr) {
|
||||
+ '<td class="r">' + rm(x[7]) + '</td></tr>';
|
||||
}).join('');
|
||||
np.querySelector('.npbody').innerHTML = rows.length
|
||||
? rawTbl([34, 130, 220, 150, 56, 90, 100, 100],
|
||||
[['', 'c'], ['编码', 'c'], ['名称', 'l'], ['规格', 'l'], ['单位', 'c'], ['含量', 'r'], ['除税价', 'r'], ['含税价', 'r']], body)
|
||||
? rawTbl([34, 40, 130, 220, 150, 56, 90, 100, 100],
|
||||
[['', 'c'], ['序号', 'c'], ['编码', 'c'], ['名称', 'l'], ['规格', 'l'], ['单位', 'c'], ['含量', 'r'], ['除税价', 'r'], ['含税价', 'r']], body)
|
||||
: '<div class="empty">这条定额下没有工料机</div>';
|
||||
RV_NORM_CACHE[nid] = np.querySelector('.npbody').innerHTML;
|
||||
bindNormRes(np);
|
||||
@@ -1271,7 +1361,7 @@ function bindNormRes(np) {
|
||||
s.onclick = function (e) { e.stopPropagation(); rawRes(x_code(s), s.closest('tr')); };
|
||||
});
|
||||
}
|
||||
function x_code(s) { return s.closest('tr').children[1].textContent.trim(); }
|
||||
function x_code(s) { return s.closest('tr').children[2].textContent.trim(); } // 2026-10-13 加序号列后编码移到第 3 格
|
||||
/* 台班 / 配合比的**下一级组成**(tr.resk):值与 _norm_res 同仰面料序,单独一行「组成」色 + 缩进。
|
||||
列与子目工料机主表同构(把手/编码/名称/规格/单位/含量/除税/含税),把手列只占位不挂 ±。 */
|
||||
function rawRes(code, tr) {
|
||||
@@ -1288,12 +1378,12 @@ function rawRes(code, tr) {
|
||||
tr.dataset.open = '1'; const m = tr.querySelector('.tgi'); if (m) m.textContent = '−';
|
||||
const frag = document.createElement('tbody');
|
||||
frag.innerHTML = rows.length
|
||||
? rows.map(x => '<tr class="resk"><td class="tgc"></td><td class="c">' + ell(x[0], '—') + '</td>'
|
||||
? rows.map(x => '<tr class="resk"><td class="tgc"></td><td></td><td class="c">' + ell(x[0], '—') + '</td>'
|
||||
+ '<td class="l">' + ell(x[1], '—') + '</td>'
|
||||
+ '<td class="l">' + ell(x[2], '—') + '</td><td class="c">' + esc(x[3] || '—') + '</td>'
|
||||
+ '<td class="r">' + r3(x[5]) + '</td><td class="r">' + rm(x[6]) + '</td>'
|
||||
+ '<td class="r">' + rm(x[7]) + '</td></tr>').join('')
|
||||
: '<tr class="resk"><td class="tgc"></td><td class="l" colspan="7">(没有下一级组成)</td></tr>';
|
||||
: '<tr class="resk"><td class="tgc"></td><td></td><td class="l" colspan="8">(没有下一级组成)</td></tr>';
|
||||
let nx = tr.nextElementSibling;
|
||||
while (nx && nx.classList.contains('resk')) nx = nx.nextElementSibling;
|
||||
while (frag.firstChild) tr.parentNode.insertBefore(frag.firstChild, nx);
|
||||
@@ -1308,7 +1398,9 @@ function rawPanelClose() {
|
||||
/* ---- 子目工料机面板的上下分隔条(2026-10-07,主人要求)----
|
||||
① 按住分隔条上下拖 = 调面板高度(120px ~ 容器的 75%);
|
||||
② 分隔条正中间的小把手,点一下 = 收起/展开整块面板(收起后把手仍在,随时点回来)。
|
||||
面板被「关闭」(rawPanelClose)时分隔条一并移除,不留死把手。 */
|
||||
面板被「关闭」(rawPanelClose)时分隔条一并移除,不留死把手。
|
||||
2026-10-13 决策 48:拖出的高度入公共记忆 —— 面板是点定额现建的(DOM 每次新建),
|
||||
创建时按记忆回放高度;容器还量不出尺寸(弹框未展开)就先不套,等下次创建。 */
|
||||
function rawVSplitInit(np) {
|
||||
const main = np.parentNode; // .rawmain
|
||||
const sp = document.createElement('div');
|
||||
@@ -1316,6 +1408,12 @@ function rawVSplitInit(np) {
|
||||
sp.innerHTML = '<span class="vsplitbtn" title="收起/展开子目工料机">▼</span>';
|
||||
main.insertBefore(sp, np);
|
||||
const btn = sp.querySelector('.vsplitbtn');
|
||||
const mh = panelMemLoad('rawnorm', 120, 1000000); // 决策 48:恢复上次拖的面板高
|
||||
const mhMax = Math.max(200, main.getBoundingClientRect().height * 0.75);
|
||||
if (mh && main.getBoundingClientRect().height > 0) {
|
||||
np.style.maxHeight = 'none';
|
||||
np.style.height = Math.min(mhMax, mh) + 'px';
|
||||
}
|
||||
let drag = null; // {y0, h0} 拖动起点与起始面板高
|
||||
sp.addEventListener('mousedown', e => {
|
||||
if (e.target === btn) return; // 把手只管收展,不参与拖动
|
||||
@@ -1332,6 +1430,7 @@ function rawVSplitInit(np) {
|
||||
});
|
||||
document.addEventListener('mouseup', () => {
|
||||
if (!drag) return;
|
||||
panelMemSave('rawnorm', parseFloat(np.style.height) || 0); // 决策 48:拖完存记忆
|
||||
drag = null;
|
||||
document.body.classList.remove('rawrow-dragging');
|
||||
});
|
||||
@@ -1343,7 +1442,7 @@ function rawVSplitInit(np) {
|
||||
});
|
||||
}
|
||||
/* ---- 树 / 内容 分隔条(2026-10-07,主人要求)----
|
||||
① 按住分隔条左右拖 = 改左树宽度(150 ~ 560px,页面本次会话内记住);
|
||||
① 按住分隔条左右拖 = 改左树宽度(150 ~ 560px,决策 48 起跨页/跨开关记忆);
|
||||
② 分隔条正中间一个小把手,点一下 = 收起/展开整棵树(树收起后把手仍在,随时点回来)。
|
||||
两页的容器都是 .rawbox(工作台 #pan3 / 后台明细弹框各一个),一份代码两边生效。 */
|
||||
function rawSplitInit() {
|
||||
@@ -1352,6 +1451,11 @@ function rawSplitInit() {
|
||||
box.dataset.splitReady = '1';
|
||||
const tree = box.querySelector('.rawtree');
|
||||
if (!tree) return;
|
||||
const memRestore = () => { // 决策 48:进页面先套上次拖的树宽
|
||||
const mw = panelMemLoad('rawtree', 40, 1000000); // 2026-10-13 主人定:不限制拖动距离
|
||||
if (mw) tree.style.width = mw + 'px';
|
||||
};
|
||||
memRestore();
|
||||
const sp = document.createElement('div');
|
||||
sp.className = 'rawsplit';
|
||||
sp.innerHTML = '<span class="splitbtn" title="收起/展开目录树">◀</span>';
|
||||
@@ -1367,10 +1471,11 @@ function rawSplitInit() {
|
||||
document.addEventListener('mousemove', e => {
|
||||
if (!drag) return;
|
||||
const w = Math.round(drag.w0 + e.clientX - drag.x0);
|
||||
tree.style.width = Math.min(560, Math.max(150, w)) + 'px';
|
||||
tree.style.width = Math.max(40, w) + 'px'; // 2026-10-13 主人定:只留最小宽防拖没,上限不设
|
||||
});
|
||||
document.addEventListener('mouseup', () => {
|
||||
if (!drag) return;
|
||||
panelMemSave('rawtree', parseFloat(tree.style.width) || 0); // 决策 48:拖完存记忆
|
||||
drag = null;
|
||||
document.body.classList.remove('rawcol-dragging');
|
||||
});
|
||||
@@ -2287,3 +2392,24 @@ function licActivate() {
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
/* ================= 弹框可移动(2026-10-13 主人定,全局)=================
|
||||
按住弹框标题栏(.mask .dlg 里的 .dh 或 h4)拖动 = 整框平移(transform translate,不动布局)。
|
||||
mousedown 委托在 document 上,三页所有弹框零改动自动生效;位置不持久(刷新回中)。
|
||||
标题栏里的按钮/关闭×/输入控件照常点,只有空白标题区起拖。 */
|
||||
(function(){
|
||||
let DG=null;
|
||||
document.addEventListener('mousedown', function(e){
|
||||
if(e.button!==0) return;
|
||||
const dlg=e.target.closest('.mask .dlg'); if(!dlg) return;
|
||||
if(!e.target.closest('.dh, h4')) return;
|
||||
if(e.target.closest('button, .close, input, select, textarea, a')) return;
|
||||
DG={dlg:dlg, x:e.clientX, y:e.clientY};
|
||||
e.preventDefault();
|
||||
});
|
||||
document.addEventListener('mousemove', function(e){
|
||||
if(!DG) return;
|
||||
DG.dlg.style.transform='translate('+(e.clientX-DG.x)+'px,'+(e.clientY-DG.y)+'px)';
|
||||
});
|
||||
document.addEventListener('mouseup', function(){ DG=null; });
|
||||
})();
|
||||
|
||||
@@ -12,7 +12,7 @@ h1{font-size:19px;margin:0 0 3px;color:var(--c1)}
|
||||
.panel{background:#fff;border:1px solid var(--line)}
|
||||
.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:6px 13px;border-radius:6px;border:1px solid #b8c4d4;background:#fff;cursor:pointer;font-size:12.5px;text-decoration:none;display:inline-block}
|
||||
.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}
|
||||
.btn:hover{background:#eef3fa}
|
||||
.btn.pri{background:var(--c2);color:#fff;border-color:var(--c2)}
|
||||
.btn.danger{color:#c0392b;border-color:#e0b4b4}
|
||||
@@ -38,9 +38,9 @@ a:hover{text-decoration:underline}
|
||||
<body>
|
||||
<div class="wrap">
|
||||
<div style="display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:6px">
|
||||
<h1 style="margin:0">造价审核 · 最近审核</h1>
|
||||
<h1 style="margin:0;font-size:12.5px">最近审核</h1>
|
||||
<!-- 时间戳参数:老 WebView2 对 no-store 不完全遵守,跨页跳转带新 URL 强制绕缓存(2026-10-12) -->
|
||||
<a class="btn pri" style="text-decoration:none;flex:none" href="javascript:location.href='/workbench.html?v='+Date.now()"
|
||||
<a class="btn pri" style="text-decoration:none;flex:none;padding:4px 10px;font-size:12px;line-height:1.3;font-weight:600" href="javascript:location.href='/workbench.html?v='+Date.now()"
|
||||
title="打开工作台:导入工程、做历史比对与审核">▶ 工作台</a>
|
||||
</div>
|
||||
<div class="panel">
|
||||
@@ -61,7 +61,7 @@ a:hover{text-decoration:underline}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="common.js?v=20261013e"></script>
|
||||
<script src="common.js?v=20261013m"></script>
|
||||
<script>
|
||||
/* 会话管理页:照后台「项目界面」的版式,管的是**还没入库**的工作台会话。
|
||||
会话库不自动清(SESSION_KEEP_DAYS=0),要删只能在这里手动删。
|
||||
@@ -69,11 +69,11 @@ a:hover{text-decoration:underline}
|
||||
②当页排序(sortHeadHTML/sortRows 共用层)③操作列收窄、余量给「项目名称」(原「项目名」改名)
|
||||
④表格撑满屏幕(项目名称列=伸缩列 attrFillBind,.wrap 去掉 max-width 上限)。
|
||||
排序状态 ST={k,dir}:k=SCOLS 下标,刷新/过滤后保持,换数据不重置。 */
|
||||
const SCOLS=[['',36,'c','','ns'],['项目名称',260,'l'],['项目总造价',140,'r'],['源文件',220,'l'],['单位工程',80,'r'],['清单',90,'r'],
|
||||
const SCOLS=[['',36,'c','','ns'],['序号',50,'c','','ns'],['项目名称',260,'l'],['项目总造价',140,'r'],['源文件',220,'l'],['单位工程',80,'r'],['清单',90,'r'],
|
||||
['定额',90,'r'],['工料机',90,'r'],['备注',70,'r'],['打开时间',150,'c'],['操作',96,'c','','ns']];
|
||||
let ITEMS=[], ST={k:-1,dir:1};
|
||||
const SES_NUM=new Set([2,4,5,6,7,8]); // 项目总造价/单位工程/清单/定额/工料机/备注 按数值比
|
||||
const NAME_IDX=1; // 伸缩列:项目名称(余宽都给它)
|
||||
const SES_NUM=new Set([3,5,6,7,8,9]); // 项目总造价/单位工程/清单/定额/工料机/备注 按数值比
|
||||
const NAME_IDX=2; // 伸缩列:项目名称(余宽都给它)
|
||||
|
||||
const n2 =n=>(n==null?'—':(+n).toLocaleString('zh-CN'));
|
||||
// 金额:带两位小数。⚠️ 项目总造价取自原文件(含税金/其他项目),**不是**清单合价求和
|
||||
@@ -86,7 +86,7 @@ function head(){
|
||||
$('th').innerHTML=sortHeadHTML(SCOLS,ST,'sesSort');
|
||||
}
|
||||
function sesSort(i){
|
||||
if(ST.k===i) ST.dir=-ST.dir; else { ST.k=i; ST.dir=1; }
|
||||
if(ST.k===i) ST.dir=-ST.dir; else { ST.k=i; ST.dir=(i===10?-1:1); } /* 打开时间首点=最新在前(2026-10-13 主人问询后定) */
|
||||
$('th').innerHTML=sortHeadHTML(SCOLS,ST,'sesSort');
|
||||
render();
|
||||
}
|
||||
@@ -107,27 +107,27 @@ async function load(silent){
|
||||
function render(){
|
||||
const q=($('fq').value||'').trim().toLowerCase();
|
||||
const rows=ITEMS.filter(x=>!q || (x.name||'').toLowerCase().includes(q) || (x.src_name||'').toLowerCase().includes(q))
|
||||
.map(x=>[x.id, x.name||'', x.total, srcShort(x.src_name), x.n_uw, x.n_bill, x.n_norm, x.n_lme,
|
||||
x.n_remark, x.at||'', (x.all||[]).map(a=>a.id), x.src_name]);
|
||||
.map(x=>[x.id, 0, x.name||'', x.total, srcShort(x.src_name), x.n_uw, x.n_bill, x.n_norm, x.n_lme,
|
||||
x.n_remark, x.at||'', (x.all||[]).map(a=>a.id), x.src_name]); // [1]=序号占位
|
||||
const view=sortRows(rows, ST.k, ST.dir, SES_NUM);
|
||||
/* 2026-10-07 主人定:同名工程只有一行(后端已按名称去重,代表=最近一次审核)。
|
||||
不再显示「共 N 次」、不再按时间展开版本;删除=该名称下全部记录一起删。 */
|
||||
view.forEach((r,i)=>{ r[1]=view.length-i; }); /* 序号倒序编号(与后台入库项目一致:第一行=总数,往下递减);默认序=打开时间越新越靠前(服务端 id 倒序=打开时间倒序,同名工程后端只留最近一次,2026-10-07 主人定) */
|
||||
let h='';
|
||||
view.forEach(r=>{
|
||||
h+=`<tr>
|
||||
<td class="c"><input type="checkbox" class="f-sel" value="${r[0]}" onchange="updDel()"></td>
|
||||
<td class="l name" title="${esc(r[1])}">${esc(r[1]||'(无名)')}</td>
|
||||
<td class="r" title="${r[2]==null?'原文件里没取到总造价':'工程总造价(原文件口径,含税金与其他项目)'}">${money(r[2])}</td>
|
||||
<td class="l name" title="${esc(r[11])}">${esc(r[3])}</td>
|
||||
<td class="r">${n2(r[4])}</td>
|
||||
<td class="r">${n2(r[5])}</td>
|
||||
<td class="r">${n2(r[6])}</td>
|
||||
<td class="r">${n2(r[7])}</td>
|
||||
<td class="r">${n2(r[8])}</td>
|
||||
<td class="c">${esc(r[9]||'—')}</td>
|
||||
<td class="c" title="${r[1]}">${r[1]}</td>
|
||||
<td class="l name" title="${esc(r[2])}">${esc(r[2]||'(无名)')}</td>
|
||||
<td class="r" title="${r[3]==null?'原文件里没取到总造价':'工程总造价(原文件口径,含税金与其他项目)'}">${money(r[3])}</td>
|
||||
<td class="l name" title="${esc(r[12])}">${esc(r[4])}</td>
|
||||
<td class="r" title="${n2(r[5])}">${n2(r[5])}</td>
|
||||
<td class="r" title="${n2(r[6])}">${n2(r[6])}</td>
|
||||
<td class="r" title="${n2(r[7])}">${n2(r[7])}</td>
|
||||
<td class="r" title="${n2(r[8])}">${n2(r[8])}</td>
|
||||
<td class="r" title="${n2(r[9])}">${n2(r[9])}</td>
|
||||
<td class="c" title="${esc(r[10]||'')}">${esc(r[10]||'—')}</td>
|
||||
<td class="c">
|
||||
<a onclick="go(${r[0]})" title="打开最近一次审核,接着上次的活干">打开</a>
|
||||
<a onclick="del([${(r[10]||[]).join(',')}])" style="margin-left:8px;color:#c0392b">删除</a>
|
||||
<a onclick="del([${(r[11]||[]).join(',')}])" style="margin-left:8px;color:#c0392b">删除</a>
|
||||
</td></tr>`;
|
||||
});
|
||||
$('tbody').innerHTML=h||`<tr><td colspan="${SCOLS.length}" class="empty">没有匹配的会话</td></tr>`;
|
||||
|
||||
@@ -268,7 +268,7 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
没打开项目=空),不再是后台绑定关系的只读展示。 -->
|
||||
<button class="btn" id="btnInq" onclick="openInq()"
|
||||
title="当前会话收进的附件目录(切会话跟着切,删会话才清);勾选后可批量下载">询价附件</button>
|
||||
<a class="btn" href="/sessions.html">最近审核</a>
|
||||
<a class="btn" href="javascript:location.href='/sessions.html?t='+Date.now()">最近审核</a>
|
||||
<button class="btn pri" onclick="openDlg()" data-page-node-id="rlEedAWfYgLJDVpuFxmmxq">打开项目</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -299,6 +299,8 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
<div style="display:flex;align-items:center;gap:10px;padding:5px 10px;border-bottom:1px solid var(--line);background:#fafcff">
|
||||
<a class="lk" onclick="reloadSim()" title="不用缓存,按当前工程数据与分组规则重新分组(工程大要稍等)">⟳ 重载</a>
|
||||
<span style="font-size:11.5px;color:var(--muted)">分组结果已缓存(改分组规则后自动按新规则重算)</span>
|
||||
<!-- 原数据单位工程级的层级按钮挂点(2026-10-13 决策 58:分组/清单/定额/默认列宽 迁到这里最右) -->
|
||||
<span id="rawLvMount" style="margin-left:auto;display:inline-flex;gap:4px;align-items:center"></span>
|
||||
</div>
|
||||
<table id="t2" data-page-node-id="ta5tNexyK4bepH302bOYRs"><colgroup id="cg2" data-page-node-id="I2Ng536RW9f2GJQevDwZru"></colgroup><thead id="th2" data-page-node-id="NomC50uaobhcg7IggoJT6G"></thead><tbody id="tb2" data-page-node-id="Gs6bHmPPPXWmG8SrazuW6d"></tbody></table></div>
|
||||
</div>
|
||||
@@ -407,7 +409,7 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
|
||||
<div class="mask" id="omask" data-page-node-id="NHET3zdzD9HkyEVocucLLz">
|
||||
<div class="dlg" data-page-node-id="rf6sdICi1GOOGBHgzR39N6">
|
||||
<h4 data-page-node-id="035yfGifzpBoUZgrI6XnyA">打开项目(只审核,不入库)</h4>
|
||||
<h4 data-page-node-id="035yfGifzpBoUZgrI6XnyA">打开项目</h4>
|
||||
<div class="mbody" data-page-node-id="OoZAOtJ0ridSwFtXLChDyg">
|
||||
<div class="row" data-page-node-id="TgF4geYkFIZIFYQD6sNZHB"><span data-page-node-id="Ve3MJBmbfhkGXf26tQdqAA">工程文件 *</span><input type="file" id="ofile" accept=".cos4,.cos" onchange="autoName()" data-page-node-id="I2kkcqsdiXGL40535vRd25"></div>
|
||||
<div class="row" data-page-node-id="uWAVJwQc4PGXMkVwrLTAWX"><span data-page-node-id="A69LDfDYOD8sJ9RNmYrp7u">名称 *</span><input id="oname" placeholder="选文件后自动带出文件名,可改" data-page-node-id="M0HGCQ9uGkUnRnXEshiiDD"></div>
|
||||
@@ -418,7 +420,6 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
<select id="odist" data-page-node-id="QB7NuG51dQutua0IUQ8Bo4"><option value="" data-page-node-id="A3GttbLNDNTXLIjVf8RCqA">区/县/镇</option></select>
|
||||
</div>
|
||||
<div class="row" data-page-node-id="yRE3EzGcdeMqaEC2oz71Oy"><span data-page-node-id="HhgkcRHxvZgzjC5BXXGDGC">建设单位</span><input id="obuid" placeholder="输入或从历史项目选择" autocomplete="off"></div>
|
||||
<div class="tip" data-page-node-id="srLpQR2bR76G44AbMgvhZr">打开后进入「会话库」,数据完整(含工程量/合价/数量),用于跟原件逐条核对;不会进历史底库。</div>
|
||||
<div class="tip" id="omsg" data-page-node-id="aQ4algswtlQMoiDgBrVN1u"></div>
|
||||
</div>
|
||||
<div class="mfoot" data-page-node-id="cIfN6fkvNTvkVdk85JJyPJ">
|
||||
@@ -461,7 +462,7 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="common.js?v=20261013e"></script>
|
||||
<script src="common.js?v=20261013m"></script>
|
||||
<script src="period.js"></script>
|
||||
<script>
|
||||
let SID=0, CUR=null, CURTYPE='lme', HROWS=[];
|
||||
@@ -515,7 +516,9 @@ function head(cols){ return headHTML(cols); }
|
||||
/* 2026-10-13 主人定:全工作台统一「拖列只动被拖列 + 全列记忆」,不再铺满容器(撑满不是硬要求)——
|
||||
撤掉项目工料机的 flexFit 重分摊、历史比对表/组表的名称·特征列补宽(attrFillBind,拖完回贴撑满、
|
||||
别的列跟着动)。四张表全走公共层既有口径:表宽=列宽和(sumw,拖动时表宽随差值增减)+
|
||||
按表头指纹逐列记忆(colwApply)。后台仍用撑满模式,不受本次影响。 */
|
||||
按表头指纹逐列记忆(colwApply)。
|
||||
2026-10-13 决策 49 追:后台保留默认撑满(主人定「默认撑满没有问题」),公共拖动器已在
|
||||
**拖动那一刻**把撑满/补宽表就地转「拖列只动被拖列」——前后台拖动手感自此完全一致。 */
|
||||
function colg(el,cols){
|
||||
$(el).innerHTML = colgHTML(cols);
|
||||
const tb = $(el).closest('table');
|
||||
@@ -597,6 +600,8 @@ function loadRaw(){ return WB_RAW.load(); }
|
||||
/* ---------- 打开工程 ---------- */
|
||||
async function openDlg(){
|
||||
$('ofile').value=''; $('oname').value=''; $('oname').dataset.auto=''; $('omsg').textContent='';
|
||||
$('oper').value=''; $('oprov').value=''; $('ocity').value=''; $('odist').value='';
|
||||
$('obuid').value=''; $('obuid').dispatchEvent(new Event('input', {bubbles:true}));
|
||||
$('omask').classList.add('on');
|
||||
}
|
||||
|
||||
@@ -1232,7 +1237,6 @@ async function recOpen(sid,keep){
|
||||
$('sinfo').innerHTML=`<b>${esc(m.name||'')}</b>`; // 2026-10-10 主人定:只留名称(基准/条数尾串取消)
|
||||
if(!keep) closePops();
|
||||
await loadLme(); await tab((document.querySelector('.tab.on')||{dataset:{p:'p0'}}).dataset.p);
|
||||
$('msg').textContent='已切到该会话';
|
||||
}
|
||||
document.addEventListener('mousedown', e=>{
|
||||
if(e.target.closest('.srcwrap')) return;
|
||||
@@ -1512,7 +1516,10 @@ mkPeriod($('oper')); // 打开工程:基
|
||||
|
||||
/* 历史容器:上下拉动调整高度(2026-09-29:改拖 #hgrip 把手,不再拖 #histbar)。
|
||||
2026-10-08:正中小把手只管收起/展开(同子目工料机框),不参与拖动;
|
||||
高度更新走 rAF 合帧(主人报拖动卡——大表在上方,每个 mousemove 都重排会抖)。 */
|
||||
高度更新走 rAF 合帧(主人报拖动卡——大表在上方,每个 mousemove 都重排会抖)。
|
||||
2026-10-13 决策 48:拖出的高度入公共记忆(panelMem)——切页/关窗重开照记忆恢复;
|
||||
双击复位 = 回默认 44vh 并清掉记忆,否则下次进来又被旧记忆顶回去。 */
|
||||
{ const mh=panelMemLoad('histbody',90,99999); if(mh) $('histbody').style.height=mh+'px'; } // 进页面先恢复
|
||||
let dragY=0, dragH=0, dragging=false, dragRaf=0, dragH1=0;
|
||||
$('hgrip').addEventListener('mousedown', function(e){
|
||||
if(e.target.closest('.hbtn')) return; // 小把手只管收展
|
||||
@@ -1520,7 +1527,7 @@ $('hgrip').addEventListener('mousedown', function(e){
|
||||
document.body.classList.add('histdrag'); // 光标钉在拖动线上 + 禁选中
|
||||
e.preventDefault();
|
||||
});
|
||||
$('hgrip').addEventListener('dblclick', function(){ $('histbody').style.height=''; }); // 双击复位默认 44vh
|
||||
$('hgrip').addEventListener('dblclick', function(){ $('histbody').style.height=''; panelMemClear('histbody'); }); // 双击复位默认 44vh + 清记忆
|
||||
document.querySelector('#hgrip .hbtn').addEventListener('click', toggleFold);
|
||||
document.addEventListener('mousemove', function(e){
|
||||
if(!dragging) return;
|
||||
@@ -1534,13 +1541,16 @@ document.addEventListener('mouseup', function(){
|
||||
dragging=false;
|
||||
if(dragRaf){ cancelAnimationFrame(dragRaf); dragRaf=0; }
|
||||
$('histbody').style.height=dragH1+'px';
|
||||
if(dragH1>0) panelMemSave('histbody', dragH1); // 拖完存记忆(决策 48)
|
||||
document.body.classList.remove('histdrag');
|
||||
});
|
||||
|
||||
/* 类似清单左树分隔条(2026-10-08 主人定):拖动改树宽 150~560、中央小把手收起/展开 —— 与原数据左树一致 */
|
||||
/* 类似清单左树分隔条(2026-10-08 主人定):拖动改树宽 150~560、中央小把手收起/展开 —— 与原数据左树一致。
|
||||
2026-10-13 决策 48:树宽入公共记忆(panelMem)——切页/关窗重开都照记忆恢复。 */
|
||||
(function(){
|
||||
const gt=$('grptree'), gs=$('grpsplit'); if(!gt||!gs) return;
|
||||
const btn=gs.querySelector('.gsplitbtn');
|
||||
{ const mw=panelMemLoad('grptree',150,560); if(mw) gt.style.width=mw+'px'; } // 进页面先恢复
|
||||
let gx0=0, gw0=0, gdrag=false;
|
||||
gs.addEventListener('mousedown', function(e){
|
||||
if(e.target===btn) return; // 小把手只管收展
|
||||
@@ -1552,7 +1562,9 @@ document.addEventListener('mouseup', function(){
|
||||
gt.style.width=Math.min(560,Math.max(150,Math.round(gw0+e.clientX-gx0)))+'px';
|
||||
});
|
||||
document.addEventListener('mouseup', function(){
|
||||
if(gdrag){ gdrag=false; document.body.classList.remove('grptree-dragging'); }
|
||||
if(!gdrag) return;
|
||||
panelMemSave('grptree', parseFloat(gt.style.width)||0); // 拖完存记忆
|
||||
gdrag=false; document.body.classList.remove('grptree-dragging');
|
||||
});
|
||||
btn.addEventListener('click', function(){
|
||||
const closed=gt.parentNode.classList.toggle('treeclosed');
|
||||
@@ -1658,8 +1670,9 @@ function ruleRender(){
|
||||
const tb=$('ruleBody');
|
||||
RULE_DEL_ARM=null; // 任何重渲染都取消两段式删除的布防(按钮重建回「删除」)
|
||||
if(!RULES.length){
|
||||
tb.innerHTML='<tr><td colspan="6" style="padding:14px 10px;color:#8a97a8">还没有分组规则。点右上角「+ 插入分组」。</td></tr>';
|
||||
return;
|
||||
// 主人定(2026-10-13):取消「+ 插入分组」后,空规则(新系统)默认自带第一行(编辑态);未填写保存时被 cfgSave 空行过滤自动丢弃
|
||||
RULES.push({_uid:++RULE_UID, seq:1, name:'', keywords:'', exclude:'', units:'', _hits:null});
|
||||
RULE_EDIT.add(RULES[0]._uid);
|
||||
}
|
||||
tb.innerHTML = RULES.map(r=>{
|
||||
const ed = RULE_EDIT.has(r._uid);
|
||||
@@ -1677,17 +1690,14 @@ function ruleRender(){
|
||||
+ '<td>' + (ed?'<input class="rin" value="'+esc(r.name||'')+'" onchange="ruleSet(this,'+r._uid+',\'name\')">':(esc(r.name||'')||'<span style="color:#b9c4d2">(未命名)</span>')) + '</td>'
|
||||
+ '<td>' + (ed?'<textarea class="rin ta" onchange="ruleSet(this,'+r._uid+',\'keywords\')">'+esc(r.keywords||'')+'</textarea>':(esc(r.keywords||'')||'<span style="color:#b9c4d2">—</span>')) + '</td>'
|
||||
+ '<td>' + (ed?'<textarea class="rin ta" onchange="ruleSet(this,'+r._uid+',\'exclude\')">'+esc(r.exclude||'')+'</textarea>':(esc(r.exclude||'')||'<span style="color:#b9c4d2">—</span>')) + '</td>'
|
||||
+ '<td>' + (ed?'<textarea class="rin ta" onchange="ruleSet(this,'+r._uid+',\'units\')" title="填写后本条规则只收单位命中的清单(精确匹配,多个任一命中);不填=不限单位">'+esc(r.units||'')+'</textarea>':(esc(r.units||'')||'<span style="color:#b9c4d2">—</span>')) + '</td>'
|
||||
+ '<td class="c" style="color:#5b6b7e;white-space:nowrap">'+hits+'</td>'
|
||||
+ '<td class="c" style="white-space:nowrap">'+ops+'</td></tr>';
|
||||
}).join('');
|
||||
}
|
||||
function ruleAdd(){
|
||||
const r={_uid:++RULE_UID, seq:RULES.length+1, name:'', keywords:'', exclude:'', _hits:null};
|
||||
RULES.push(r); RULE_EDIT.add(r._uid); ruleNorm(); ruleRender();
|
||||
}
|
||||
function ruleInsBelow(uid){
|
||||
const i=RULES.findIndex(x=>x._uid===uid); if(i<0) return;
|
||||
const r={_uid:++RULE_UID, seq:RULES[i].seq+0.5, name:'', keywords:'', exclude:'', _hits:null};
|
||||
const r={_uid:++RULE_UID, seq:RULES[i].seq+0.5, name:'', keywords:'', exclude:'', units:'', _hits:null};
|
||||
RULES.splice(i+1,0,r); RULE_EDIT.add(r._uid); ruleNorm(); ruleRender();
|
||||
}
|
||||
let RULE_DEL_ARM = null; // 两段式删除的布防行 _uid(任何重渲染都复位)
|
||||
@@ -1752,8 +1762,8 @@ async function cfgOpen(){
|
||||
function cfgClose(){ $('cfgmask').classList.remove('on'); }
|
||||
async function cfgSave(){
|
||||
const rows = RULES
|
||||
.map(r=>({seq:+r.seq||0, name:(r.name||'').trim(), keywords:(r.keywords||'').trim(), exclude:(r.exclude||'').trim()}))
|
||||
.filter(r=>r.name||r.keywords||r.exclude);
|
||||
.map(r=>({seq:+r.seq||0, name:(r.name||'').trim(), keywords:(r.keywords||'').trim(), exclude:(r.exclude||'').trim(), units:(r.units||'').trim()}))
|
||||
.filter(r=>r.name||r.keywords||r.exclude||r.units);
|
||||
rows.sort((a,b)=>a.seq-b.seq); rows.forEach((r,i)=>r.seq=i+1);
|
||||
await J('/api/session/setting',{method:'POST',headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify({scope:'global', k:'grp_rules', v:JSON.stringify(rows)})});
|
||||
@@ -1790,20 +1800,18 @@ function cfgTab(name){
|
||||
<div class="dlg" style="width:min(1120px,94vw)">
|
||||
<div class="dh"><b>分组&过滤</b><span class="close" onclick="cfgClose()">×</span></div>
|
||||
<div style="padding:14px 16px;display:flex;flex-direction:column;gap:10px">
|
||||
<div class="tip" style="padding:0">对清单的分组进行定义,空格/逗号分开的多个词任一命中即可成组或者排除,每个关键词格内没有空格/逗号分开的词必须100%匹配。</div>
|
||||
<div class="tip" style="padding:0">对清单的分组进行定义,空格/逗号分开的多个词任一命中即可成组或者排除,每个关键词格内没有空格/逗号分开的词必须100%匹配。单位(必):填写后本条规则只收「单位」命中的清单(精确匹配,多个单位任一命中),其余清单照常走后续自动分组;不填=不限单位。</div>
|
||||
<div style="display:flex;gap:4px;border-bottom:2px solid var(--c1)">
|
||||
<div class="dtab on" id="cfgdtab-rules" onclick="cfgTab('rules')">分组设置</div>
|
||||
<div class="dtab" id="cfgdtab-stop" onclick="cfgTab('stop')">全局过滤词</div>
|
||||
<button class="btn pri" style="margin-left:auto" onclick="ruleAdd()"
|
||||
title="在表格末尾插入一条新规则">+ 插入分组</button>
|
||||
<button class="btn" onclick="cfgSave()" title="保存分组规则与全局过滤词">保存</button>
|
||||
<button class="btn" style="margin-left:auto" onclick="cfgSave()" title="保存分组规则与全局过滤词">保存</button>
|
||||
</div>
|
||||
|
||||
<!-- 分组设置 -->
|
||||
<div id="cfgTabProf">
|
||||
<div class="tw" style="max-height:56vh">
|
||||
<table class="cfgtbl" id="ruleTbl"><colgroup><col style="width:56px"><col style="width:150px"><col><col><col style="width:74px"><col style="width:236px"></colgroup>
|
||||
<thead><tr><th class="c">序号</th><th class="c">组名</th><th class="c">关键字</th><th class="c">屏蔽词</th><th class="c">命中</th><th class="c">操作</th></tr></thead>
|
||||
<table class="cfgtbl" id="ruleTbl"><colgroup><col style="width:56px"><col style="width:150px"><col><col><col style="width:110px"><col style="width:74px"><col style="width:236px"></colgroup>
|
||||
<thead><tr><th class="c">序号</th><th class="c">组名</th><th class="c">关键字</th><th class="c">屏蔽词</th><th class="c">单位(必)</th><th class="c">命中</th><th class="c">操作</th></tr></thead>
|
||||
<tbody id="ruleBody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -1811,7 +1819,7 @@ function cfgTab(name){
|
||||
|
||||
<!-- 全局过滤词 -->
|
||||
<div id="cfgTabStop" style="display:none">
|
||||
<div class="tip" style="padding:0">这些词在「与历史项目比对」时会被<b>忽略</b>(不参与相似度计算)。点「添加」加入,每个词一个标签,点标签上的 × 可删除;输入框支持逗号 / 空格批量添加。</div>
|
||||
<div class="tip" style="padding:0">类似清单的比对中这些词在「与入库项目比对」时会被<b>忽略</b>(不参与相似度计算)。点「添加」加入,每个词一个标签,点标签上的 × 可删除;输入框支持逗号 / 空格批量添加。</div>
|
||||
<div id="cfgStopChips" class="chips"></div>
|
||||
<div class="chip-add">
|
||||
<input id="cfgStopInput" class="chip-input" placeholder="输入过滤词,回车或点添加(可批量:逗号/空格分隔)" onkeydown="if(event.key==='Enter'){event.preventDefault();addStop();}">
|
||||
|
||||
Reference in New Issue
Block a user