perf(lme): 合并工料机弹框改组表显示并加索引提速合并
- 合并弹框由树形列表改为组表显示:± 把手、组头淡红、表头 sticky,三价联动恒成立(决策 161/164) - s_lme_uw 增加 (session_id, code) 索引,优化大库合并按编码同步速度 - 筛选控件与默认值不同时标粉红提示,重置自动回灰 - AGENTS.md 新增「先清单后动手」工作流,系统规格.md 退役并入功能清单 - 更新决策台账(161-164)、功能清单差异与版本存档快照
This commit is contained in:
@@ -109,6 +109,8 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
#histbar > .combo{flex:1 1 90px;min-width:0} /* 决策 143:搜索/屏蔽词的小叉壳层在顶层,弹性吸收余量(单位/项目名称的壳在 .fld 里不受此限) */
|
||||
#histbar .fld{display:flex;align-items:center;gap:5px}
|
||||
#histbar .hnum{width:44px;padding:3px 6px;border:1px solid #b8c4d4;border-radius:5px;font:inherit;font-size:12px;background:#fff} /* 决策 144:价格范围皮肤按单位框 */
|
||||
/* 决策 164(2026-10-21 主人定):筛选与软件默认不同 → 控件标粉红(醒目);重置/清空自动回灰(fltMark) */
|
||||
#histbar .hb.flt-on,#histbar select.flt-on,#histbar input.flt-on{background:#fdecec;border-color:#e08a8a;color:#b03030;font-weight:700}
|
||||
/* 名称悬停浮层(2026-10-08 主人定):停留即显 项目特征 + 定额(编码/名称);
|
||||
浮层挂 body 固定定位(同 combo-panel 思路),定额按 bill_id 走 histNorms 缓存。 */
|
||||
#htip{position:fixed;z-index:600;display:none;width:440px;max-width:92vw;max-height:60vh;overflow:auto;
|
||||
@@ -176,25 +178,26 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
.mask{position:fixed;inset:0;background:rgba(20,30,45,.45);display:none;align-items:center;justify-content:center;z-index:99}
|
||||
.mask.on{display:flex}
|
||||
|
||||
/* ---- 合并工料机弹框(批次C,决策 69)---- */
|
||||
/* ---- 合并工料机弹框(批次C,决策 69;决策 161 显示改组表:±把手、组头淡红,功能不变)---- */
|
||||
#mtree .mn{display:flex;align-items:center;gap:6px;padding:4px 10px;font-size:12.5px;border-bottom:1px solid #f1f5f9}
|
||||
#mtree .mn.root{background:#f4f8fc;font-size:13px}
|
||||
#mtree .mn.grp{background:#fafcff;font-weight:600;cursor:default}
|
||||
#mtree .tg2{width:14px;text-align:center;cursor:pointer;color:#2a4a70;font-weight:700;user-select:none}
|
||||
/* 决策 161:组表(.mtbl)——thead sticky 保住固定顶部表头(规格 第9条);组头行淡红(同类似清单 .grp.bad) */
|
||||
#mtree .mtbl{width:100%;border-collapse:collapse;table-layout:fixed;font-size:12.5px;background:#fff}
|
||||
#mtree .mtbl th{position:sticky;top:0;z-index:1;background:#eef4fb;font-weight:600;color:#3d4c5e;text-align:center;padding:5px 4px;border-bottom:1px solid #d9e4f0}
|
||||
#mtree .mtbl td{padding:3px 6px;border-bottom:1px solid #f1f5f9;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
#mtree .mtbl td.c{text-align:center}
|
||||
#mtree .mtbl td.r{text-align:right}
|
||||
#mtree .mtbl td.l{text-align:left}
|
||||
#mtree tr.mhead2 td{background:#fbe0dc;font-weight:700;color:#34506f;cursor:pointer;user-select:none}
|
||||
#mtree .tog{width:14px;text-align:center;cursor:pointer;color:#2a4a70;font-weight:700;user-select:none}
|
||||
#mtree .mgrp{background:#fff}
|
||||
#mtree .mrow{padding-left:30px}
|
||||
/* 2026-10-16 规格 第9条:固定顶部表头(随滚动钉住)+ 行内 名称/规格 列 + 子级标记 */
|
||||
#mtree .mhead{position:sticky;top:0;z-index:1;background:#eef4fb;font-weight:600;color:#3d4c5e;padding-left:30px;border-bottom:1px solid #d9e4f0}
|
||||
#mtree .mhead .c{width:110px}
|
||||
#mtree .mhead .n,#mtree .mhead .s{width:130px}
|
||||
#mtree .mhead .r{width:84px;text-align:right}
|
||||
#mtree .mnm{display:inline-block;width:130px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}
|
||||
#mtree .mnm.spec{width:110px;color:#5b6b7e}
|
||||
#mtree .subtag{background:#fff4e0;color:#a06a00;border:1px solid #eed9ac;border-radius:8px;font-size:11px;padding:0 6px;margin-left:2px;cursor:help}
|
||||
#mtree input[type=text]{border:1px solid #d6e0ec;border-radius:3px;padding:1px 5px;font:inherit;outline:none}
|
||||
#mtree input[type=text]:focus{border-color:#7aa7d9}
|
||||
#mtree .mi.c{width:110px}
|
||||
#mtree .mi.n{width:84px;text-align:right}
|
||||
#mtree .mi.c{width:100%;box-sizing:border-box;text-align:center}
|
||||
#mtree .mi.n{width:100%;box-sizing:border-box;text-align:right}
|
||||
/* 决策 161:合并进度条(单次 POST 无真实百分比 → 不定条左右滑动) */
|
||||
@keyframes mprog{0%{margin-left:-40%}100%{margin-left:100%}}
|
||||
.dlg{background:#fff;border-radius:10px;width:640px;max-width:94vw;display:flex;flex-direction:column;overflow:hidden}
|
||||
.dlg h4{margin:0;padding:13px 18px;font-size:14.5px;border-bottom:1px solid var(--line);background:var(--head);color:var(--c1)}
|
||||
.dlg .mbody{padding:14px 18px;display:flex;flex-direction:column;gap:10px}
|
||||
@@ -488,7 +491,7 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 合并工料机(批次C,决策 69;主人定稿树形:±把手、默认全展开、默认勾编码最短、右上 取消|合并) -->
|
||||
<!-- 合并工料机(批次C,决策 69;决策 161 显示改组表:±把手、组头淡红;功能不变:默认全展开、默认勾编码最短、右上 取消|合并) -->
|
||||
<div class="mask" id="mmask">
|
||||
<div class="dlg" style="width:920px;max-width:94vw">
|
||||
<h4 style="display:flex;align-items:center;gap:10px">合并工料机
|
||||
@@ -498,9 +501,11 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
</h4>
|
||||
<div class="mbody">
|
||||
<div id="mtree" style="max-height:58vh;overflow:auto;border:1px solid #e3eaf2;border-radius:6px"></div>
|
||||
<div style="padding-top:8px;color:#8a97a8;font-size:12px">
|
||||
按 名称|规格|单位 归组,仅列编码/价格有差异的组(全量未过滤,带子级组成的台班/配合比也在列);勾选要保留的行(默认勾编码最短),编码/除税价/税率/含税价可直接改;
|
||||
合并后未勾选的行隐藏(不删除);各单位工程汇总中同组母行只把编码替换为保留行编码、子级以保留行为准(规格 第11/12 条),单位工程页面实时更新,导出同步生效。
|
||||
<div id="mprog" style="display:none;padding-top:10px">
|
||||
<div style="height:6px;background:#e7eefb;border-radius:3px;overflow:hidden">
|
||||
<div style="height:100%;width:40%;background:#2a62d4;border-radius:3px;animation:mprog 1.1s linear infinite"></div>
|
||||
</div>
|
||||
<div style="padding-top:5px;color:#5b6b7e;font-size:12px">正在合并,行数多时需要一会儿…</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -652,6 +657,56 @@ document.addEventListener('DOMContentLoaded', function(){
|
||||
/* 底部「历史比对」容器显隐(决策 71,2026-10-15 主人定):四个标签全显示 ——
|
||||
组价不一致清单(p1) 搬回来(**推翻 2026-10-08「p1 取消对比框」口径**,以本次为准);
|
||||
原数据(p3) 的 分部分项/措施项目 按共享层规格⑥搬进来:默认折叠,选中清单行自动展开。 */
|
||||
/* 决策 163(2026-10-21 主人定):历史对比框的「工料机上下文」跟随**选中行类型**,改一处=改两处——
|
||||
旧口径在 histSearch/renderHist/syncHist 里按页签写死(如 onLme=curTab()==='p0'),曾使
|
||||
「项目工料机」页签点「查询」实际搜到清单库。口径:工料机行=只搜 项目工料机/信息价/市场价;
|
||||
清单行=搜清单;无选中行按页签默认(原数据/项目工料机=工料机,类似清单/组价不一致=清单)。 */
|
||||
function histIsLme(){
|
||||
if (CUR && CURTYPE === 'lme') return true;
|
||||
if (CUR && CURTYPE === 'bill') return false;
|
||||
return curTab() === 'p0' || curTab() === 'p3';
|
||||
}
|
||||
/* 决策 164:历史对比框筛选与软件默认不同 → 控件标粉红(醒目)。默认口径:
|
||||
来源/单价类型=全选;期次/地区=不限;本项目=页签默认(组价不一致=是,其余=否);
|
||||
精确度=精确+次精确+字集;价格=默认排序;附件=全部;单位/项目名称/价格范围/屏蔽词=空;
|
||||
关键字检索模式(FLT.kw 非空)=搜索框+查询按钮标粉。各筛选回调里调 fltMark() 刷新。 */
|
||||
function fltMark(){
|
||||
const on=(el,bad)=>{ if(el) el.classList.toggle('flt-on',!!bad); };
|
||||
const allChk=g=>{ const a=document.querySelectorAll('.fchk[data-g="'+g+'"]'); return a.length>0 && Array.prototype.every.call(a,x=>x.checked); };
|
||||
const pv=PVAL($('hperBtn'));
|
||||
on($('fsrcBtn'), !allChk('fsrc'));
|
||||
on($('fkindBtn'), !allChk('fkind'));
|
||||
on($('hperBtn'), !!(pv.fs || pv.t));
|
||||
on($('fareaBtn'), (FLT.area||[]).length > 0);
|
||||
on($('fself'), $('fself').value !== ((curTab()==='p1') ? 'yes' : 'no'));
|
||||
on($('htier'), $('htier').value !== 'es');
|
||||
on($('hsort'), $('hsort').value !== 'time');
|
||||
on($('hatt'), $('hatt').value !== 'all');
|
||||
on($('funit'), !!($('funit').value||'').trim());
|
||||
on($('fproj'), !!($('fproj').value||'').trim());
|
||||
on($('fpmin'), !!$('fpmin').value);
|
||||
on($('fpmax'), !!$('fpmax').value);
|
||||
on($('fstop'), !!($('fstop').value||'').trim());
|
||||
on($('hkw'), kwActive());
|
||||
on($('btnQuery'), kwActive());
|
||||
}
|
||||
/* 决策 163:切换到页面必定有选中行(主人定)——默认第一行工料机或第一行清单。
|
||||
监听四张主表的行渲染:出现可点行(行 onclick 含 pick)且当前没有任何选中行时,自动点第一行。 */
|
||||
let _apT = 0;
|
||||
const _apPick = () => {
|
||||
clearTimeout(_apT);
|
||||
_apT = setTimeout(() => {
|
||||
if (document.querySelector('tr.sel')) return; // 已有选中行不抢
|
||||
const cand = [...document.querySelectorAll('#rawbody tr, #tb0 tr, #tb1 tr, #tb2 tr')]
|
||||
.find(tr => tr.offsetParent && /pick\(/i.test(tr.getAttribute('onclick') || ''));
|
||||
if (cand) cand.click();
|
||||
}, 250);
|
||||
};
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const obs = new MutationObserver(_apPick);
|
||||
['rawbody','tb0','tb1','tb2'].forEach(id => { const el = $(id); if (el) obs.observe(el, { childList: true }); });
|
||||
_apPick(); // 首屏兜底(默认停在原数据)
|
||||
});
|
||||
function syncHist(p){
|
||||
const w=$('histwrap'); if(!w) return;
|
||||
w.classList.remove('rawmode');
|
||||
@@ -659,7 +714,7 @@ function syncHist(p){
|
||||
else w.classList.remove('folded');
|
||||
// 2026-10-08 主人定:筛选条按标签分工 —— 单价类型仅类似清单;来源/价格范围仅项目工料机;
|
||||
// 「单位」两标签共用(工料机侧 = 建设单位 OR 发行单位 联查,按钮文字/选项随标签切换)。
|
||||
const isLme = (p==='p0') || (p==='p3' && CURTYPE==='lme' && typeof CUR!=='undefined' && CUR); // 决策 142:p3 选中工料机=同工料机对比上下文
|
||||
const isLme = histIsLme(); // 决策 163:跟随选中行类型(不再按页签写死)
|
||||
if($('fldSrc')) $('fldSrc').style.display = isLme ? '' : 'none';
|
||||
if($('fldPrc')) $('fldPrc').style.display = isLme ? '' : 'none';
|
||||
if($('fldAtt')) $('fldAtt').style.display = isLme ? '' : 'none';
|
||||
@@ -707,6 +762,7 @@ async function tab(p){
|
||||
if(p==='p2') await ldWrap('','正在加载类似清单(分组计算,工程大要稍等)…',()=>loadGroups('similar'));
|
||||
if(p==='p3') await ldWrap('','正在加载原数据…',()=>loadRaw());
|
||||
try{ localStorage.setItem('wb_tab', p); }catch(e){} // 记住停留的标签(切页回来接着看)
|
||||
_apPick(); // 决策 163:切到页面必选第一行(工料机或清单),历史对比框始终有上下文
|
||||
}
|
||||
// 公共层标签点击 → 本页的 tab()
|
||||
function onWBTab(p){ tab(p); }
|
||||
@@ -881,39 +937,55 @@ async function rawMergeOpen(){
|
||||
$('mmask').classList.add('on');
|
||||
}
|
||||
function mergeClose(){ $('mmask').classList.remove('on'); }
|
||||
function mTog(el){
|
||||
const open = el.dataset.open === '1';
|
||||
el.dataset.open = open ? '0' : '1';
|
||||
el.textContent = open ? '+' : '−';
|
||||
const box = el.parentElement.nextElementSibling;
|
||||
if (box) box.style.display = open ? 'none' : '';
|
||||
function mTog(tr){
|
||||
// 决策 161:组头行整体点击收/展——成员行与本组头同 tbody,按 .mrow 挑出来藏/显
|
||||
const tg = tr.querySelector('.tog');
|
||||
const open = tg.dataset.open === '1';
|
||||
tg.dataset.open = open ? '0' : '1';
|
||||
tg.textContent = open ? '+' : '−';
|
||||
const box = tr.closest('tbody');
|
||||
if (box) Array.from(box.querySelectorAll('tr.mrow')).forEach(r => { r.style.display = open ? 'none' : ''; });
|
||||
}
|
||||
function renderMergeTree(){
|
||||
// 2026-10-16 规格 第9条:不过滤带子数据的工料机(决策78 废止)+ 补固定顶部表头 编码|名称|规格|除税价|税率|含税价
|
||||
let h = '<div class="mn root"><span class="tg2">−</span><b>合并工料机</b>'
|
||||
+ '<span style="color:#8a97a8">' + MDATA.groups.length + ' 组(源自 ' + MDATA.n_rows + ' 行项目级汇总,全量未过滤)</span></div>'
|
||||
+ '<div class="mn mhead"><span style="width:13px"></span>'
|
||||
+ '<span class="hc c">编码</span><span class="hc n">名称</span><span class="hc s">规格</span>'
|
||||
+ '<span class="hc r">除税价</span><span class="hc r">税率</span><span class="hc r">含税价</span><span class="hc">数量</span></div>';
|
||||
// 决策 161(2026-10-21 主人定):树形改组表——首列 ± 把手、组头淡红(名称|规格|单位+N条+数量合计),
|
||||
// 列=勾选/序号/编码/名称/规格型号/单位/数量/除税编制价/税率/含税编制价;固定顶部表头(规格 第9条)
|
||||
// 由 thead sticky 继续;不过滤带子数据的工料机(决策78 废止口径不变)。
|
||||
// 功能钩子不变:mergeApply 按 #mtree .mgrp[data-gi] 下的 .mrow 收集 checkbox/data-mid 与 input[data-f]。
|
||||
let h = '<table class="mtbl"><colgroup>'
|
||||
+ '<col style="width:34px"><col style="width:36px"><col style="width:44px"><col style="width:104px"><col><col>'
|
||||
+ '<col style="width:48px"><col style="width:86px"><col style="width:104px"><col style="width:60px"><col style="width:104px">'
|
||||
+ '</colgroup><thead><tr><th></th><th title="勾选=保留,不勾=合并后隐藏">✓</th><th>序号</th><th>编码</th>'
|
||||
+ '<th>名称</th><th>规格型号</th><th>单位</th><th>数量</th><th>除税编制价</th><th>税率</th><th>含税编制价</th></tr></thead>';
|
||||
let no = 0;
|
||||
MDATA.groups.forEach((g, gi) => {
|
||||
h += '<div class="mn grp"><span class="tg2" data-open="1" onclick="mTog(this)">−</span>'
|
||||
+ '<span title="名称|规格|单位">' + esc(g.name || '—') + ' | ' + esc(g.spec || '—') + ' | ' + esc(g.unit || '—') + '</span>'
|
||||
+ '<span style="color:#8a97a8">' + g.rows.length + ' 条</span></div>'
|
||||
+ '<div class="mgrp" data-gi="' + gi + '">'
|
||||
+ g.rows.map(r => '<div class="mn mrow">'
|
||||
+ '<input type="checkbox" data-mid="' + r.id + '"' + (r.def ? ' checked' : '') + ' title="勾选=保留,不勾=合并后隐藏">'
|
||||
+ '<input type="text" class="mi c" data-f="code" data-mid="' + r.id + '" value="' + esc(r.code || '') + '" placeholder="编码">'
|
||||
+ '<span class="mnm" title="' + esc(r.name || '') + '">' + esc(r.name || '—') + (r.sub
|
||||
? ' <span class="subtag" title="带子级组成(台班/配合比):合并后各单位工程的子级以保留行为准,原软件按子级重算母价">子级</span>' : '')
|
||||
+ '</span>'
|
||||
+ '<span class="mnm spec" title="' + esc(r.spec || '') + '">' + esc(r.spec || '—') + '</span>'
|
||||
+ '<input type="text" class="mi n" data-f="ntp" data-mid="' + r.id + '" value="' + (r.ntp == null ? '' : r.ntp) + '" placeholder="除税价">'
|
||||
+ '<input type="text" class="mi n" data-f="taxrate" data-mid="' + r.id + '" value="' + (r.taxrate == null ? '' : r.taxrate) + '" placeholder="税率">'
|
||||
+ '<input type="text" class="mi n" data-f="taxp" data-mid="' + r.id + '" value="' + (r.taxp == null ? '' : r.taxp) + '" placeholder="含税价">'
|
||||
+ '<span style="color:#8a97a8">数量 ' + num(r.qty, 3) + '</span>'
|
||||
+ '</div>').join('')
|
||||
+ '</div>';
|
||||
const qty = g.rows.reduce((s, r) => s + (Number(r.qty) || 0), 0);
|
||||
h += '<tbody class="mgrp" data-gi="' + gi + '">'
|
||||
+ '<tr class="mhead2" onclick="mTog(this)"><td><span class="tog" data-open="1">−</span></td>'
|
||||
+ '<td></td><td></td>'
|
||||
+ '<td class="gtitle" colspan="4" title="名称|规格|单位">' + esc(g.name || '—') + ' | ' + esc(g.spec || '—') + ' | ' + esc(g.unit || '—')
|
||||
+ ' <span style="color:#8a97a8;font-weight:400">' + g.rows.length + ' 条</span></td>'
|
||||
+ '<td class="r"><b>' + num(qty, 3) + '</b></td>'
|
||||
+ '<td></td><td></td><td></td></tr>';
|
||||
g.rows.forEach(r => {
|
||||
no++;
|
||||
h += '<tr class="mrow">'
|
||||
+ '<td></td>'
|
||||
+ '<td class="c"><input type="checkbox" data-mid="' + r.id + '"' + (r.def ? ' checked' : '') + ' title="勾选=保留,不勾=合并后隐藏"></td>'
|
||||
+ '<td class="c">' + no + '</td>'
|
||||
+ '<td><input type="text" class="mi c" data-f="code" data-mid="' + r.id + '" value="' + esc(r.code || '') + '" placeholder="编码"></td>'
|
||||
+ '<td class="l" title="' + esc(g.name || '') + '">' + esc(g.name || '—') + (r.sub
|
||||
? ' <span class="subtag" title="带子级组成(台班/配合比):合并后各单位工程的子级以保留行为准,原软件按子级重算母价">子级</span>' : '') + '</td>'
|
||||
+ '<td class="l" title="' + esc(g.spec || '') + '">' + esc(g.spec || '—') + '</td>'
|
||||
+ '<td class="c">' + esc(g.unit || '—') + '</td>'
|
||||
+ '<td class="r">' + num(r.qty, 3) + '</td>'
|
||||
+ '<td><input type="text" class="mi n" data-f="ntp" data-mid="' + r.id + '" value="' + (r.ntp == null ? '' : r.ntp) + '" placeholder="除税编制价"></td>'
|
||||
+ '<td><input type="text" class="mi n" data-f="taxrate" data-mid="' + r.id + '" value="' + (r.taxrate == null ? '' : r.taxrate) + '" placeholder="税率"></td>'
|
||||
+ '<td><input type="text" class="mi n" data-f="taxp" data-mid="' + r.id + '" value="' + (r.taxp == null ? '' : r.taxp) + '" placeholder="含税编制价"></td>'
|
||||
+ '</tr>';
|
||||
});
|
||||
h += '</tbody>';
|
||||
});
|
||||
h += '</table>';
|
||||
$('mtree').innerHTML = h;
|
||||
}
|
||||
async function mergeApply(){
|
||||
@@ -939,10 +1011,25 @@ async function mergeApply(){
|
||||
if (emptyGrp.length && !confirm('以下 ' + emptyGrp.length + ' 组一行都没勾,合并后整组隐藏:\n'
|
||||
+ emptyGrp.slice(0, 5).join('\n') + (emptyGrp.length > 5 ? '\n…' : '')
|
||||
+ '\n\n确认继续合并?')) return;
|
||||
const r = await J('/api/session/lme/merge', { method: 'POST', headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ session_id: SID, groups: groups }) });
|
||||
if(!r || !r.ok){ $('msg').textContent = (r && r.msg) || '合并失败'; return; }
|
||||
// 决策 161:大批量合并耗时——不定进度条 + 双按钮禁用(点「合并」到返回期间弹框保持打开)
|
||||
const btA = [...document.querySelectorAll('#mmask button')].find(b => (b.getAttribute('onclick') || '').includes('mergeApply'));
|
||||
const btC = [...document.querySelectorAll('#mmask button')].find(b => (b.getAttribute('onclick') || '').includes('mergeClose'));
|
||||
$('mprog').style.display = '';
|
||||
if (btA) btA.disabled = true;
|
||||
if (btC) btC.disabled = true;
|
||||
let r = null;
|
||||
try {
|
||||
r = await J('/api/session/lme/merge', { method:'POST', headers:{'Content-Type':'application/json'},
|
||||
body: JSON.stringify({ session_id: SID, groups: groups }) });
|
||||
} catch(e) { $('msg').textContent = '合并失败:' + (e && e.message || e); }
|
||||
finally {
|
||||
$('mprog').style.display = 'none';
|
||||
if (btA) btA.disabled = false;
|
||||
if (btC) btC.disabled = false;
|
||||
}
|
||||
if(!r || !r.ok){ if(r) $('msg').textContent = (r && r.msg) || '合并失败'; return; }
|
||||
mergeClose();
|
||||
$('msg').textContent = '合并完成,正在刷新页面数据…';
|
||||
Object.keys(RV_CACHE).forEach(k=>{ if(String(k).indexOf(SID+'|')===0) delete RV_CACHE[k]; });
|
||||
await rawDraw();
|
||||
await loadLme(); // 决策 142:项目工料机页签同步为合并后数据(服务端 x_merged_hide 过滤、LME_LIST_WHERE 不变)
|
||||
@@ -962,7 +1049,7 @@ async function refreshRaw(){
|
||||
格位对应 rawTreeHTML:0把手 1序号 2编码 3类型 4名称 5特征 6单位 7工程量 8单价 9合价 10取消采纳 11备注 */
|
||||
document.addEventListener('dblclick', function(e){
|
||||
if(!SID) return;
|
||||
const td = e.target.closest && e.target.closest('#rawbody td');
|
||||
const td = e.target.closest && e.target.closest('#rawbody td, #tb0 td');
|
||||
if(!td || td.querySelector('input')) return;
|
||||
const tr = td.closest('tr'); if(!tr) return;
|
||||
const idx = Array.prototype.indexOf.call(tr.children, td);
|
||||
@@ -973,10 +1060,11 @@ document.addEventListener('dblclick', function(e){
|
||||
} else if(tr.classList.contains('sub') && tr.dataset.nid){
|
||||
const F = {4:'Name',7:'Quantity'};
|
||||
if(F[idx]){ api='norm'; id=tr.dataset.nid; field=F[idx]; }
|
||||
} else if(tr.classList.contains('lmerow') && (tr.dataset.lmeid || tr.dataset.id) && RV_LME_DS){
|
||||
} else if((tr.classList.contains('lmerow') || tr.closest('#tb0')) && (tr.dataset.lmeid || tr.dataset.id)){
|
||||
// 2026-10-16 主人口径:项目级工料机汇总 除税编制价|税率|含税编制价 三格可改(单位级行无 data-lmeid=只读)。
|
||||
// 视图下标经 RV_LME_DS 映射到数据下标:6=除税编制价 7=税率 8=含税编制价。
|
||||
const dk = RV_LME_DS[idx];
|
||||
// 决策 147 补落实(2026-10-21):「项目工料机」页签同码同形——双击改价同卡;两处布局同构,
|
||||
// 视图下标=数据下标(6=除税编制价 7=税率 8=含税编制价),卡侧走 RV_LME_DS(恒等映射)兜底。
|
||||
const dk = tr.closest('#tb0') ? idx : (RV_LME_DS ? RV_LME_DS[idx] : null);
|
||||
if(dk===6 || dk===7 || dk===8){ api='lme'; field=({6:'ntp',7:'taxrate',8:'taxp'})[dk]; }
|
||||
}
|
||||
if(!api) return;
|
||||
@@ -1129,7 +1217,7 @@ const LME_FIELDS = { ntp: 6, taxrate: 7, taxp: 8 }; // 字段 → 数据 r[]
|
||||
function lmePriceCells(tr){
|
||||
const out = {};
|
||||
Array.prototype.forEach.call(tr.children, (td, i) => {
|
||||
const dk = RV_LME_DS ? RV_LME_DS[i] : null;
|
||||
const dk = RV_LME_DS ? RV_LME_DS[i] : i; // 决策 147 补落实:项目工料机页签行无 RV_LME_DS,按恒等映射找三价格
|
||||
if(dk===6 || dk===7 || dk===8) out[{6:'ntp',7:'taxrate',8:'taxp'}[dk]] = td;
|
||||
});
|
||||
return out;
|
||||
@@ -1188,6 +1276,9 @@ function lmeEditCell(td, tr, field, cur){
|
||||
const ri = RV_LME_IDS.indexOf(Number(tr.dataset.lmeid));
|
||||
if(ri >= 0 && RV_LME_ROWS[ri]){ RV_LME_ROWS[ri][6]=r.ntp; RV_LME_ROWS[ri][7]=r.taxrate; RV_LME_ROWS[ri][8]=r.taxp; }
|
||||
}
|
||||
// 决策 147 补落实:改的是「项目工料机」页签行时,同步 LME_ROWS 内存值(否则重排序后旧值回显)
|
||||
const li = LME_ROWS.findIndex(x => x[0] === Number(tr.dataset.lmeid || tr.dataset.id));
|
||||
if(li >= 0){ LME_ROWS[li][6]=r.ntp; LME_ROWS[li][7]=r.taxrate; LME_ROWS[li][8]=r.taxp; }
|
||||
const ck = _rvCacheKey(); // 当前视图写回缓存;本会话其余视图缓存撤掉(单位级同步过)
|
||||
Object.keys(RV_CACHE).forEach(k=>{ if(String(k).indexOf(SID+'|')===0 && k!==ck) delete RV_CACHE[k]; });
|
||||
rvCachePut();
|
||||
@@ -1517,7 +1608,7 @@ async function search(){
|
||||
if(seq!==SEARCH_SEQ) return; // 已有更新的请求,丢弃这次过期响应
|
||||
if(!r.ok){ $('htb').innerHTML=`<tr><td colspan="${C_H.length}" class="empty">${esc(r.msg)}</td></tr>`; return; }
|
||||
HROWS=r.rows||[];
|
||||
renderHist();
|
||||
renderHist(); fltMark();
|
||||
}
|
||||
// 2026-09-29:原来按 children[6]/children[7] 取单价,加「类别」列后下标会错位;
|
||||
// 改成读行上的 data-price(原始数值,不带千分位),以后再加/减列都不受影响
|
||||
@@ -1613,7 +1704,7 @@ function renderHist(){
|
||||
const cur=curPrice();
|
||||
const seq0 = HINDEP ? (HPAGE-1)*HLIMIT : 0; // 检索模式跨页连续编号(第 N 页从 (N-1)×500+1 起)
|
||||
// 项目工料机标签(含其检索模式):14 列专属表 —— 来源徽章+规格型号,无把手/单价类型(2026-10-08 主人定)
|
||||
const isLme = (CURTYPE==='lme') || (HINDEP && curTab()==='p0');
|
||||
const isLme = histIsLme(); // 决策 163:跟随选中行类型(检索模式不再按页签强制)
|
||||
const cols = isLme ? C_H_LME : C_H;
|
||||
if($('hattr')) $('hattr').style.display = (isLme || HATTR_FOLD) ? 'none' : ''; // 决策 142:右栏显隐在渲染处统一管(改一处=两侧生效)
|
||||
colg('hcg',cols);
|
||||
@@ -2028,6 +2119,30 @@ document.addEventListener('input', function(e){
|
||||
t.value = pp.length>2 ? pp[0]+'.'+pp.slice(1).join('') : f;
|
||||
}
|
||||
});
|
||||
/* 决策 161:弹框三价恒成立——除税编制价×(1+税率/100)=含税编制价(决策 80/146 同规则换位置)。
|
||||
改除税→按税率算含税;改税率→按除税算含税;改含税→反解除税;弹框内纯前端联动,点「合并」统一提交。
|
||||
在 146 剥除之后注册:读到的已是纯数字。金额四舍五入 2 位,税率空按 0。 */
|
||||
const mRound2 = v => Math.round((v + Number.EPSILON) * 100) / 100;
|
||||
document.addEventListener('input', function(e){
|
||||
const t=e.target;
|
||||
if(!t || !t.classList || !t.classList.contains('mi') || !t.classList.contains('n')) return;
|
||||
const f=t.dataset.f;
|
||||
if(f!=='ntp' && f!=='taxrate' && f!=='taxp') return;
|
||||
const tr=t.closest('tr'); if(!tr) return;
|
||||
const get=g=>tr.querySelector('input[data-f="'+g+'"]');
|
||||
const pv=g=>{ const s=get(g).value.replace(/,/g,'').trim(); const n=Number(s); return s!=='' && isFinite(n) ? n : null; };
|
||||
const ntp=pv('ntp'), taxrate=pv('taxrate'), taxp=pv('taxp');
|
||||
if(f==='ntp'){
|
||||
get('taxp').value = ntp==null ? '' : mRound2(ntp*(1+(taxrate||0)/100));
|
||||
} else if(f==='taxrate'){
|
||||
get('taxp').value = mRound2((ntp||0)*(1+(taxrate||0)/100));
|
||||
} else {
|
||||
if(taxp==null) return;
|
||||
const div=1+(taxrate||0)/100;
|
||||
if(div===0){ $('msg').textContent='税率为 -100,无法反解除税价'; return; }
|
||||
get('ntp').value = mRound2(taxp/div);
|
||||
}
|
||||
});
|
||||
|
||||
/* 附件「下载」= 另存为(2026-10-08 主人定):走公共层 saveAs(选位置保存,不再浏览器里打开)。
|
||||
工程行 = 绑定的询价资料(/api/admin/inq/file/{id});价格行 = 刊物上传原件(/api/admin/file/{sha})。 */
|
||||
@@ -2125,7 +2240,7 @@ function buildKinds(list){
|
||||
updKindBtn();
|
||||
}
|
||||
function onKind(){
|
||||
FLT.kinds=selVals('fkind').map(Number); updKindBtn();
|
||||
FLT.kinds=selVals('fkind').map(Number); updKindBtn(); fltMark();
|
||||
if(!kwActive()) search(); // 无关键字=比对方式:条件即改即查;有关键字只记录,等「查询」
|
||||
}
|
||||
function updKindBtn(){
|
||||
@@ -2140,7 +2255,7 @@ function updKindBtn(){
|
||||
价格范围:对除税单价(与结果表单价列、基准行同口径),两端留空=不限。 */
|
||||
function onSrc(){
|
||||
FLT.srcs=selVals('fsrc');
|
||||
updSrcBtn();
|
||||
updSrcBtn(); fltMark();
|
||||
closePops(); // 选完即收(2026-10-13 主人定:勾一项弹层就收回去)
|
||||
if(!kwActive()) search(); // 无关键字=条件即改即查;有关键字只记录,等「查询」
|
||||
}
|
||||
@@ -2152,12 +2267,12 @@ function updSrcBtn(){
|
||||
}
|
||||
let _prcT=0;
|
||||
function setPrc(){
|
||||
FLT.prcmin=$('fpmin').value; FLT.prcmax=$('fpmax').value;
|
||||
FLT.prcmin=$('fpmin').value; FLT.prcmax=$('fpmax').value; fltMark();
|
||||
if(kwActive()) return;
|
||||
clearTimeout(_prcT); _prcT=setTimeout(search, 250);
|
||||
}
|
||||
function setAtt(){
|
||||
FLT.att=$('hatt').value;
|
||||
FLT.att=$('hatt').value; fltMark();
|
||||
if(!kwActive()) search(); // 无关键字=条件即改即查;有关键字只记录,等「查询」
|
||||
}
|
||||
/* 工料机标签的检索/比对载荷(来源/单价类型/单位/价格范围/附件);类似清单沿用原 file_kinds/bulid_units */
|
||||
@@ -2231,6 +2346,7 @@ function calcArea(){
|
||||
function updAreaBtn(){
|
||||
const nm=FLT.area.map(k=>k.split('/').pop());
|
||||
$('fareaBtn').textContent='地区 '+(FLT.area.length===0?'全国':(FLT.area.length===1?nm[0]:nm[0]+' 等'+FLT.area.length+'项'))+' ▾';
|
||||
fltMark();
|
||||
}
|
||||
/* 建设单位(2026-10-08 主人定):与「打开工程」同款 —— comboFree 自由输入 + 点框出建议下拉,
|
||||
placeholder「输入建设单位」。取值变化:无关键字=即改即查(防抖 250ms);
|
||||
@@ -2239,21 +2355,21 @@ function updAreaBtn(){
|
||||
let _unitT=0;
|
||||
let _projT=0; // 项目名称框防抖(决策 141)
|
||||
function setUnit(v){
|
||||
FLT.unit=(v||'').trim();
|
||||
FLT.unit=(v||'').trim(); fltMark();
|
||||
if(kwActive()) return;
|
||||
clearTimeout(_unitT); _unitT=setTimeout(search, 250);
|
||||
}
|
||||
/* 项目名称(决策 141,2026-10-20 主人定):与单位框同款——自由输入+建议下拉,
|
||||
无关键字=防抖即查;有关键字=只记条件等「查询」。比对/检索两路径共用 FLT.proj。 */
|
||||
function setProj(v){
|
||||
FLT.proj=(v||'').trim();
|
||||
FLT.proj=(v||'').trim(); fltMark();
|
||||
if(kwActive()) return;
|
||||
clearTimeout(_projT); _projT=setTimeout(search, 250);
|
||||
}
|
||||
/* 本项目(2026-10-21 主人定):是=只搜本工程,否=只搜其他工程;按标签记值(FLT.selfByTab)。
|
||||
无关键字=改完即查;有关键字=只记条件等「查询」(与其他条件同口径)。 */
|
||||
function onSelf(){
|
||||
FLT.selfByTab[curTab()]=$('fself').value;
|
||||
FLT.selfByTab[curTab()]=$('fself').value; fltMark();
|
||||
if(kwActive()) return;
|
||||
search();
|
||||
}
|
||||
@@ -2277,7 +2393,7 @@ function resetF(){
|
||||
if($('fself')) $('fself').value = (FLT.selfByTab && FLT.selfByTab[curTab()]) || 'no'; // 本项目回本标签默认(组价不一致=是)
|
||||
$('hsort').value='time';
|
||||
setPeriod($('hperBtn'),'','');
|
||||
updKindBtn(); updSrcBtn(); calcArea(); updAreaBtn(); updQryBtn();
|
||||
updKindBtn(); updSrcBtn(); calcArea(); updAreaBtn(); updQryBtn(); fltMark();
|
||||
search();
|
||||
}
|
||||
function toggleFold(){
|
||||
@@ -2293,6 +2409,7 @@ function updPerBtn(){
|
||||
const v=PVAL($('hperBtn'));
|
||||
const t=(v.fs&&v.ts)?(v.fs===v.ts?v.fs:v.fs+'~'+v.ts):'';
|
||||
$('hperBtn').textContent='期次 '+(t||'全部')+' ▾';
|
||||
fltMark();
|
||||
}
|
||||
/* ---------- 查询按钮(2026-10-08 主人定第 4 轮 B 方案;2026-10-11 屏蔽词/点行带入/非粘性)----------
|
||||
查询按钮只服务「关键字独立检索」:
|
||||
@@ -2309,7 +2426,7 @@ function kwActive(){ return !!(FLT.kw||'').trim(); }
|
||||
function updQryBtn(){ $('btnQuery').disabled = !$('hkw').value.trim() && !kwActive(); }
|
||||
function setKw(v){
|
||||
const was=kwActive();
|
||||
FLT.kw=v;
|
||||
FLT.kw=v; fltMark();
|
||||
if(was && !kwActive()) search(); // 清空关键字:自动回比对方式并立即重查
|
||||
updQryBtn();
|
||||
}
|
||||
@@ -2317,6 +2434,7 @@ function doQuery(){
|
||||
const v=$('hkw').value.trim();
|
||||
if(!v) return; closePops();
|
||||
FLT.kw=v; // 点「查询」=以框内文本为准(点行带入的名称同样成立)
|
||||
fltMark();
|
||||
histSearch();
|
||||
}
|
||||
/* 屏蔽词(2026-10-11 主人定):命中 名称/特征(规格)/单位 任一词的历史行不显示。
|
||||
@@ -2361,8 +2479,8 @@ async function histSearch(page){
|
||||
HPAGE = Math.max(1, int(page) || 1); // 传页码=翻页;不传=新查询回第 1 页
|
||||
const seq=++SEARCH_SEQ; // 与比对查询共用代次:只渲染最新一次
|
||||
// 项目工料机标签:target=lme → 跨全部入库项目查 工料机 + 信息价/市场价明细(2026-10-08 主人定);
|
||||
// 类似清单标签:target=bill(原行为,查清单库)。
|
||||
const onLme = curTab()==='p0';
|
||||
// 类似清单标签:target=bill(原行为,查清单库)。决策 163:目标跟随选中行类型(修 p3 检索曾搜清单库)。
|
||||
const onLme = histIsLme();
|
||||
const flt = onLme ? lmeFlt() : { file_kinds:FLT.kinds, bulid_units:FLT.unit?[FLT.unit]:[] };
|
||||
const selfYes2 = $('fself') && $('fself').value==='yes'; // 本项目(决策 158):是=检索走会话库
|
||||
const r=await J(selfYes2 ? '/api/self/search' : '/api/hist/search',{method:'POST',headers:{'Content-Type':'application/json'},
|
||||
@@ -2379,7 +2497,7 @@ async function histSearch(page){
|
||||
if(seq!==SEARCH_SEQ) return;
|
||||
if(!r.ok){ $('htb').innerHTML=`<tr><td colspan="${C_H.length}" class="empty">${esc(r.msg)}</td></tr>`; return; }
|
||||
HINDEP=true; HROWS=r.rows||[];
|
||||
renderHist();
|
||||
renderHist(); fltMark();
|
||||
$('histtblwrap').scrollTop=0; // 翻页/新查询回到表顶
|
||||
}
|
||||
function updHistPager(){
|
||||
@@ -2393,6 +2511,7 @@ function updHistPager(){
|
||||
function int(v){ const n=parseInt(v,10); return isNaN(n)?0:n; }
|
||||
$('htier').onchange=$('hsort').onchange=()=>{
|
||||
if(FLT.tierByTab && FLT.tierByTab[curTab()]!==undefined) FLT.tierByTab[curTab()]=$('htier').value;
|
||||
fltMark();
|
||||
if(!kwActive()) renderHist(); }; // 无关键字即时重排;有关键字等「查询」
|
||||
$('hkw').oninput=()=>setKw($('hkw').value);
|
||||
$('hkw').onkeydown=e=>{ if(e.key==='Enter'){ e.preventDefault(); doQuery(); } };
|
||||
|
||||
Reference in New Issue
Block a user