feat(cost): 落地决策 191-195(清单量联动缩放、手工改价跳过、重解析跳过、对比框状态保持)
This commit is contained in:
@@ -54,6 +54,12 @@ function numG(v) {
|
||||
if (isNaN(n)) return esc(v);
|
||||
return n.toLocaleString('zh-CN', { maximumFractionDigits: 6 });
|
||||
}
|
||||
/* 定额单位数字前缀(决策 194,与服务端 job.unit_prefix 同一把尺):10m3→10、100m3天然密实方→100;
|
||||
纯字母/空→1。工程量编辑框数字按实际量预填/折算用。 */
|
||||
function unitPrefix(u) {
|
||||
const m = (u || '').trim().match(/^(\d+(?:\.\d+)?)/);
|
||||
return m ? parseFloat(m[1]) : 1;
|
||||
}
|
||||
/* 规格 2026-10-16 组价不一致③:行选中样式要给「鼠标点的那一格」贴 .cellhit(#79d7be)。
|
||||
捕获阶段记下最近点选的 td(pick / 定额子行点选用),只记录、不改事件走向。 */
|
||||
document.addEventListener('click', function (e) {
|
||||
@@ -981,7 +987,7 @@ const RAW_UT = [['item', '分部分项'], ['prelim', '措施项目'], ['lme', '
|
||||
const RAW_LME_KIND = 0;
|
||||
|
||||
// 模块级状态:每页只有一个原数据视图(工作台 / 后台各一个),够用。
|
||||
let RVO = null, RVT = null, RVSEL = { k: 'proj', id: 0 }, RVTAB = 'sum', RVLV = 2;
|
||||
let RVO = null, RVT = null, RVSEL = { k: 'proj', id: 0 }, RVTAB = 'sum', RVLV = 2, RV_TREE_KEEP = false;
|
||||
/* 树的「展开」与「选中」必须分开记(2026-10-07 修交互):
|
||||
此前单项工程节点"被选中才展开",于是 ① 默认全是收起的(主人要的默认打开没有);
|
||||
② 点开单位工程后,父级单项工程整个收起、刚选中的节点直接消失(看着就是"点了没反应/树乱跳");
|
||||
@@ -1181,7 +1187,7 @@ function rawTabs() {
|
||||
}
|
||||
st.innerHTML = h;
|
||||
}
|
||||
function rawTab(t) { RVTAB = t; rawTabs(); rawDraw(); }
|
||||
function rawTab(t) { RVTAB = t; _rvStateSave(); rawTabs(); rawDraw(); }
|
||||
function rawLv(v) {
|
||||
RVLV = v;
|
||||
RV_TREE = { root: true, divs: {}, bills: {} }; // 新档:树状态交给 rawTreeHTML 重建
|
||||
@@ -1237,6 +1243,7 @@ async function rawPick(k, id, el) {
|
||||
RVSEL = { k: k, id: id };
|
||||
RVTAB = k === 'uw' ? 'item' : 'sum';
|
||||
RVLV = 2; // 默认「只展开到清单」(主人 2026-10-07 定)
|
||||
// 决策 195:保存放渲染完成后——开头存会把 rvst 里的展开状态用空树盖掉(实测踩坑)
|
||||
// 点名字 = 选中**并**展开自己所在的分支(收起只走 ± 把手,两条线分开)
|
||||
if (RVOPEN === null) RVOPEN = new Set(((RVT && RVT.sections) || []).map(s => s.id));
|
||||
if (k === 'sec') RVOPEN.add(id);
|
||||
@@ -1247,6 +1254,7 @@ async function rawPick(k, id, el) {
|
||||
if (tree) tree.querySelectorAll('.rn').forEach(x => x.classList.remove('on'));
|
||||
if (el) el.classList.add('on');
|
||||
drawRawTree(); rawTabs(); await rawDraw();
|
||||
_rvStateSave();
|
||||
}
|
||||
/* ± 把手:只折叠/展开,不改变右侧选中(否则看个目录就把右边的表切走了) */
|
||||
function rawFoldSec(ev, id) {
|
||||
@@ -1387,12 +1395,19 @@ function rawTreeSync() {
|
||||
});
|
||||
rvCachePut(); // 折叠状态写回缓存(切标签回来不丢)
|
||||
}
|
||||
function _rvStateSave() { // 决策 195:展开/收起+原数据视图上下文按会话记忆(重开/刷新页面后原样恢复)
|
||||
try {
|
||||
const m = (typeof location !== 'undefined' ? (location.search || '') : '').match(/[?&]sid=(\d+)/);
|
||||
localStorage.setItem('rvst_' + (m ? m[1] : ''), JSON.stringify({ tree: RV_TREE, sel: RVSEL, tab: RVTAB }));
|
||||
} catch (e) {}
|
||||
}
|
||||
function rawTog(key, el) {
|
||||
if (key === 'uw') RV_TREE.root = !RV_TREE.root;
|
||||
else {
|
||||
const m = (key.charAt(0) === 'd') ? RV_TREE.divs : RV_TREE.bills;
|
||||
m[key] = !m[key];
|
||||
}
|
||||
_rvStateSave();
|
||||
rawTreeSync();
|
||||
}
|
||||
function rawTreeHTML(d) {
|
||||
@@ -1415,6 +1430,11 @@ function rawTreeHTML(d) {
|
||||
let n = 0, rows = '';
|
||||
// 展开状态按当前层级档重建(切层级按钮 / 换单位工程都会走到这里)
|
||||
// RVLV=1 只到分部(分部全收) RVLV=2 只到清单(清单全收) RVLV=3 全展开
|
||||
// 决策 195(2026-10-25 主人定):重绘只动操作点——refreshRaw 重绘保留当前展开/收起
|
||||
// (一次性 keep 旗标);重开/刷新页面按会话记忆恢复(rawTog 落的 rvst_<sid>);
|
||||
// 层级按钮/换节点等显式换档照旧重建。
|
||||
const _keepTree = (typeof RV_TREE_KEEP !== 'undefined' && RV_TREE_KEEP && RV_TREE) ? RV_TREE : null;
|
||||
if (typeof RV_TREE_KEEP !== 'undefined') RV_TREE_KEEP = false;
|
||||
RV_TREE = { root: true, divs: {}, bills: {} };
|
||||
const initState = nodes => nodes.forEach(nd => {
|
||||
RV_TREE.divs['d' + nd.id] = (RVLV >= 2);
|
||||
@@ -1423,6 +1443,16 @@ function rawTreeHTML(d) {
|
||||
});
|
||||
initState(divs);
|
||||
loose.forEach(b => { RV_TREE.bills['b' + b.id] = (RVLV >= 3); });
|
||||
const _applyTree = src => {
|
||||
for (const k in RV_TREE.divs) if (k in src.divs) RV_TREE.divs[k] = !!src.divs[k];
|
||||
for (const k in RV_TREE.bills) if (k in src.bills) RV_TREE.bills[k] = !!src.bills[k];
|
||||
};
|
||||
if (_keepTree) _applyTree(_keepTree);
|
||||
else try {
|
||||
const _sm = (typeof location !== 'undefined' ? (location.search || '') : '').match(/[?&]sid=(\d+)/);
|
||||
const _sv = JSON.parse(localStorage.getItem('rvst_' + (_sm ? _sm[1] : '')) || 'null');
|
||||
if (_sv && _sv.tree) _applyTree(_sv.tree);
|
||||
} catch (e) {}
|
||||
const tgi = (key, off) => {
|
||||
const open = _rvExp(key);
|
||||
return '<td class="tgc"><span class="tgi" data-node="' + key + '" title="展开/收起"'
|
||||
|
||||
Reference in New Issue
Block a user