feat(lme): 决策244 工料机剪枝只留被引用码,导出按现算视角判零量
This commit is contained in:
@@ -751,8 +751,6 @@ function tgGrp(key, tr) {
|
||||
const g = _grpByKey(key);
|
||||
if (g) {
|
||||
tr.insertAdjacentHTML('afterend', grpRowsHTML(g, key, GRP_DATA.opts));
|
||||
// 规格 ⑮:懒建的行也要补编辑历史红三角
|
||||
if (typeof markGroupEH === 'function' && typeof EH_LOG !== 'undefined' && EH_LOG) markGroupEH(tr.parentNode.id);
|
||||
}
|
||||
}
|
||||
const open = tg.dataset.open === '1';
|
||||
@@ -905,7 +903,6 @@ function grpTreeBind(box, tbId, d, opt) {
|
||||
const nxt = head.nextElementSibling;
|
||||
if (!nxt || nxt.dataset.grp !== key) {
|
||||
head.insertAdjacentHTML('afterend', grpRowsHTML(g, key, o));
|
||||
if (typeof markGroupEH === 'function' && typeof EH_LOG !== 'undefined' && EH_LOG) markGroupEH(tb.id);
|
||||
}
|
||||
}
|
||||
// 本组摘、其余组(组头/清单行/已展开定额子行)与 sep 行挂;无 data-grp 的占位行不动
|
||||
@@ -1021,8 +1018,6 @@ function tgNorm(el, billId) {
|
||||
let n2 = tr.nextElementSibling;
|
||||
while (n2 && n2.classList.contains('sub')) n2 = n2.nextElementSibling;
|
||||
while (frag.firstChild) tr.parentNode.insertBefore(frag.firstChild, n2);
|
||||
// 规格 ⑮:定额子行进 DOM 后补编辑历史红三角(决策 218 补:传 element——原数据表体无 id,原传 id 落空)
|
||||
if (typeof markGroupEH === 'function' && typeof EH_LOG !== 'undefined' && EH_LOG) markGroupEH(tr.parentNode);
|
||||
}).catch(() => { el.textContent = '+'; el.dataset.open = '0'; el.classList.remove('g'); });
|
||||
}
|
||||
|
||||
@@ -1433,9 +1428,6 @@ async function rawDraw(quiet) { // 决策 221:quiet=true 编辑保存静默
|
||||
b.innerHTML = html;
|
||||
colwApply(b.querySelector('table'));
|
||||
if (RVSEL.k === 'uw' && (RVTAB === 'item' || RVTAB === 'prelim')) rawTreeSync();
|
||||
// 决策 218 补:原数据(分部分项/措施项目)重画后补编辑历史红三角(EH_LOG 未载/后台 no-op)
|
||||
if (typeof markGroupEH === 'function' && typeof EH_LOG !== 'undefined' && EH_LOG)
|
||||
markGroupEH(document.getElementById(RVO.bodyEl));
|
||||
b.scrollTop = 0;
|
||||
RV_CACHE[key] = { html: b.innerHTML, scroll: 0 };
|
||||
} catch (e) {
|
||||
@@ -3186,63 +3178,6 @@ function licActivate() {
|
||||
document.addEventListener('mouseup', function(){ DG=null; });
|
||||
})();
|
||||
|
||||
/* ---- 字段编辑历史(规格 2026-10-17 ⑮:红三角批注)----
|
||||
EH_LOG = { "bill:行id:字段": [{at,o,n},...] }(新→旧,/api/session/edit/log 一次取全会话)。
|
||||
markGroupEH(表体id) 给有历史的格挂 .eh(右下红三角);点格弹 .ehpop:
|
||||
序号 | 时间 | 内容(旧值 → 新值),最近修改在最上。 */
|
||||
let EH_LOG = null, EH_M = null, EH_POP = null; // EH_M = 行id → 稳定键基(服务端下发)
|
||||
/* 决策 218 补二:编辑历史只挂**清单行工程量格**(组表 idx8 / 原数据 idx7);键=清单 ekbase;
|
||||
浮层按 时间|工程量|单价|合价 展示改前快照。定额不再有编辑历史。 */
|
||||
const EH_QTY_IDX = { grp: 8, raw: 7 };
|
||||
async function loadEditLog() {
|
||||
if (!SID) return;
|
||||
try {
|
||||
const d = await J('/api/session/edit/log?session_id=' + SID);
|
||||
EH_M = d.m || {}; EH_LOG = {};
|
||||
(d.log || []).forEach(r => { // 决策 218 补二:快照行 {k,at,q,p,t},k=清单键
|
||||
(EH_LOG[r.k] = EH_LOG[r.k] || []).push({ at: r.at, q: r.q, p: r.p, t: r.t });
|
||||
});
|
||||
} catch (e) { EH_LOG = EH_LOG || {}; EH_M = EH_M || {}; }
|
||||
}
|
||||
function markGroupEH(tbId) { // 决策 218 补:接受 id 或 element;#rawbody(原数据 分部分项/措施项目)走 RAW 列位映射
|
||||
const tb = typeof tbId === 'string' ? document.getElementById(tbId) : tbId;
|
||||
if (!tb) return;
|
||||
tb.querySelectorAll('td.eh').forEach(td => { td.classList.remove('eh'); delete td.dataset.ehk; });
|
||||
if (!EH_LOG) return;
|
||||
const mark = (tr, qtyIdx, rid) => {
|
||||
const k = EH_M['b' + rid]; // 决策 218 补二:键=清单 ekbase(快照聚合);决策 225:m 只含清单键(n 键退役)
|
||||
if (k && EH_LOG[k] && EH_LOG[k].length) {
|
||||
const td = tr.children[qtyIdx];
|
||||
if (td) { td.classList.add('eh'); td.dataset.ehk = k; }
|
||||
}
|
||||
};
|
||||
const isRaw = (tb.id === 'rawbody');
|
||||
// 决策 225(主人定):编辑历史只在清单行——组表定额子行(.sub)带着所属清单的 data-bid(GCL 双击定位用),必须排除,否则清单红三角被误挂到每条定额行
|
||||
tb.querySelectorAll('tr[data-bid]:not(.sub)').forEach(tr => mark(tr, EH_QTY_IDX[isRaw ? 'raw' : 'grp'], tr.dataset.bid));
|
||||
}
|
||||
document.addEventListener('click', function (e) {
|
||||
if (EH_POP && EH_POP.contains(e.target)) return; // 点在批注浮层里不关
|
||||
const td = e.target.closest && e.target.closest('td.eh');
|
||||
if (EH_POP) { EH_POP.remove(); EH_POP = null; }
|
||||
if (!td || !td.dataset.ehk) return;
|
||||
const list = (EH_LOG || {})[td.dataset.ehk] || [];
|
||||
const pop = document.createElement('div');
|
||||
pop.className = 'ehpop';
|
||||
// 决策 218 补二:编辑时间|工程量|单价|合价(改前快照,新→旧;本次=格子现值不在此列)
|
||||
const f3 = v => (v == null || v === '') ? '—' : v;
|
||||
pop.innerHTML = '<div class="eh-hd">编辑历史</div><table>'
|
||||
+ '<tr class="eh-th"><td>编辑时间</td><td>工程量</td><td>单价</td><td>合价</td></tr>'
|
||||
+ list.map(r => '<tr><td class="at">' + esc(r.at || '') + '</td><td class="c">' + esc(f3(r.q))
|
||||
+ '</td><td class="c">' + esc(f3(r.p)) + '</td><td class="c">' + esc(f3(r.t))
|
||||
+ '</td></tr>').join('')
|
||||
+ '</table>';
|
||||
document.body.appendChild(pop);
|
||||
const r = td.getBoundingClientRect();
|
||||
pop.style.left = Math.max(6, Math.min(window.innerWidth - pop.offsetWidth - 8, r.left)) + 'px';
|
||||
pop.style.top = Math.max(6, Math.min(window.innerHeight - pop.offsetHeight - 8, r.bottom + 4)) + 'px';
|
||||
EH_POP = pop;
|
||||
});
|
||||
|
||||
/* ---- 全局语言层(2026-10-19 主人定:语言切换控制整个软件)----
|
||||
一处切换(工作台语言条)写 localStorage.wb_lang,所有页面读同一个值;
|
||||
翻译对象 = 按钮 / 页签 / 表头 / 弹框标题 / 表格里的操作链接(主人要求:按钮及表头)。
|
||||
|
||||
Reference in New Issue
Block a user