feat(workbench): 工程量公式、另存为导出与字段编辑历史等多项功能
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<style>
|
||||
:root{--c1:#123a6b;--c2:#1f5fae;--line:#c9d4e2;--head:#eef3fa;--bg:#f5f7fa;--txt:#1c2733;--muted:#5a6b7f}
|
||||
*{box-sizing:border-box}
|
||||
body{font-family:"Microsoft YaHei",system-ui,sans-serif;margin:0;background:var(--bg);color:var(--txt);font-size:13px}
|
||||
body{font-family:"Source Han Sans SC","Noto Sans SC","Source Han Sans CN","MiSans","HarmonyOS Sans SC","Microsoft YaHei",sans-serif;margin:0;background:var(--bg);color:var(--txt);font-size:13px}
|
||||
.wrap{margin:0 auto;padding:10px 16px 14px} /* 2026-10-07 去 1760 上限:面板吃满窗口(主人定) */
|
||||
/* h1 标题行与 .sub 统计行已于 2026-10-06 去掉(主人定),对应样式一并删除,不留死代码。 */
|
||||
/* 数据过期提示条已于 2026-10-11 取消(主人定):打开即自动升级(决策 34)后「需重导」口径不再成立。 */
|
||||
@@ -202,7 +202,7 @@ body.rawcol-dragging #dside{pointer-events:none} /* 拖过目录树表面不
|
||||
.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}
|
||||
@@ -227,7 +227,7 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
.newflag{display:inline-block;margin-left:6px;padding:0 5px;border-radius:3px;background:#fff7e6;
|
||||
border:1px solid #f0d9a8;color:#8a6d1a;font-size:11px}
|
||||
</style>
|
||||
<link rel="stylesheet" href="common.css">
|
||||
<link rel="stylesheet" href="common.css?v=20261017c">
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrap">
|
||||
@@ -550,7 +550,7 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="common.js?v=20261016a"></script>
|
||||
<script src="common.js?v=20261017h"></script>
|
||||
<script src="period.js"></script>
|
||||
<script>
|
||||
const $=id=>document.getElementById(id);
|
||||
@@ -844,7 +844,7 @@ async function loadPrice(){
|
||||
if((!PD.picked || (PD.cur!==0 && !PDMAP[PD.cur])))
|
||||
PD.cur = PD.tree.length ? PD.tree[0].id : 0;
|
||||
const m=PDMAP[PD.cur];
|
||||
PD.curName=m?m.name:'(未分类)';
|
||||
PD.curName=m?m.name:'';
|
||||
PD.curPath=m?m.path:'';
|
||||
PD.curLeaf=PD.cur===0?true:!!m.leaf;
|
||||
await loadPriceRows();
|
||||
@@ -862,7 +862,7 @@ async function loadPriceRows(){
|
||||
async function pickDir(id){
|
||||
PD.cur=id; PD.picked=true; PD.editId=0; PD.addingRow=false; pdClear();
|
||||
const m=PDMAP[id];
|
||||
PD.curName=m?m.name:'(未分类)';
|
||||
PD.curName=m?m.name:'';
|
||||
PD.curPath=m?m.path:'';
|
||||
PD.curLeaf=id===0?true:!!m.leaf;
|
||||
await loadPriceRows();
|
||||
@@ -898,12 +898,12 @@ function renderTree(){
|
||||
</div>`;
|
||||
}
|
||||
/* ---- 根目录工具排(2026-10-13 决策 48 主人定:行内按钮全部收编到这里)----
|
||||
六个按钮作用于「当前选中的目录」(PD.cur);(未分类)是虚拟节点不可改删移 ——
|
||||
六个按钮作用于「当前选中的目录」(PD.cur);没选中任何目录(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}"`
|
||||
return `<span${cls?` class="${cls}"`:''} title="${off?'请先点选一个目录':title}"`
|
||||
+ (off?'':` onclick="event.stopPropagation();${fn}"`)+`>${txt}</span>`;
|
||||
}
|
||||
function rootBarHTML(){
|
||||
@@ -984,7 +984,7 @@ async function dirPost(body){
|
||||
renderTree(); // 先重建 PDMAP 再读新 leaf——否则拿到旧状态,"最底层目录"提示会误判(2026-10-13 主人报)
|
||||
if(!dirExists(PD.cur)) PD.cur = PD.tree.length ? PD.tree[0].id : 0;
|
||||
const m=PDMAP[PD.cur];
|
||||
PD.curName=m?m.name:'(未分类)'; PD.curPath=m?m.path:''; PD.curLeaf=PD.cur===0?true:!!m.leaf;
|
||||
PD.curName=m?m.name:''; PD.curPath=m?m.path:''; PD.curLeaf=PD.cur===0?true:!!m.leaf;
|
||||
await loadPriceRows();
|
||||
return true;
|
||||
}
|
||||
@@ -1024,10 +1024,11 @@ function renderRows(){
|
||||
const editing=PD.editId||PD.addingRow;
|
||||
$('ptool').classList.toggle('editing', !!editing);
|
||||
if(editing) $('pdirsel').innerHTML=leavesHTML(PD.editId?curEditDir():PD.cur);
|
||||
$('pwhere').textContent = PD.curLeaf ? `当前:${PD.curName}(最底层目录,可挂价格行)`
|
||||
: `当前:${PD.curName}(含子目录,仅查看)`;
|
||||
$('pwhere').textContent = !PD.curName ? '当前:全部价格行(该批次未挂目录,历史数据)'
|
||||
: (PD.curLeaf ? `当前:${PD.curName}(最底层目录,可挂价格行)`
|
||||
: `当前:${PD.curName}(含子目录,仅查看)`);
|
||||
// (dsecH 显隐归 detLayout;这里只刷内容)
|
||||
$('dsecH').innerHTML = esc(PD.curPath || PD.curName)
|
||||
$('dsecH').innerHTML = esc(PD.curPath || PD.curName || '全部价格行')
|
||||
+ `<span class="crumb">${PD.curLeaf?'':'(含子目录汇总) '}共 ${PD.total} 条</span>`;
|
||||
tb.innerHTML=PD.rows.map(rowHTML).join('')
|
||||
+ (PD.addingRow?newRowHTML():'');
|
||||
|
||||
@@ -57,7 +57,7 @@ body.rawcol-dragging .rawtree{pointer-events:none} /* 拖过树表面时不选
|
||||
.hint{font-size:11.5px;color:var(--muted);padding:4px 10px;background:#fafcff;border-bottom:1px solid var(--line)}
|
||||
.stabs{display:flex;gap:2px;padding:4px 8px 0;background:#fafcff;border-bottom:1px solid var(--line);flex-wrap:wrap;flex:none}
|
||||
.stab{padding:4px 13px;border:1px solid var(--line);border-bottom:none;background:#eef3fa;border-radius:5px 5px 0 0;font-size:12px;cursor:pointer;color:var(--muted)}
|
||||
.stab.on{background:#fff;font-weight:700;color:var(--c1)}
|
||||
.stab.on{background:var(--c2);border-color:var(--c2);color:#fff;font-weight:600} /* 规格 2026-10-17 工具栏5:工作态蓝底(原白底凸出款废止) */
|
||||
/* 分部分项 / 措施项目:标签卡右边的「分部 / 清单 / 定额」——控制展开到哪一级 */
|
||||
.lvgrp{margin-left:auto;display:flex;align-items:center;gap:2px;padding:0 2px 4px}
|
||||
.lvbtn{padding:3px 10px;border:1px solid var(--line);border-radius:4px;background:#fff;
|
||||
@@ -66,6 +66,9 @@ body.rawcol-dragging .rawtree{pointer-events:none} /* 拖过树表面时不选
|
||||
/* 「默认列宽」是动作按钮,不是状态按钮 → 不做选中态,用中性色跟分部/清单/定额区分开;
|
||||
再给 8px 右间距,把「动作」和「状态」两组在视觉上劈开(只差一个色阶容易被看成同一组) */
|
||||
.lvbtn.rst{color:#5a6b7e;background:#f6f8fb;margin-right:8px}
|
||||
/* 规格 2026-10-17 工具栏5:工作态=蓝底白字 */
|
||||
.lvbtn.on{background:var(--c2);border-color:var(--c2);color:#fff;font-weight:600}
|
||||
.lvbtn.on:hover{background:var(--c2);color:#fff}
|
||||
/* 与 .stab.on 同一语义:选中 = 白底凸出 + 主色粗字(不能做成蓝底白字,那看着像禁用) */
|
||||
.lvbtn.on{background:#fff;border-color:var(--c1);color:var(--c1);font-weight:700}
|
||||
.kvtb td:first-child{background:#f7f9fc;color:var(--c1);font-weight:600;width:220px}
|
||||
@@ -181,8 +184,12 @@ tr.resk td{background:#f7f9fc;color:#5a6b7e;font-size:12px}
|
||||
/* 数字列必须等宽数字:金额/工程量小数点对齐后才扫得动(审计表格最容易翻车的地方)。
|
||||
.r 只做了右对齐还不够——比例数字下「1」比「8」窄,位数不同就串行。 */
|
||||
td.r, td.num, .r, .num{font-variant-numeric:tabular-nums}
|
||||
/* 表格选中态(2026-10-11 主人定):淡蓝底、无边框、无竖条——全页面含弹框统一 */
|
||||
tr.sel td{background:#e0effc}
|
||||
/* 表格选中态(2026-10-11 主人定:淡蓝底、无边框、无竖条——全页面含弹框统一;
|
||||
规格 2026-10-16 组价不一致③改版:整行淡蓝 + 鼠标点选格 #a8e3d2 + 整行绿色外框,
|
||||
定额子行点选 .subsel 同配色,整套软件一套) */
|
||||
tr.sel td, tr.subsel td{background:#d8e9fc}
|
||||
tr.sel td.cellhit, tr.subsel td.cellhit{background:#a8e3d2 !important}
|
||||
tr.sel, tr.subsel{outline:1px solid #35a06b; outline-offset:-1px}
|
||||
|
||||
/* ---- 定额「耗」按钮 + 工料机浮层(2026-10-15 公共功能4,取代旧「子目工料机」底板)----
|
||||
圆按钮嵌在定额子行序号格里;浮层挂 body + fixed 定位(z-600 高于明细弹框遮罩),
|
||||
@@ -192,7 +199,16 @@ tr.sel td{background:#e0effc}
|
||||
font-size:11px;font-weight:700;cursor:pointer;user-select:none}
|
||||
.haobtn:hover{background:var(--c2);color:#fff}
|
||||
.haopop{position:fixed;z-index:600;background:#fff;border:1px solid var(--line);border-radius:6px;
|
||||
box-shadow:0 6px 18px rgba(15,40,80,.18);overflow:auto;max-height:60vh;max-width:760px}
|
||||
box-shadow:0 6px 18px rgba(15,40,80,.18);overflow:auto;max-height:60vh;max-width:1100px}
|
||||
/* 规格 公共功能4:浮层字段支持左右拉伸(colgroup px + th.rs,拖动只动被拖列、浮层总宽跟着变)。
|
||||
.rs 需要定位父级——.haopop th 已是 sticky(定位元素),无需再加 relative。
|
||||
📌 钉住条:默认鼠标离开即灭(规格原文),钉住后离开不关、点空白关闭 */
|
||||
.haobar{display:flex;align-items:center;justify-content:space-between;padding:2px 8px 4px;
|
||||
border-bottom:1px solid var(--line);position:sticky;top:0;background:#eef3fa;z-index:1}
|
||||
.haobar .ht{font-size:11px;color:var(--c1);font-weight:700}
|
||||
.haobar .pin{cursor:pointer;font-size:12px;line-height:1;opacity:.5;user-select:none;border-radius:4px;padding:0 3px}
|
||||
.haobar .pin:hover{opacity:1;background:#dde8f6}
|
||||
.haobar .pin.on{opacity:1;background:#dde8f6;box-shadow:0 0 0 1px var(--c2) inset}
|
||||
.haopop table{border-collapse:collapse;font-size:12px}
|
||||
.haopop th{position:sticky;top:0;background:#eef3fa;color:var(--c1);padding:3px 8px;
|
||||
border-bottom:1px solid var(--line);white-space:nowrap;text-align:center}
|
||||
@@ -261,3 +277,17 @@ tr.xtdel > td:not(.tgc), tr.xtdel > td:not(.tgc) span { text-decoration: line-th
|
||||
/* 双击行内编辑的输入框(原数据树表内) */
|
||||
#rawbody td input.cellin, .rawbody td input.cellin { width: 100%; box-sizing: border-box;
|
||||
border: 1px solid #7aa7d9; border-radius: 3px; font: inherit; padding: 0 4px; outline: none; }
|
||||
|
||||
/* ---- 规格 2026-10-17 ⑮:字段编辑历史——右下红三角 + 批注浮层(序号/时间/内容,最近在上)---- */
|
||||
td.eh{position:relative}
|
||||
td.eh::after{content:'';position:absolute;right:0;bottom:0;width:0;height:0;
|
||||
border-style:solid;border-width:0 0 9px 9px;border-color:transparent transparent #c0392b transparent;
|
||||
pointer-events:none}
|
||||
.ehpop{position:fixed;z-index:700;background:#fff;border:1px solid var(--line);border-radius:6px;
|
||||
box-shadow:0 8px 22px rgba(15,40,80,.18);max-height:50vh;max-width:520px;overflow:auto;font-size:12px}
|
||||
.ehpop .eh-hd{padding:5px 10px;background:var(--head);color:var(--c1);font-weight:700;
|
||||
position:sticky;top:0}
|
||||
.ehpop table{border-collapse:collapse;width:100%}
|
||||
.ehpop td{padding:3px 8px;border-bottom:1px solid #f1f5f9;vertical-align:top}
|
||||
.ehpop td.n{color:#8a97a8;width:26px;text-align:right}
|
||||
.ehpop td.at{color:#51606f;white-space:nowrap}
|
||||
|
||||
@@ -45,6 +45,21 @@ function num(v, d) {
|
||||
const k = d ?? 2;
|
||||
return n.toLocaleString('zh-CN', { minimumFractionDigits: k, maximumFractionDigits: k });
|
||||
}
|
||||
/* 定额工程量显示(规格 2026-10-16 工作台·组价不一致清单):按真实数字出,不固定位数——
|
||||
清单量 5.03 时 单位 t→5.03、10t→0.503、100t→0.0503、1000t→0.00503(源文件定额
|
||||
Quantity 恒 6 位小数,多余的尾零不显)。 */
|
||||
function numG(v) {
|
||||
if (v == null || v === '') return '—';
|
||||
const n = Number(v);
|
||||
if (isNaN(n)) return esc(v);
|
||||
return n.toLocaleString('zh-CN', { maximumFractionDigits: 6 });
|
||||
}
|
||||
/* 规格 2026-10-16 组价不一致③:行选中样式要给「鼠标点的那一格」贴 .cellhit(#79d7be)。
|
||||
捕获阶段记下最近点选的 td(pick / 定额子行点选用),只记录、不改事件走向。 */
|
||||
document.addEventListener('click', function (e) {
|
||||
const td = e.target && e.target.closest ? e.target.closest('td') : null;
|
||||
window.__lastPickedTd = td || null;
|
||||
}, true);
|
||||
const rm = v => num(v, 2);
|
||||
const r3 = v => num(v, 3);
|
||||
// 项目特征:按序号拆成多行((1) / 1、 / 1. 三种写法;排除 2.5 这类小数被误拆)
|
||||
@@ -76,7 +91,7 @@ const TAB_DEFAULT = 'p3';
|
||||
function tabsHTML() {
|
||||
// 2026-10-11 主人定:原数据标签**不挂徽标**(n3 从未有数据源,恒显 0 误导);其余标签徽标保留
|
||||
return TABS.map(t =>
|
||||
`<div class="tab${t.p === TAB_DEFAULT ? ' on' : ''}" data-p="${t.p}" onclick="WB_TAB('${t.p}')">`
|
||||
`<div class="tab${t.p === TAB_DEFAULT ? ' on' : ''}" data-p="${t.p}" data-i18n="tab.${t.p}" onclick="WB_TAB('${t.p}')">`
|
||||
+ `${t.name}${t.p === 'p3' ? '' : '<span class="n" id="n' + t.p.slice(1) + '">0</span>'}</div>`).join('');
|
||||
}
|
||||
/* 标签点击 → 转交各页自己的切换函数。
|
||||
@@ -692,7 +707,11 @@ function tgGrp(key, tr) {
|
||||
const nxt = tr.nextElementSibling;
|
||||
if (!nxt || nxt.dataset.grp !== key) {
|
||||
const g = _grpByKey(key);
|
||||
if (g) tr.insertAdjacentHTML('afterend', grpRowsHTML(g, key, GRP_DATA.opts));
|
||||
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';
|
||||
tg.dataset.open = open ? '0' : '1';
|
||||
@@ -771,7 +790,9 @@ function grpTreeRender(box, d, pick, opt) {
|
||||
// 组号跟主表对齐(2026-10-10 主人定「按现有目录排序」):一律按显示位置连续编第 1~N 组,
|
||||
// 不再用规则 seq —— 那套号与主表错位,还和系统组撞号(第19/20/24组在树里各出现两次)。
|
||||
// 关键词组名保留(主表组标题没有组名,左树是唯一能看到组名的地方)。
|
||||
const nm = g.cat
|
||||
const nm = (opt.kind === 'inconsistent' && g.name)
|
||||
? '第 ' + (i + 1) + ' 组 · ' + esc(g.name) + ' · ' + n + ' 条' // 规格 左目录区1
|
||||
: g.cat
|
||||
? '第 ' + (i + 1) + ' 组 · ' + esc(g.cat) + '(' + n + ' 条)'
|
||||
: '第 ' + (i + 1) + ' 组 · ' + n + ' 条';
|
||||
h += '<div class="rn lv1" data-pk="' + pfx + 'g' + i + '"><span class="nm">' + nm + '</span></div>';
|
||||
@@ -815,6 +836,8 @@ function grpTreeBind(box, tbId, d, opt) {
|
||||
const lbl = key.charAt(1) === 'g' ? ('第 ' + (i + 1) + ' 组')
|
||||
: ('第 ' + ((d.groups || []).length + i + 1) + ' 组');
|
||||
tb.innerHTML = renderGroups({ groups: [g], labels: [lbl] }, kind);
|
||||
// 决策 90(2026-10-17):点组=只显示该组时,列宽整体缩到贴住容器——右边不再有下滑条
|
||||
if (typeof fitGroupWidth === 'function') fitGroupWidth(tbId);
|
||||
}, { kind: kind, rootName: opt.rootName });
|
||||
}
|
||||
|
||||
@@ -883,7 +906,11 @@ function tgNorm(el, billId) {
|
||||
// 决策 68 批次B:会话侧 r[6]=x_tdel(原定额转临删→浅灰横线)、r[7]=x_adopt;批次侧恒 0
|
||||
// 公共功能4(2026-10-15):序号格挂圆形「耗」按钮 → 工料机浮层(r[8]=定额 id,两侧同形;
|
||||
// 无 id 的行没有按钮、退回「—」占位)
|
||||
// 规格 2026-10-16:子行挂 data-nid+data-bid → 组表双击改工程量(GCL 公式)只对会话侧行生效;
|
||||
// 工程量按真实数字显示(numG,不固定位数)
|
||||
// 决策 90(2026-10-17):会话侧 r[9]=qty_expr 公式原文——有公式显示公式(采纳默认 GCL)
|
||||
frag.innerHTML = rows.map(r => '<tr class="sub' + (r[6] ? ' xtdel' : '') + '" data-grp="' + gp + '"'
|
||||
+ (r[8] ? ' data-nid="' + r[8] + '" data-bid="' + billId + '"' : '')
|
||||
+ (r[8] ? '' : ' title="展开/收起该清单下的定额"')
|
||||
+ '>'
|
||||
+ '<td class="tg"></td><td class="c">' + haoBtn(r[8]) + '</td><td class="c">' + ell(r[0], '—') + '</td>'
|
||||
@@ -892,7 +919,7 @@ function tgNorm(el, billId) {
|
||||
+ '<td><span class="ind"> </span>' + ell(r[1], '—') + '</td>'
|
||||
+ '<td class="attr nv">—</td>'
|
||||
+ '<td class="c">' + esc(r[2] || '—') + '</td>'
|
||||
+ '<td class="r">' + num(r[3], 3) + '</td>'
|
||||
+ '<td class="r">' + (r[9] ? esc(r[9]) : numG(r[3])) + '</td>'
|
||||
+ '<td class="r">' + num(r[4]) + '</td>'
|
||||
+ '<td class="r">' + num(r[5]) + '</td>'
|
||||
+ (opts.backend ? '' : '<td class="c">—</td><td></td>')
|
||||
@@ -901,6 +928,8 @@ 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 后补编辑历史红三角
|
||||
if (typeof markGroupEH === 'function' && typeof EH_LOG !== 'undefined' && EH_LOG) markGroupEH(tr.parentNode.id);
|
||||
}).catch(() => { el.textContent = '+'; el.dataset.open = '0'; el.classList.remove('g'); });
|
||||
}
|
||||
|
||||
@@ -1070,24 +1099,22 @@ function rawTabs() {
|
||||
// 「默认列宽」是动作按钮,不做选中态
|
||||
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>';
|
||||
+ ['1_分组_分组', '2_清单_清单', '3_定额_定额'].map(x => {
|
||||
const v = Number(x[0]), nm = x.slice(2, x.indexOf('_', 2)), k = x.slice(x.indexOf('_', 2) + 1);
|
||||
return '<div class="lvbtn' + (RVLV === v ? ' on' : '') + '" data-i18n="' + k + '" onclick="rawLv(' + v + ')">' + nm + '</div>';
|
||||
}).join('')
|
||||
+ '<div class="lvbtn rst" onclick="rawRst()" title="把拖过的列宽全部还原">默认列宽</div></div>'
|
||||
+ '<div class="lvbtn rst" data-i18n="lv.defw" onclick="rawRst()" title="把拖过的列宽全部还原">默认列宽</div></div>'
|
||||
: '';
|
||||
const mounts = document.querySelectorAll('.rawLvMount');
|
||||
if (mounts.length) { mounts.forEach(m => m.innerHTML = lv); } // 决策 72:类似清单/组价不一致 双挂点同渲染
|
||||
else h += lv;
|
||||
if (typeof wbApplyLang === 'function') wbApplyLang(); // 重挂后按当前语言回填工具栏文案
|
||||
// 2026-10-14 主人定:项目级标签行右侧加「导出」「合并工料机」占位按钮(功能后加)
|
||||
if (RVSEL.k === 'proj') {
|
||||
// 决策 69 批次C:合并工料机实装(工作台接 rawMergeOpen;后台批次库只读,维持占位)
|
||||
// 「导出」已上移顶栏(规格 工料机汇总13:询价附件左边)——工具行不再重复
|
||||
const canMerge = typeof window.rawMergeOpen === 'function';
|
||||
const canExport = typeof window.exportSession === 'function';
|
||||
h += '<div style="margin-left:auto;display:flex;gap:4px;align-items:center">'
|
||||
+ (canExport
|
||||
? '<div class="lvbtn" onclick="exportSession()" title="按原格式导出本工程(含全部编辑:临删已省略、新增/采纳已写入)">导出</div>'
|
||||
: '<div class="lvbtn" title="功能即将上线">导出</div>')
|
||||
+ (canMerge
|
||||
? '<div class="lvbtn" onclick="rawMergeOpen()" title="按 名称|规格|单位 归并项目级工料机">合并工料机</div>'
|
||||
: '<div class="lvbtn" title="功能即将上线">合并工料机</div>') + '</div>';
|
||||
@@ -1103,10 +1130,49 @@ function rawLv(v) {
|
||||
rawTabs(); rawDraw();
|
||||
}
|
||||
function rawRst() {
|
||||
// 规格 2026-10-17 ⑨:组价不一致/类似清单面板里点「默认列宽」= 复位本组表——
|
||||
// 项目特征列尽量大、表左右两缘贴屏对齐;拖列手感照旧(本次只动复位语义,不碰拖动器)。
|
||||
// 原数据视图维持原语义:清记忆重画。
|
||||
const cur = document.querySelector('.tab.on');
|
||||
const p = cur ? cur.dataset.p : 'p3';
|
||||
if (p === 'p1' || p === 'p2') { grpRst(p === 'p1' ? 'tb1' : 'tb2'); return; }
|
||||
const b = document.getElementById(RVO.bodyEl);
|
||||
if (b) { const t = b.querySelector('table'); if (t) colwClear(t); b.innerHTML = ''; }
|
||||
rawDraw(); // 重画后回默认列宽
|
||||
}
|
||||
/* 组表复位(规格 ⑨):清列宽记忆 → 列宽回 COLS.bill 默认 → 项目特征列挂 attrfill
|
||||
补宽(加宽到贴满容器,ResizeObserver 盯容器,左右两缘随屏对齐)。
|
||||
拖列时公共拖动器按既有口径把 attrfill 表就地转「拖列只动被拖列」,互不干扰。 */
|
||||
/* 决策 90(2026-10-17):点组=只显示该组时列宽整体等比缩到贴住容器——右边不再有下滑条。
|
||||
不动列宽记忆;根节点(显示全部)不缩。 */
|
||||
function fitGroupWidth(tbId){
|
||||
const body = document.getElementById(tbId); if(!body) return;
|
||||
const table = body.closest('table'); if(!table) return;
|
||||
const host = table.parentNode; if(!host || !host.clientWidth) return;
|
||||
if (table.offsetWidth <= host.clientWidth) return;
|
||||
const cg = table.querySelector('colgroup'); if(!cg) return;
|
||||
const k = host.clientWidth / table.offsetWidth;
|
||||
Array.prototype.forEach.call(cg.children, c => {
|
||||
const w = parseFloat(c.style.width) || 0;
|
||||
c.style.width = Math.max(30, Math.floor(w * k)) + 'px';
|
||||
});
|
||||
sumw(table);
|
||||
}
|
||||
function grpRst(tbId) {
|
||||
const body = document.getElementById(tbId);
|
||||
if (!body) return;
|
||||
const tb = body.closest('table');
|
||||
if (!tb) return;
|
||||
colwClear(tb);
|
||||
if (tb._attrRO) { tb._attrRO.disconnect(); tb._attrRO = null; }
|
||||
tb._attrCol = null; delete tb.dataset.attrfill;
|
||||
const cols = billCols();
|
||||
const cg = tb.querySelector('colgroup');
|
||||
if (cg) cg.innerHTML = colgHTML(cols);
|
||||
sumw(tb);
|
||||
const ai = cols.findIndex(c => c[0] === '项目特征');
|
||||
if (ai > -1) attrFillBind(tb, ai, Array.isArray(cols[ai]) ? cols[ai][1] : 260);
|
||||
}
|
||||
async function rawPick(k, id, el) {
|
||||
RVSEL = { k: k, id: id };
|
||||
RVTAB = k === 'uw' ? 'item' : 'sum';
|
||||
@@ -1338,13 +1404,16 @@ function rawTreeHTML(d) {
|
||||
(b.norms || []).forEach(x => {
|
||||
// 公共功能4(2026-10-15):序号格挂圆形「耗」按钮 → 工料机浮层(x[0] = 定额 id)
|
||||
// 决策 68 批次B:x[7]=x_tdel 原定额转临删(浅灰横线);x[8]=x_adopt 采纳追加
|
||||
// 决策 90(2026-10-17):x[9]=qty_expr 工程量公式原文(GCL/GCL*0.5…)——有公式显示公式
|
||||
const ncls = 'sub' + (x[7] ? ' xtdel' : '');
|
||||
rows += '<tr class="' + ncls + '" data-vis="uw/' + path + '/b' + b.id + '" data-path="' + path + '/b' + b.id + '">'
|
||||
// data-nid:定额行内编辑(规格5 双击 名称|工程量)按它定位——此前子行没带这个属性,
|
||||
// 双击分支永远进不去(存量雷,规格 2026-10-16 顺手修);x[0]=定额 id
|
||||
rows += '<tr class="' + ncls + '" data-nid="' + x[0] + '" data-vis="uw/' + path + '/b' + b.id + '" data-path="' + path + '/b' + b.id + '">'
|
||||
+ '<td class="tgc"></td><td class="c">' + haoBtn(x[0]) + '</td><td class="c">' + ell(x[1], '—') + '</td>'
|
||||
+ '<td class="c"><span class="kind d">定额</span></td>'
|
||||
+ '<td class="l" style="' + ind(dp + 1) + '">' + ell(x[2], '—') + '</td>'
|
||||
+ '<td class="attr nv">—</td><td class="c u">' + esc(x[3] || '—') + '</td>'
|
||||
+ '<td class="r">' + r3(x[4]) + '</td><td class="r">' + rm(x[5]) + '</td>'
|
||||
+ '<td class="r">' + (x[9] ? esc(x[9]) : numG(x[4])) + '</td><td class="r">' + rm(x[5]) + '</td>'
|
||||
+ '<td class="r">' + rm(x[6]) + '</td><td></td><td></td></tr>';
|
||||
});
|
||||
};
|
||||
@@ -1426,20 +1495,41 @@ function rawUw(tab, rows) {
|
||||
尾列税率);鼠标离开浮层即消失;视口下方放不下自动翻转(浮层左下角贴按钮右下角)。
|
||||
取数沿旧「子目工料机」同路:RVO.normApi(nid)(工作台会话库 / 后台批次库各自解析)。
|
||||
旧底板(#rawnp 面板 + 上下分隔条)已整块拆除(公共功能5),接口路由保留由本浮层继续用。 */
|
||||
let HAO_POP = null; // 浮层单例:同一时刻只弹一个
|
||||
let HAO_POP = null, HAO_BTN = null; // 浮层单例 + 它的锚点按钮(钉住时滚动跟随用)
|
||||
function haoBtn(nid) { // 序号格里的圆形「耗」按钮(无 id 的定额行退回 —)
|
||||
return nid ? '<span class="haobtn" title="查看本定额的工料机" onclick="haoPop(this,' + nid + ')">耗</span>' : '—';
|
||||
}
|
||||
function haoPopClose() {
|
||||
if (!HAO_POP) return;
|
||||
HAO_POP.remove(); HAO_POP = null;
|
||||
HAO_POP.remove(); HAO_POP = null; HAO_BTN = null;
|
||||
window.removeEventListener('scroll', haoPopAway, true);
|
||||
window.removeEventListener('resize', haoPopAway);
|
||||
document.removeEventListener('mousedown', haoOutside, true);
|
||||
}
|
||||
/* 滚动/改尺寸时浮层(fixed 挂 body)会跟按钮脱钩 → 收掉;浮层自己内部的滚动也会进 capture,
|
||||
按 target 判掉不算 */
|
||||
/* 钉住时:点浮层外面关闭。未钉住时不参与——规格原文的唯一关闭路径是鼠标离开浮层,
|
||||
点别处(选行、拖列等)不该误关 */
|
||||
function haoOutside(e) {
|
||||
if (HAO_POP && HAO_POP.dataset.pinned === '1' && !HAO_POP.contains(e.target)) haoPopClose();
|
||||
}
|
||||
/* 滚动/改尺寸时浮层(fixed 挂 body)会跟按钮脱钩:未钉住 → 收掉;钉住 → 重新贴到按钮上跟随。
|
||||
浮层自己内部的滚动也会进 capture,按 target 判掉不算;按钮已被删(重画)则只能收。 */
|
||||
function haoPopAway(e) {
|
||||
if (HAO_POP && !(e && e.target && HAO_POP.contains(e.target))) haoPopClose();
|
||||
if (!HAO_POP) return;
|
||||
if (e && e.target && HAO_POP.contains(e.target)) return;
|
||||
if (HAO_POP.dataset.pinned === '1') {
|
||||
if (HAO_BTN && HAO_BTN.isConnected) { haoPlace(HAO_POP, HAO_BTN); return; }
|
||||
haoPopClose(); return;
|
||||
}
|
||||
haoPopClose();
|
||||
}
|
||||
/* 钉住切换(规格外主人加项,2026-10-17 批):钉住=鼠标离开不关,点空白/再点取消;
|
||||
未钉住=规格原文「鼠标离开弹框区域自动消失」 */
|
||||
function haoPin(el) {
|
||||
if (!HAO_POP) return;
|
||||
const on = HAO_POP.dataset.pinned !== '1';
|
||||
HAO_POP.dataset.pinned = on ? '1' : '0';
|
||||
el.classList.toggle('on', on);
|
||||
el.title = on ? '已钉住:鼠标离开不关闭(点空白处或再点取消)' : '钉住:鼠标离开不关闭(点空白处关闭)';
|
||||
}
|
||||
/* 按按钮右下角定位:默认浮层左上角贴按钮右下角;下方放不下翻转成浮层左下角贴按钮右下角;
|
||||
右边溢出则整体收进视口。数据到货后尺寸会变,须再 place 一次。 */
|
||||
@@ -1458,15 +1548,32 @@ function haoPop(btn, nid) {
|
||||
haoPopClose();
|
||||
const pop = document.createElement('div');
|
||||
pop.className = 'haopop'; pop.dataset.nid = String(nid);
|
||||
pop.innerHTML = '<table><thead><tr><th>序号</th><th>编码</th><th>名称</th><th>规格</th><th>单位</th>'
|
||||
+ '<th>含量</th><th>除税价</th><th>税率</th><th>含税价</th></tr></thead>'
|
||||
// 规格 公共功能4:字段支持左右拉伸——colgroup(px) + th.rs 手柄,主表拖列的 document 级委托
|
||||
// 直接接管(拖动只改被拖列宽 + 浮层总宽跟着变,其他列不动);列宽记忆沿用 colw 体系。
|
||||
// 📌 钉住(主人 2026-10-17 批):默认仍鼠标离开即灭;钉住后离开不关,点空白关闭,滚动时跟随按钮。
|
||||
pop.innerHTML = '<div class="haobar"><span class="ht">工料机</span>'
|
||||
+ '<span class="pin" title="钉住:鼠标离开不关闭(点空白处关闭)" onclick="haoPin(this)">📌</span></div>'
|
||||
+ '<table><colgroup>'
|
||||
+ '<col style="width:44px"><col style="width:96px"><col style="width:170px"><col style="width:120px">'
|
||||
+ '<col style="width:52px"><col style="width:64px"><col style="width:72px"><col style="width:52px">'
|
||||
+ '<col style="width:72px"></colgroup>'
|
||||
+ '<thead><tr><th>序号<span class="rs"></span></th><th>编码<span class="rs"></span></th>'
|
||||
+ '<th>名称<span class="rs"></span></th><th>规格<span class="rs"></span></th><th>单位<span class="rs"></span></th>'
|
||||
+ '<th>含量<span class="rs"></span></th><th>除税价<span class="rs"></span></th><th>税率<span class="rs"></span></th>'
|
||||
+ '<th>含税价<span class="rs"></span></th></tr></thead>'
|
||||
+ '<tbody><tr><td colspan="9" class="empty">正在读取…</td></tr></tbody></table>';
|
||||
document.body.appendChild(pop);
|
||||
HAO_POP = pop;
|
||||
HAO_POP = pop; HAO_BTN = btn;
|
||||
haoPlace(pop, btn);
|
||||
pop.addEventListener('mouseleave', haoPopClose); // 鼠标离开浮层区域自动消失(规格原文)
|
||||
colwApply(pop.querySelector('table')); // 套用上次的列宽记忆(没有=当前即默认,顺手存档)
|
||||
sumw(pop.querySelector('table')); // 表宽=列宽和,拖动时总宽跟着走
|
||||
pop.addEventListener('mouseleave', () => { // 鼠标离开浮层区域自动消失(规格原文);钉住时不关
|
||||
if (!HAO_POP || HAO_POP.dataset.pinned === '1') return;
|
||||
haoPopClose();
|
||||
});
|
||||
window.addEventListener('scroll', haoPopAway, true);
|
||||
window.addEventListener('resize', haoPopAway);
|
||||
document.addEventListener('mousedown', haoOutside, true);
|
||||
const base = (typeof RVO.normApi === 'function') ? RVO.normApi(nid) : (RVO.normApi + nid + '/res');
|
||||
fetch(base).then(r => r.json()).then(d => {
|
||||
if (HAO_POP !== pop) return; // 浮层已被收掉(再点/滚屏/换工程),丢弃迟到响应
|
||||
@@ -1475,6 +1582,8 @@ function haoPop(btn, nid) {
|
||||
// 8有下一级 9税率(公共功能4 新增;无 = —)
|
||||
pop.querySelector('tbody').innerHTML = rows.length ? rows.map(haoRow).join('')
|
||||
: '<tr><td colspan="9" class="empty">这条定额下没有工料机</td></tr>';
|
||||
colwApply(pop.querySelector('table'));
|
||||
sumw(pop.querySelector('table'));
|
||||
haoPlace(pop, btn);
|
||||
}).catch(() => {
|
||||
if (HAO_POP !== pop) return;
|
||||
@@ -1717,6 +1826,8 @@ function comboAttach(sel){
|
||||
const openPanel = () => {
|
||||
comboCloseAllPanels(panel); // 同屏只开一个(含自由输入弹层)
|
||||
const r = inp.getBoundingClientRect();
|
||||
if (!r.width) { closePanel(); return; } // 规格 2026-10-17 打开工程BUG2:框还藏着(宽0)时
|
||||
// 别定位——否则面板弹到屏幕左上角
|
||||
panel.style.left = Math.max(6, Math.min(r.left, window.innerWidth - 320)) + 'px';
|
||||
panel.style.top = (r.bottom + 4) + 'px';
|
||||
panel.style.minWidth = r.width + 'px';
|
||||
@@ -1823,6 +1934,8 @@ function comboFree(inp, getOptions, onChange){
|
||||
'<div class="combo-it' + (i === hit ? ' on' : '') + '" data-i="' + i + '">' + esc(o) + '</div>').join('')
|
||||
|| '<div class="combo-none">没有匹配项(可直接使用输入的内容)</div>';
|
||||
const r = inp.getBoundingClientRect();
|
||||
if (!r.width) { closePanel(); return; } // 规格 2026-10-17 打开工程BUG2:框还藏着(宽0)时
|
||||
// 别定位——否则面板弹到屏幕左上角
|
||||
panel.style.left = Math.max(6, Math.min(r.left, window.innerWidth - 320)) + 'px';
|
||||
panel.style.top = (r.bottom + 4) + 'px';
|
||||
panel.style.minWidth = r.width + 'px';
|
||||
@@ -2077,6 +2190,16 @@ async function uploadFile(url, f) {
|
||||
|
||||
async function saveAs(url, name) {
|
||||
const nm = name || '下载文件';
|
||||
// 决策 91(主人定「全部是另存为」):壳内(pywebview)优先原生另存为对话框——
|
||||
// Python 拉取下载内容弹系统保存框写盘;WebView2 里 JS 的 showSaveFilePicker 不可靠。
|
||||
if (window.pywebview && window.pywebview.api && typeof window.pywebview.api.download_save_as === 'function') {
|
||||
try {
|
||||
const r = await window.pywebview.api.download_save_as(url, nm);
|
||||
if (r && r.ok) { dlMsg('已另存为:' + r.path, 'ok'); return false; }
|
||||
if (r && r.cancel) { dlMsg('已取消保存', 'warn'); return false; }
|
||||
if (r && r.msg) { dlMsg('另存为失败:' + r.msg, 'err'); return false; }
|
||||
} catch (e) { /* 桥没接上(老壳/浏览器)→ 走下面的浏览器分支 */ }
|
||||
}
|
||||
try {
|
||||
if (window.showSaveFilePicker) {
|
||||
const fh = await window.showSaveFilePicker({ suggestedName: nm });
|
||||
@@ -2176,10 +2299,11 @@ function licMount(sel) {
|
||||
warn.id = 'licWarn'; warn.className = 'btn lic-warn';
|
||||
warn.style.display = 'none'; warn.onclick = licDlg; warn.title = '点击查看授权详情';
|
||||
const btn = document.createElement('button');
|
||||
btn.className = 'btn'; btn.textContent = '⚙ 设置';
|
||||
btn.className = 'btn'; btn.textContent = '设置'; btn.setAttribute('data-i18n','btn.settings');
|
||||
btn.title = '授权状态 / 激活 / 续费提示(后续设置项统一收这里)';
|
||||
btn.onclick = licDlg;
|
||||
host.appendChild(warn); host.appendChild(btn);
|
||||
if (typeof wbApplyLang === 'function') wbApplyLang(); // 晚于首轮回填注入,补一次语言套用
|
||||
licBannerTick();
|
||||
setInterval(licBannerTick, 10 * 60 * 1000);
|
||||
}
|
||||
@@ -2190,7 +2314,7 @@ function licBannerTick() {
|
||||
const d = j.data || {};
|
||||
let show = false, txt = '';
|
||||
if (d.enforce && d.can_run) {
|
||||
if (d.days_left != null && d.days_left <= 14) {
|
||||
if (d.days_left != null && d.days_left <= 30) { // 规格 2026-10-17 工具栏4:仅剩 ≤30 天才显示(原 14)
|
||||
show = true;
|
||||
txt = d.days_left <= 0 ? '⚠ 授权即将到期,请立即续费'
|
||||
: '⚠ 授权剩 ' + d.days_left + ' 天,请及时续费';
|
||||
@@ -2204,6 +2328,12 @@ function licBannerTick() {
|
||||
}
|
||||
function licDlg() {
|
||||
licEnsureStyle();
|
||||
// 规格 2026-10-17「重启后永远最新」:弹框里亮出程序代码更新时间与服务启动时间——
|
||||
// 主人不用再猜现在跑的是不是最新程序(旧实例被启动器自动升级重启,见 shell.py)。
|
||||
fetch('/api/version').then(r => r.json()).then(v => {
|
||||
const el = document.getElementById('licVer');
|
||||
if (el && v && v.ok) el.textContent = '程序代码更新:' + v.code_mtime + ' | 服务启动:' + (v.started_at || '—') + '(端口 ' + v.port + ')';
|
||||
}).catch(() => {});
|
||||
let mask = document.getElementById('licMask');
|
||||
if (!mask) {
|
||||
mask = document.createElement('div');
|
||||
@@ -2213,6 +2343,7 @@ function licDlg() {
|
||||
'<a class="close" onclick="licClose()">×</a></div>' +
|
||||
'<div class="db lic-bd">' +
|
||||
'<div id="licSt" class="lic-st">加载中…</div>' +
|
||||
'<div class="lic-row" id="licVer" style="color:#8a97a5;font-size:12px">程序版本:读取中…</div>' +
|
||||
'<div class="lic-btns">' +
|
||||
'<button class="btn" id="licRf" onclick="licRefresh()">立即刷新授权(联网续租)</button>' +
|
||||
'<button class="btn" id="licFb" onclick="licToggleForm()">重新激活 / 更换凭据</button>' +
|
||||
@@ -2519,3 +2650,109 @@ 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 → 稳定键基(服务端下发)
|
||||
const EH_FIELDS_BILL = { Name: 5, Attr: 6, Unit: 7, Quantity: 8, src_remark: 12 };
|
||||
const EH_FIELDS_NORM = { Name: 5, Quantity: 8 };
|
||||
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 => {
|
||||
(EH_LOG[r.k] = EH_LOG[r.k] || []).push({ at: r.at, o: r.o, n: r.n });
|
||||
});
|
||||
} catch (e) { EH_LOG = EH_LOG || {}; EH_M = EH_M || {}; }
|
||||
}
|
||||
function markGroupEH(tbId) {
|
||||
const tb = document.getElementById(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, fields, rid) => {
|
||||
const base = EH_M[String(rid)]; // 稳定键基(重解析不丢,服务端下发)
|
||||
if (!base) return;
|
||||
for (const f in fields) {
|
||||
const k = base + ':' + f;
|
||||
if (EH_LOG[k] && EH_LOG[k].length) {
|
||||
const td = tr.children[fields[f]];
|
||||
if (td) { td.classList.add('eh'); td.dataset.ehk = k; }
|
||||
}
|
||||
}
|
||||
};
|
||||
tb.querySelectorAll('tr[data-bid]').forEach(tr => mark(tr, EH_FIELDS_BILL, tr.dataset.bid));
|
||||
tb.querySelectorAll('tr.sub[data-nid]').forEach(tr => mark(tr, EH_FIELDS_NORM, tr.dataset.nid));
|
||||
}
|
||||
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';
|
||||
pop.innerHTML = '<div class="eh-hd">编辑历史</div><table>'
|
||||
+ list.map((r, i) => '<tr><td class="n">' + (i + 1) + '</td><td class="at">' + esc(r.at || '')
|
||||
+ '</td><td class="c">' + esc((r.o ? r.o + ' → ' : '') + (r.n == null ? '' : r.n))
|
||||
+ '</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-17 工具栏2:最左 简体/繁体/English)----
|
||||
本次只翻工具栏自身(顶栏按钮 / 四个标签 / ⟳ 行),其余界面文案不搬不翻。
|
||||
简体=键省略(HTML 静态文案即简体);偏好存 localStorage.wb_lang。 */
|
||||
const WB_I18N = {
|
||||
'zh-CN': {
|
||||
'tab.p3': '原数据', 'tab.p2': '类似清单', 'tab.p1': '组价不一致清单', 'tab.p0': '项目工料机',
|
||||
'btn.cfg': '分组&过滤', 'btn.admin': '后台管理', 'btn.export': '导出', 'btn.inq': '询价附件',
|
||||
'btn.recent': '最近审核', 'btn.open': '打开项目', 'btn.settings': '设置',
|
||||
'lv.group': '分组', 'lv.bill': '清单', 'lv.det': '定额', 'lv.defw': '默认列宽', 'lk.reload': '⟳ 重载'
|
||||
},
|
||||
'zh-TW': {
|
||||
'tab.p3': '原數據', 'tab.p2': '類似清單', 'tab.p1': '組價不一致清單', 'tab.p0': '項目工料機',
|
||||
'btn.cfg': '分組&過濾', 'btn.admin': '後台管理', 'btn.export': '導出', 'btn.inq': '詢價附件',
|
||||
'btn.recent': '最近審核', 'btn.open': '打開項目', 'btn.settings': '設置',
|
||||
'lv.group': '分組', 'lv.bill': '清單', 'lv.det': '定額', 'lv.defw': '默認列寬', 'lk.reload': '⟳ 重載'
|
||||
},
|
||||
'en': {
|
||||
'tab.p3': 'Raw Data', 'tab.p2': 'Similar Bills', 'tab.p1': 'Price Mismatch', 'tab.p0': 'L&M Summary',
|
||||
'btn.cfg': 'Group&Filter', 'btn.admin': 'Admin', 'btn.export': 'Export', 'btn.inq': 'Inquiry Files',
|
||||
'btn.recent': 'Recent', 'btn.open': 'Open Project', 'btn.settings': 'Settings',
|
||||
'lv.group': 'Group', 'lv.bill': 'Bill', 'lv.det': 'Norm', 'lv.defw': 'Default Width', 'lk.reload': '⟳ Reload'
|
||||
}
|
||||
};
|
||||
function wbLang() {
|
||||
try { return localStorage.getItem('wb_lang') || 'zh-CN'; } catch (e) { return 'zh-CN'; }
|
||||
}
|
||||
function wbApplyLang() {
|
||||
const lang = wbLang(), d = WB_I18N[lang] || {};
|
||||
document.documentElement.lang = lang;
|
||||
document.querySelectorAll('[data-i18n]').forEach(el => {
|
||||
const k = el.getAttribute('data-i18n');
|
||||
if (d[k] == null) return;
|
||||
if (el.classList.contains('tab') && el.firstChild && el.firstChild.nodeType === 3) {
|
||||
el.firstChild.nodeValue = d[k]; // 标签首个文本节点换词,条数徽标保留
|
||||
} else {
|
||||
el.textContent = d[k];
|
||||
}
|
||||
});
|
||||
document.querySelectorAll('#langseg button').forEach(b => b.classList.toggle('on', b.getAttribute('data-lang') === lang));
|
||||
}
|
||||
(function () {
|
||||
const seg = document.getElementById('langseg');
|
||||
if (!seg) return; // 语言条是工作台工具栏专属(规格:工作台·工具栏)
|
||||
seg.querySelectorAll('button').forEach(b => b.addEventListener('click', () => {
|
||||
try { localStorage.setItem('wb_lang', b.getAttribute('data-lang')); } catch (e) {}
|
||||
wbApplyLang();
|
||||
}));
|
||||
wbApplyLang();
|
||||
})();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>造价审核 · 最近审核</title>
|
||||
<title>最近审核</title>
|
||||
<style>
|
||||
:root{--c1:#123a6b;--c2:#1f5fae;--line:#c9d4e2;--head:#eef3fa;--bg:#f5f7fa;--txt:#1c2733;--muted:#5a6b7f}
|
||||
*{box-sizing:border-box}
|
||||
@@ -108,17 +108,21 @@ 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, 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]=序号占位
|
||||
x.n_remark, x.at||'', (x.all||[]).map(a=>a.id), x.src_name,
|
||||
x.can_reparse === false]); /* [13] 源文件缺失(决策 94:删了要看得见) */ // [1]=序号占位
|
||||
const view=sortRows(rows, ST.k, ST.dir, SES_NUM);
|
||||
view.forEach((r,i)=>{ r[1]=view.length-i; }); /* 序号倒序编号(与后台入库项目一致:第一行=总数,往下递减);默认序=打开时间越新越靠前(服务端 id 倒序=打开时间倒序,同名工程后端只留最近一次,2026-10-07 主人定) */
|
||||
let h='';
|
||||
view.forEach(r=>{
|
||||
const srcCell = r[13]
|
||||
? esc(r[4]) + ' <span style="color:#c0392b;font-weight:600;white-space:nowrap" title="原文件已不在软件里:该工程无法导出、无法重新解析(已解析的数据仍可查看)。删除会话不受影响">源文件缺失</span>'
|
||||
: esc(r[4]);
|
||||
h+=`<tr>
|
||||
<td class="c"><input type="checkbox" class="f-sel" value="${r[0]}" onchange="updDel()"></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="l name" title="${esc(r[12])}">${srcCell}</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>
|
||||
|
||||
@@ -6,10 +6,19 @@
|
||||
<style>
|
||||
:root{--c1:#123a6b;--c2:#1f5fae;--line:#e2e8f0;--head:#f6f9fd;--muted:#7b8794}
|
||||
*{box-sizing:border-box}
|
||||
body{margin:0;font:13px/1.5 -apple-system,"Segoe UI","Microsoft YaHei",sans-serif;color:#1f2937;background:#f5f6f8;height:100vh;display:flex;flex-direction:column}
|
||||
.btn{padding:5px 12px;border:1px solid #b8c4d4;border-radius:6px;background:#fff;cursor:pointer;font:inherit;font-size:12.5px;color:#26405e;text-decoration:none;display:inline-block}
|
||||
.btn:hover{background:#f2f6fb}
|
||||
body{margin:0;font:13px/1.5 "Source Han Sans SC","Noto Sans SC","Source Han Sans CN","MiSans","HarmonyOS Sans SC","Microsoft YaHei",sans-serif;color:#1f2937;background:#f5f6f8;height:100vh;display:flex;flex-direction:column}
|
||||
.btn{display:inline-flex;align-items:center;justify-content:center;gap:4px;height:28px;padding:0 12px;border:1px solid #b8c4d4;border-radius:6px;background:#fff;cursor:pointer;font:inherit;font-size:12.5px;color:#26405e;text-decoration:none;line-height:1;white-space:nowrap;vertical-align:middle;user-select:none}
|
||||
.btn:hover{background:#eef3fa}
|
||||
.btn:active{background:#e0effc}
|
||||
.btn.pri{background:var(--c2);border-color:var(--c2);color:#fff;font-weight:600}
|
||||
.tabs .btn{height:24px;padding:0 9px;font-size:12px;border-radius:5px}
|
||||
/* 语言段(规格2:最左 简体/繁体/English);工作态蓝底(规格5) */
|
||||
.langseg{display:inline-flex}
|
||||
.langseg button{height:24px;padding:0 9px;font-size:12px;border:1px solid #b8c4d4;border-right-width:0;background:#fff;color:#26405e;cursor:pointer;font-family:inherit;line-height:1;user-select:none}
|
||||
.langseg button:first-child{border-radius:5px 0 0 5px}
|
||||
.langseg button:last-child{border-right-width:1px;border-radius:0 5px 5px 0}
|
||||
.langseg button:hover{background:#eef3fa}
|
||||
.langseg button.on{background:var(--c2);border-color:var(--c2);color:#fff;font-weight:600}
|
||||
/* ---- 标签栏(2026-09-29:原 A 区顶栏删除,两个按钮移到这里右侧,工程信息放中间;高度调低)---- */
|
||||
.tabs{display:flex;align-items:center;gap:2px;padding:0 16px;background:#fff;border-bottom:2px solid var(--c1);min-height:34px}
|
||||
.tab{padding:4px 14px;cursor:pointer;color:#456;font-size:13px;border-bottom:2px solid transparent;margin-bottom:-2px;line-height:1.35}
|
||||
@@ -27,6 +36,8 @@ body{margin:0;font:13px/1.5 -apple-system,"Segoe UI","Microsoft YaHei",sans-seri
|
||||
#pan3{overflow:hidden}
|
||||
table{width:100%;border-collapse:collapse;font-size:12.5px;table-layout:fixed}
|
||||
th{position:sticky;top:0;background:var(--head);color:var(--c1);font-weight:600;padding:6px 8px;border-bottom:1px solid var(--line);border-right:1px solid #eef1f6;white-space:nowrap;z-index:2}
|
||||
/* 规格 2026-10-17 ⑪:组表下拉时 ⟳ 工具行(sticky top:0)与表头都固定 */
|
||||
#t1 thead th,#t2 thead th{top:34px}
|
||||
td{padding:5px 8px;border-bottom:1px solid #eef1f6;border-right:1px solid #f4f6f9;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
/* 来源徽章(2026-10-08 主人定,仅项目工料机对比框):工程绿 / 信息价蓝 / 市场价橙 */
|
||||
.srcbadge{display:inline-block;padding:1px 7px;border-radius:9px;font-size:11px;line-height:16px;white-space:nowrap}
|
||||
@@ -36,7 +47,7 @@ td{padding:5px 8px;border-bottom:1px solid #eef1f6;border-right:1px solid #f4f6f
|
||||
/* 规格型号灰字(结果表名称列第二行,工料机比价的关键区分项) */
|
||||
.spec2{display:block;color:#8a97a8;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
||||
tbody tr:hover td{background:#f6f9fd}
|
||||
tr.sel td{background:#e0effc} /* 选中行=淡蓝无边框(2026-10-11 主人定,全软件统一;common.css 有同款全局规则) */
|
||||
tr.sel td, tr.subsel td{background:#d8e9fc} /* 选中行=淡蓝(规格 2026-10-16③:点选格 .cellhit=#a8e3d2、整行绿框,统一样式在 common.css) */
|
||||
.c{text-align:center}.r{text-align:right}.num{text-align:right;font-variant-numeric:tabular-nums}
|
||||
/* 项目特征:原文里一个换行符都没有(实测 0 条),全靠 (1) / 1、 / 1. 这种编号写法,
|
||||
pre-wrap 只对「已存在的 \n」生效 —— 所以必须由 fmtAttr() 先按编号拆行,这里再负责折行与顶对齐 */
|
||||
@@ -273,7 +284,7 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
.inqfoot{display:flex;align-items:center;justify-content:space-between;gap:10px}
|
||||
.inqfoot .cnt{font-size:12px;color:#5a6b7e}
|
||||
</style>
|
||||
<link rel="stylesheet" href="common.css">
|
||||
<link rel="stylesheet" href="common.css?v=20261017c">
|
||||
</head>
|
||||
<body data-page-node-id="ACmQmECh3NUWp5TCbBL7BM">
|
||||
|
||||
@@ -287,16 +298,25 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
<div class="tabright" data-page-node-id="sOfM468xWOKqTjwNbIVMFC">
|
||||
<!-- 2026-10-10 主人定:右上按钮一字排开,从左到右 =
|
||||
分组/匹配 → 后台管理 → 询价附件 → 最近审核 → 打开项目。 -->
|
||||
<button class="btn" onclick="cfgOpen()" title="类似清单分组 / 历史匹配过滤词">⚙ 分组&过滤</button>
|
||||
<!-- 语言条(规格 工具栏2:最左 简体/繁体/English;工作态蓝底) -->
|
||||
<div class="langseg" id="langseg" title="语言 / Language">
|
||||
<button type="button" data-lang="zh-CN" class="on">简体</button>
|
||||
<button type="button" data-lang="zh-TW">繁体</button>
|
||||
<button type="button" data-lang="en">English</button>
|
||||
</div>
|
||||
<button class="btn" onclick="cfgOpen()" title="类似清单分组 / 历史匹配过滤词" data-i18n="btn.cfg">分组&过滤</button>
|
||||
<!-- 时间戳参数:老 WebView2 对 no-store 不完全遵守,跨页跳转带新 URL 强制绕缓存(2026-10-12) -->
|
||||
<a class="btn" href="javascript:location.href='/admin.html?v='+Date.now()" data-page-node-id="soJGFd2PWIpS6Hbp6B2s0w">后台管理</a>
|
||||
<a class="btn" href="javascript:location.href='/admin.html?v='+Date.now()" data-page-node-id="soJGFd2PWIpS6Hbp6B2s0w" data-i18n="btn.admin">后台管理</a>
|
||||
<!-- 询价附件(2026-10-09 改版;2026-10-10 决策 28 改会话级 主人定):**常驻按钮**。
|
||||
数据 = 当前会话在对比框点「采纳」收进来的附件(按内容去重;切会话跟着切,删会话才清,
|
||||
没打开项目=空),不再是后台绑定关系的只读展示。 -->
|
||||
<!-- 导出(规格 工料机汇总13:上升一级放询价附件左边,只能导工作台数据;蓝底主按钮) -->
|
||||
<button class="btn pri" onclick="exportSession()" data-i18n="btn.export"
|
||||
title="按原格式导出本工程(含全部编辑:临删已省略、新增/采纳已写入)。只能对工作台的数据进行导出">导出</button>
|
||||
<button class="btn" id="btnInq" onclick="openInq()"
|
||||
title="当前会话收进的附件目录(切会话跟着切,删会话才清);勾选后可批量下载">询价附件</button>
|
||||
<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>
|
||||
title="当前会话收进的附件目录(切会话跟着切,删会话才清);勾选后可批量下载" data-i18n="btn.inq">询价附件</button>
|
||||
<a class="btn" href="javascript:location.href='/sessions.html?t='+Date.now()" data-i18n="btn.recent">最近审核</a>
|
||||
<button class="btn" onclick="openDlg()" data-page-node-id="rlEedAWfYgLJDVpuFxmmxq" data-i18n="btn.open">打开项目</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -319,7 +339,7 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
<div class="grpsplit" id="grpsplit1"><span class="gsplitbtn" title="收起/展开目录树">◀</span></div>
|
||||
<div class="grpmain">
|
||||
<div style="display:flex;align-items:center;gap:10px;padding:5px 10px;border-bottom:1px solid var(--line);background:#fafcff;position:sticky;top:0;z-index:5;height:34px;box-sizing:border-box">
|
||||
<a class="lk" onclick="reloadIncon()" title="按当前工程数据与规则重算组价不一致">⟳ 重载</a>
|
||||
<a class="lk" onclick="reloadIncon()" title="按当前工程数据与规则重算组价不一致" data-i18n="lk.reload">⟳ 重载</a>
|
||||
<span class="rawLvMount" style="margin-left:auto;display:inline-flex;gap:4px;align-items:center"></span>
|
||||
</div>
|
||||
<table id="t1" data-page-node-id="uDB6bv40IJMHhH2Ykznir2"><colgroup id="cg1" data-page-node-id="3VeUjy8WVpqGteUh9Wnadz"></colgroup><thead id="th1" data-page-node-id="DQAXEDDJ0ZCOU6Qq6JMzOV"></thead><tbody id="tb1" data-page-node-id="a5ErEx7b9uetj4GY0v9rZu"></tbody></table></div>
|
||||
@@ -334,7 +354,7 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
<div class="grpmain">
|
||||
<!-- ⟳ 重载(2026-10-13 决策 46 主人定):分组结果服务端有缓存,重载=跳过缓存按当前数据与规则重算 -->
|
||||
<div style="display:flex;align-items:center;gap:10px;padding:5px 10px;border-bottom:1px solid var(--line);background:#fafcff;position:sticky;top:0;z-index:5;height:34px;box-sizing:border-box">
|
||||
<a class="lk" onclick="reloadSim()" title="不用缓存,按当前工程数据与分组规则重新分组(工程大要稍等)">⟳ 重载</a>
|
||||
<a class="lk" onclick="reloadSim()" title="不用缓存,按当前工程数据与分组规则重新分组(工程大要稍等)" data-i18n="lk.reload">⟳ 重载</a>
|
||||
<!-- 原数据单位工程级的层级按钮挂点(2026-10-13 决策 58:分组/清单/定额/默认列宽 迁到这里最右) -->
|
||||
<span id="rawLvMount" class="rawLvMount" style="margin-left:auto;display:inline-flex;gap:4px;align-items:center"></span>
|
||||
</div>
|
||||
@@ -487,6 +507,25 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 导出进度模态(决策 92,主人定流程):先另存为选路径 → 这里显示进度(生成逐条目% + 写盘%),
|
||||
期间模态阻塞不可做其他操作;唯一出口=「后台导出」→ 收起模态回软件继续干活,后台完成后右下角提醒。 -->
|
||||
<div class="mask" id="expmask">
|
||||
<div class="dlg" style="width:480px;max-width:92vw">
|
||||
<h4>正在按原格式导出</h4>
|
||||
<div class="mbody">
|
||||
<div id="expname" style="font-weight:600;color:#243b53;word-break:break-all"></div>
|
||||
<div style="height:10px;background:#e6ecf4;border-radius:5px;overflow:hidden;margin:14px 0 8px">
|
||||
<div id="expbar" style="height:100%;width:0;background:#1f66d1;transition:width .25s"></div>
|
||||
</div>
|
||||
<div id="expstage" style="color:#5b6b80;font-size:12px;min-height:16px">准备中…</div>
|
||||
</div>
|
||||
<div class="mfoot" style="display:flex;justify-content:space-between;align-items:center">
|
||||
<span style="color:#8a97a8;font-size:12px">导出完成前软件暂不可操作</span>
|
||||
<button class="btn" onclick="exportToBackground()">后台导出</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ================= 询价附件(2026-10-09 改版)==================
|
||||
数据 = 对比框里**工料机行**点「采纳」时该行跟随的附件(工程行=绑定的询价资料,
|
||||
价格行=刊物原件),全局收集、按内容去重。不是后台绑定关系的只读展示。
|
||||
@@ -520,7 +559,7 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="common.js?v=20261016a"></script>
|
||||
<script src="common.js?v=20261017h"></script>
|
||||
<script src="period.js"></script>
|
||||
<script>
|
||||
let SID=0, CUR=null, CURTYPE='lme', HROWS=[];
|
||||
@@ -688,8 +727,8 @@ async function billCtxApply(t, bid){
|
||||
Object.keys(RV_CACHE).forEach(k=>{ if(String(k).indexOf(SID+'|')===0) delete RV_CACHE[k]; });
|
||||
const cur = document.querySelector('.tab.on');
|
||||
const p = cur ? cur.dataset.p : 'p3';
|
||||
if(p==='p1') await loadGroups('inconsistent');
|
||||
else if(p==='p2') await loadGroups('similar');
|
||||
if(p==='p1') await loadGroups('inconsistent',false,true);
|
||||
else if(p==='p2') await loadGroups('similar',false,true);
|
||||
else await refreshRaw();
|
||||
}
|
||||
/* 共享层规格⑥(决策 71):原数据·分部分项/措施项目 选中清单行 → 底部历史对比框加载该行比对 */
|
||||
@@ -701,11 +740,97 @@ window.rawBillPick = function(tr){
|
||||
pick('bill', bid, tr);
|
||||
};
|
||||
|
||||
/* 导出回写(批次D,决策 70):按原格式下载本工程(全部编辑已体现为文件内容) */
|
||||
function exportSession(){
|
||||
/* 导出回写(批次D,决策 70):按原格式导出本工程(全部编辑已体现为文件内容)。
|
||||
决策 91:另存为样式;决策 92(主人定流程):壳内点导出=①先弹原生另存为选路径(此刻还没开始
|
||||
生成,大工程不再干等)→②弹进度模态(生成逐条目% + 写盘字节%),期间软件不可操作 →③模态上
|
||||
「后台导出」是唯一出口=收起回软件继续干活,后台完成后右下角提醒。普通浏览器仍走 FSA 另存为。 */
|
||||
let EXP_BG = false; // 是否已「后台导出」(后台完成只提醒,不弹回界面)
|
||||
function exportModalShow(name){
|
||||
EXP_BG = false;
|
||||
$('expname').textContent = name || '';
|
||||
expSet(0, '已选保存位置,开始生成…');
|
||||
$('expmask').classList.add('on');
|
||||
}
|
||||
function expSet(pct, stage){
|
||||
$('expbar').style.width = Math.max(0, Math.min(100, pct)) + '%';
|
||||
$('expstage').textContent = stage || '';
|
||||
}
|
||||
function exportToBackground(){
|
||||
EXP_BG = true;
|
||||
$('expmask').classList.remove('on');
|
||||
$('msg').textContent = '导出已转后台,完成后右下角提醒';
|
||||
dlMsg('导出已转后台,完成后会提醒', 'ok');
|
||||
}
|
||||
/* 桥线程推上来的进度(生成 gen / 写盘 put / 完成 done / 失败 done=false) */
|
||||
window.__exportProgress = function(p){
|
||||
if (p && p.phase === 'gen'){
|
||||
if (EXP_BG) return;
|
||||
if (p.total) expSet(p.done / p.total * 90, '正在生成 ' + p.done + ' / ' + p.total + ' 个文件…');
|
||||
else expSet(5, '正在按原格式导出(大工程稍等)…');
|
||||
} else if (p && p.phase === 'put'){
|
||||
if (!EXP_BG) expSet(90 + (p.pct || 0) * 0.1, '正在写入文件…');
|
||||
} else if (p && p.done){
|
||||
$('expmask').classList.remove('on');
|
||||
$('msg').textContent = '已导出:' + (p.name || '');
|
||||
dlMsg('已另存为:' + p.path, 'ok');
|
||||
} else if (p && p.done === false){
|
||||
$('expmask').classList.remove('on');
|
||||
$('msg').textContent = '导出失败:' + (p.msg || '');
|
||||
dlMsg('导出失败:' + (p.msg || ''), 'err');
|
||||
}
|
||||
};
|
||||
async function exportSession(){
|
||||
if(!SID){ $('msg').textContent = '先打开工程再导出'; return; }
|
||||
$('msg').textContent = '正在按原格式导出(大工程稍等,浏览器会下载 zip 同款文件)…';
|
||||
location.href = '/api/session/export?session_id=' + SID;
|
||||
if ($('expmask').classList.contains('on')){ $('msg').textContent = '已有导出进行中(可点「后台导出」转后台)'; return; }
|
||||
$('msg').textContent = '正在按原格式导出(大工程稍等)…';
|
||||
try{
|
||||
const hasBridge = window.pywebview && window.pywebview.api;
|
||||
// ① 新壳(决策 92):先另存为选路径 → 页面进度模态 → 后台生成写盘 → __exportProgress 收尾
|
||||
if (hasBridge && typeof window.pywebview.api.export_save_as === 'function'){
|
||||
const r = await window.pywebview.api.export_save_as(SID, '');
|
||||
if (r && r.cancel){ $('msg').textContent = '已取消导出'; return; }
|
||||
if (r && r.msg){ $('msg').textContent = '导出失败:' + r.msg; return; }
|
||||
if (r && r.started){ exportModalShow(r.name); return; }
|
||||
/* 老壳没有这个方法 → 落到下面的旧桥/浏览器分支 */
|
||||
}
|
||||
// ② 老壳(只有决策 91 的通用下载桥):生成完才弹框,凑合用
|
||||
if (hasBridge && typeof window.pywebview.api.download_save_as === 'function'){
|
||||
const r = await window.pywebview.api.download_save_as('/api/session/export?session_id=' + SID, '');
|
||||
if (r && r.ok){ $('msg').textContent = '已导出:' + (r.name || ''); dlMsg('已另存为:' + r.path, 'ok'); return; }
|
||||
if (r && r.cancel){ $('msg').textContent = '已取消导出'; return; }
|
||||
if (r && r.msg){ $('msg').textContent = '导出失败:' + r.msg; return; }
|
||||
}
|
||||
const resp = await fetch('/api/session/export?session_id=' + SID);
|
||||
if(!resp.ok){ const j = await resp.json().catch(()=>null); throw new Error((j && j.msg) || ('HTTP ' + resp.status)); }
|
||||
const cd = resp.headers.get('Content-Disposition') || '';
|
||||
// 服务端同时发 filename="export.zip"(ASCII 兜底)和 filename*=UTF-8''真名(原工程名-审核版.原后缀)。
|
||||
// 必须**优先吃 filename***——旧正则 filename\*? 先命中兜底名,另存为永远建议 export.zip,
|
||||
// 后缀跟导入对不上(2026-10-17 主人报导出失效的根因)。后缀不写死:今后 excel 等导入啥导出啥。
|
||||
const m = cd.match(/filename\*=(?:UTF-8'')?([^;]+)/i) || cd.match(/filename="?([^";]+)"?/i);
|
||||
let fname = '';
|
||||
try{ fname = decodeURIComponent((m && m[1]) || '').replace(/"/g, '').trim(); }catch(e){}
|
||||
if(!fname){ fname = '工程导出.cos4'; }
|
||||
const blob = await resp.blob();
|
||||
if(window.showSaveFilePicker){
|
||||
try{
|
||||
// File System Access 的 accept 只认小写扩展名(.COS4 这类大写会 TypeError 掉进静默下载)
|
||||
const ext = ((fname.match(/(\.[^.]+)$/) || ['','.cos4'])[1]).toLowerCase();
|
||||
const h = await showSaveFilePicker({suggestedName: fname,
|
||||
types: [{description: '计价文件', accept: {'application/octet-stream': [ext]}}]});
|
||||
const w = await h.createWritable(); await w.write(blob); await w.close();
|
||||
$('msg').textContent = '已导出:' + h.name;
|
||||
dlMsg('导出完成,已存为 ' + h.name, 'ok');
|
||||
return;
|
||||
}catch(e){ if(e && e.name === 'AbortError'){ $('msg').textContent = '已取消导出'; return; } }
|
||||
}
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url; a.download = fname; a.click();
|
||||
setTimeout(()=>URL.revokeObjectURL(url), 5000);
|
||||
$('msg').textContent = '已导出(浏览器下载):' + fname;
|
||||
}catch(e){
|
||||
$('msg').textContent = '导出失败:' + (e.message || e);
|
||||
}
|
||||
}
|
||||
|
||||
/* ==================== 合并工料机(批次C,决策 69;方案 §6)==================== */
|
||||
@@ -757,6 +882,7 @@ function renderMergeTree(){
|
||||
}
|
||||
async function mergeApply(){
|
||||
const groups = [];
|
||||
const emptyGrp = []; // 一行都没勾的组(合并后会整组隐藏——多半是误操作)
|
||||
document.querySelectorAll('#mtree .mgrp').forEach(box => {
|
||||
const keep = [], hide = [];
|
||||
Array.from(box.querySelectorAll('.mrow')).forEach(row => {
|
||||
@@ -767,7 +893,16 @@ async function mergeApply(){
|
||||
else hide.push({ id: id });
|
||||
});
|
||||
groups.push({ keep: keep, hide: hide });
|
||||
if (!keep.length) {
|
||||
const gi = Number(box.dataset.gi), g = (MDATA.groups || [])[gi];
|
||||
emptyGrp.push(g ? (g.name || '—') + ' | ' + (g.spec || '—') + ' | ' + (g.unit || '—') : ('第 ' + (gi + 1) + ' 组'));
|
||||
}
|
||||
});
|
||||
// 空选守卫:一行都没勾就点合并 = 整组隐藏,十有八九是误操作(不静默、不误伤)
|
||||
if (!groups.some(g => g.keep.length)) { dlMsg('请先勾选每组要保留的工料机行,再点合并', 'warn'); return; }
|
||||
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; }
|
||||
@@ -840,6 +975,95 @@ function editCell(td, api, id, field, cur){
|
||||
inp.addEventListener('blur', ()=>fin(true));
|
||||
}
|
||||
|
||||
/* ---- 组表双击改工程量(规格 2026-10-16 工作台·组价不一致清单;类似清单同共享层一并生效)----
|
||||
组表列位:0把手 1序号/耗 2编码 3类别 4单位工程 5名称 6特征 7单位 8工程量 9单价 10合价 11取消采纳 12备注
|
||||
只开放工程量格(idx 8)。清单行(data-bid)只能输入数字;定额子行(data-nid)支持
|
||||
GCL+-*() 连环公式——GCL=清单工程量÷定额单位从左到右数字(到字母截断;纯字母单位=
|
||||
清单工程量),求值在服务端(与 MCP/AI 同一入口),成功后前端按落库值原位回填。
|
||||
原位回填不整页重拉:编辑本身不产生任何跳动。 */
|
||||
document.addEventListener('dblclick', function(e){
|
||||
if(!SID || (typeof WB_OPTS!=='undefined' && WB_OPTS && WB_OPTS.backend)) return;
|
||||
const td = e.target.closest && (e.target.closest('#tb1 td') || e.target.closest('#tb2 td'));
|
||||
if(!td || td.querySelector('input')) return;
|
||||
const tr = td.closest('tr'); if(!tr) return;
|
||||
const idx = Array.prototype.indexOf.call(tr.children, td);
|
||||
if(idx !== 8) return;
|
||||
e.preventDefault();
|
||||
const cur0 = td.textContent.trim();
|
||||
if(tr.classList.contains('sub') && tr.dataset.nid) grpNormQtyEdit(td, tr, cur0);
|
||||
else if(tr.dataset.bid && !tr.classList.contains('grp') && !tr.classList.contains('grp2')) grpBillQtyEdit(td, tr, cur0);
|
||||
});
|
||||
function grpBillQtyEdit(td, tr, cur0){
|
||||
const bid = Number(tr.dataset.bid);
|
||||
const inp = document.createElement('input');
|
||||
inp.className = 'cellin'; inp.value = cur0.replace(/,/g, ''); inp.spellcheck = false;
|
||||
td.textContent = ''; td.appendChild(inp);
|
||||
inp.focus(); inp.select();
|
||||
let done = false;
|
||||
const fin = async save => {
|
||||
if(done) return; done = true;
|
||||
const v = inp.value.trim();
|
||||
if(!save || v === cur0.replace(/,/g, '')){ td.textContent = cur0; return; }
|
||||
if(!/^-?\d+(\.\d+)?$/.test(v)){ $('msg').textContent = '清单工程量只能输入数字'; td.textContent = cur0; return; }
|
||||
const r = await J('/api/session/bill/op',{method:'POST',headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify({session_id:SID, op:'edit', bill_id:bid, fields:{Quantity:v}})});
|
||||
if(!r.ok){ $('msg').textContent = r.msg || '保存失败'; td.textContent = cur0; return; }
|
||||
$('msg').textContent = '已保存';
|
||||
const n = Number(v);
|
||||
td.textContent = num(n, 3);
|
||||
const grow = grpRowById(bid); if(grow) grow[5] = n; // GRP_DATA 留底同步(组内排序/右键按它取数)
|
||||
loadEditLog().then(()=>{ markGroupEH('tb1'); markGroupEH('tb2'); }); // ⑮ 红三角即时点亮
|
||||
};
|
||||
inp.addEventListener('keydown', ev=>{
|
||||
if(ev.key==='Enter'){ ev.preventDefault(); fin(true); }
|
||||
else if(ev.key==='Escape'){ fin(false); }
|
||||
});
|
||||
inp.addEventListener('blur', ()=>fin(true));
|
||||
}
|
||||
function grpNormQtyEdit(td, tr, cur0){
|
||||
const nid = Number(tr.dataset.nid);
|
||||
const inp = document.createElement('input');
|
||||
inp.className = 'cellin'; inp.value = cur0.replace(/,/g, ''); inp.spellcheck = false;
|
||||
inp.title = '可输入数字、数字四则(如 5+9.25+6.36)或带 GCL 的公式(GCL=清单工程量÷定额单位数字,'
|
||||
+ '纯字母单位=清单工程量),如 GCL*(5+9.25+6.36)+GCL;公式按原文保存,导出时按清单工程量求值';
|
||||
td.textContent = ''; td.appendChild(inp);
|
||||
inp.focus(); inp.select();
|
||||
let done = false;
|
||||
const fin = async save => {
|
||||
if(done) return; done = true;
|
||||
const v = inp.value.trim();
|
||||
if(!save || v === cur0.replace(/,/g, '')){ td.textContent = cur0; return; }
|
||||
const r = await J('/api/session/norm/op',{method:'POST',headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify({session_id:SID, norm_id:nid, fields:{Quantity:v}})});
|
||||
if(!r.ok){ $('msg').textContent = r.msg || '保存失败'; td.textContent = cur0; return; }
|
||||
// 决策 90:公式按原文回填(GCL/GCL*0.5…),纯数字回填数字;提示带即时求值结果
|
||||
td.textContent = (r.expr != null && r.expr !== '') ? r.expr : numG(r.quantity);
|
||||
$('msg').textContent = '已保存' + (r.quantity != null ? ':= ' + numG(r.quantity) : '');
|
||||
loadEditLog().then(()=>{ markGroupEH('tb1'); markGroupEH('tb2'); }); // ⑮ 红三角即时点亮
|
||||
};
|
||||
inp.addEventListener('keydown', ev=>{
|
||||
if(ev.key==='Enter'){ ev.preventDefault(); fin(true); }
|
||||
else if(ev.key==='Escape'){ fin(false); }
|
||||
});
|
||||
inp.addEventListener('blur', ()=>fin(true));
|
||||
}
|
||||
|
||||
/* 规格 2026-10-16 ③:定额子行点选=纯视觉选中(.subsel 与清单行 tr.sel 同配色整套)。
|
||||
不动 tr.sel/CUR——比对与采纳的基准仍跟着清单行走(规格⑤:采纳不因展开/子行点选失效)。 */
|
||||
document.addEventListener('click', function(e){
|
||||
if(!SID) return;
|
||||
const tr = e.target.closest && e.target.closest('tr.sub');
|
||||
if(!tr || !tr.dataset.nid) return;
|
||||
document.querySelectorAll('tr.subsel').forEach(x=>x.classList.remove('subsel'));
|
||||
tr.classList.add('subsel');
|
||||
// 规格 2026-10-17 ⑭:一个工作区只保持最后点选的一行——点定额后清单的点选消失
|
||||
//(对比框仍按该清单比对:CUR 不动;采纳改按 CUR 基准,见 adopt 守卫)
|
||||
document.querySelectorAll('tr.sel').forEach(x=>x.classList.remove('sel'));
|
||||
document.querySelectorAll('td.cellhit').forEach(x=>x.classList.remove('cellhit'));
|
||||
const ptd=window.__lastPickedTd;
|
||||
if(ptd && tr.contains(ptd)) ptd.classList.add('cellhit');
|
||||
});
|
||||
|
||||
/* ==================== 工料机汇总 三价行内编辑(2026-10-16 主人口径)====================
|
||||
仅项目级工料机汇总(行带 data-lmeid);单位工程级保持只读。
|
||||
恒满足 除税编制价 × (1 + 税率/100) = 含税编制价,金额四舍五入 2 位,税率空按 0:
|
||||
@@ -920,10 +1144,10 @@ function lmeEditCell(td, tr, field, cur){
|
||||
|
||||
/* ---------- 打开工程 ---------- */
|
||||
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');
|
||||
$('omask').classList.add('on'); // 规格 打开工程BUG2:先显示弹框再清值——此前清值派发的
|
||||
$('ofile').value=''; $('oname').value=''; $('oname').dataset.auto=''; $('omsg').textContent=''; // input
|
||||
$('oper').value=''; $('oprov').value=''; $('ocity').value=''; $('odist').value=''; // 事件在
|
||||
$('obuid').value=''; $('obuid').dispatchEvent(new Event('input', {bubbles:true})); // 隐藏态测量
|
||||
}
|
||||
|
||||
// 选好文件后,工程名称默认 = 文件名(去掉扩展名),可手动改
|
||||
@@ -1085,8 +1309,23 @@ async function loadLme(){
|
||||
const WB_OPTS = { rowClick: 'pick', normApi: '/api/session/bill/'
|
||||
/* 「取消采纳」列已由 common.js 统一渲染(lmeAdoptCellHTML,2026-10-13 收编):
|
||||
有采纳备注的行给链接、其余灰 —,本页提供 cancelAdopt(id) 全局函数供其调用。 */ };
|
||||
async function loadGroups(kind, fresh){
|
||||
async function loadGroups(kind, fresh, keepView){
|
||||
// fresh=true(⟳ 重载按钮,决策 46):服务端跳过缓存强制重算,算完回填缓存
|
||||
// keepView=true(采纳/取消采纳/右键操作后重拉,规格 2026-10-16「点采纳跳至第一组」修复):
|
||||
// 重画前留底 左树选中/展开的组/选中的清单行,重画后原样恢复——视图停在原地,不跳回第 1 组。
|
||||
const treeEl = kind==='inconsistent' ? $('grptree1') : $('grptree');
|
||||
const tbId = kind==='inconsistent' ? 'tb1' : 'tb2';
|
||||
let keep=null;
|
||||
if(keepView){
|
||||
const heads=[...$(tbId).querySelectorAll('tr.grp,tr.grp2')];
|
||||
const on=(treeEl.querySelector('.rn.on')||{}).dataset;
|
||||
keep={ pk:(on&&on.pk)||'all',
|
||||
open:heads.map((tr,i)=>tr.querySelector('.tog').dataset.open==='1'?i:-1).filter(i=>i>=0),
|
||||
normOpen:[...$(tbId).querySelectorAll('tr[data-bid] .tog[data-open="1"]')]
|
||||
.map(t=>t.closest('tr').dataset.bid),
|
||||
sel:$(tbId).querySelector('tr.sel')?.dataset.bid||null,
|
||||
subsel:$(tbId).querySelector('tr.subsel')?.dataset.nid||null }; // 规格⑥:定额选中态也留底
|
||||
}
|
||||
const d=await J(`/api/session/${kind}?session_id=${SID}` + (fresh ? '&fresh=1' : ''));
|
||||
// 徽标口径与左树根一致:含末尾落单组(2026-10-11 主人定);组价不一致没有落单组,extra 恒空、数值不变
|
||||
(kind==='inconsistent'?$('n1'):$('n2')).textContent=d.total+(d.extra||[]).length+' 组';
|
||||
@@ -1100,6 +1339,37 @@ async function loadGroups(kind, fresh){
|
||||
// 点选行为在公共层 grpTreeBind(两侧唯一实现),本页只给树容器和表体 id
|
||||
if(kind==='similar') grpTreeBind($('grptree'), 'tb2', d);
|
||||
else grpTreeBind($('grptree1'), 'tb1', d, { kind: 'inconsistent', rootName: '组价不一致清单' });
|
||||
if(keep){
|
||||
if(keep.pk && keep.pk!=='all'){
|
||||
const node=treeEl.querySelector('.rn[data-pk="'+keep.pk+'"]');
|
||||
if(node) node.click(); // 复原树过滤(单组显示);组没了就落回默认全显
|
||||
}
|
||||
const heads=[...$(tbId).querySelectorAll('tr.grp,tr.grp2')];
|
||||
keep.open.forEach(i=>{ const tr=heads[i];
|
||||
if(tr && tr.querySelector('.tog').dataset.open!=='1') tgGrp(tr.dataset.grp, tr); });
|
||||
// 规格 2026-10-16 ④:固定工作区显示状态——展开着的定额子行也原样展开(重拉接口,即新状态)
|
||||
(keep.normOpen||[]).forEach(bid=>{
|
||||
const tr=$(tbId).querySelector('tr[data-bid="'+bid+'"]');
|
||||
const tg=tr && tr.querySelector('.tog');
|
||||
if(tg && tg.dataset.open!=='1') tg.click();
|
||||
});
|
||||
if(keep.sel && !keep.subsel){ // 规格 ⑭:单选语义——定额是最后点选时不再补清单高亮
|
||||
const srow=$(tbId).querySelector('tr[data-bid="'+keep.sel+'"]');
|
||||
if(srow && srow.style.display!=='none') srow.classList.add('sel'); // 只补选中态,不重发比对请求
|
||||
}
|
||||
// 规格 2026-10-17 ⑥:选中过的定额子行,采纳/操作后仍是选中态。定额子行由 tgNorm
|
||||
// 异步拉取,可能晚于这里——短轮询几拍等它进 DOM。
|
||||
if(keep.subsel){
|
||||
let n=0;
|
||||
const iv=setInterval(()=>{
|
||||
const srow=$(tbId).querySelector('tr.sub[data-nid="'+keep.subsel+'"]');
|
||||
if(srow && srow.style.display!=='none'){ srow.classList.add('subsel'); clearInterval(iv); }
|
||||
else if(++n>12) clearInterval(iv);
|
||||
},150);
|
||||
}
|
||||
}
|
||||
// 规格 2026-10-17 ⑮:编辑历史红三角(取全会话日志 → 本表打标)
|
||||
loadEditLog().then(()=>{ markGroupEH('tb1'); markGroupEH('tb2'); });
|
||||
}
|
||||
|
||||
/* ⟳ 重载(组价不一致,决策 72):与类似清单 reloadSim 同款 */
|
||||
@@ -1119,7 +1389,12 @@ function reloadSim(){
|
||||
async function pick(type,id,tr){
|
||||
const same=tr.classList.contains('sel'); // 重复点同一行≠「换了行」,不清遗留
|
||||
document.querySelectorAll('tr.sel').forEach(x=>x.classList.remove('sel'));
|
||||
document.querySelectorAll('tr.subsel').forEach(x=>x.classList.remove('subsel')); // 换行连带清子行选中
|
||||
document.querySelectorAll('td.cellhit').forEach(x=>x.classList.remove('cellhit'));
|
||||
tr.classList.add('sel');
|
||||
// 规格 2026-10-16 ③:鼠标点的那一格贴 .cellhit(#a8e3d2)——取捕获监听记下的最近 td
|
||||
const ptd=window.__lastPickedTd;
|
||||
if(ptd && tr.contains(ptd)) ptd.classList.add('cellhit');
|
||||
CURTYPE=type; CUR={id};
|
||||
// 搜索框/屏蔽词框**非粘性**(2026-10-11 主人定):所在行换了 → 必须清除上一次遗留的
|
||||
// **所有**信息(关键字模式/检索结果状态/屏蔽词/框内文字),再带入本行名称——每行都从
|
||||
@@ -1166,8 +1441,15 @@ async function search(){
|
||||
// 2026-09-29:原来按 children[6]/children[7] 取单价,加「类别」列后下标会错位;
|
||||
// 改成读行上的 data-price(原始数值,不带千分位),以后再加/减列都不受影响
|
||||
function curPrice(){
|
||||
const tr=document.querySelector('tr.sel'); if(!tr) return null;
|
||||
const v = parseFloat(tr.dataset.price); return isNaN(v)?null:v;
|
||||
const tr=document.querySelector('tr.sel');
|
||||
if(tr){ const v = parseFloat(tr.dataset.price); if(!isNaN(v)) return v; }
|
||||
// 规格 ⑭:定额点选后清单行无 .sel——基准单价改从 GRP_DATA 取(对比基准仍是被选清单)
|
||||
if(CURTYPE==='bill' && CUR && CUR.id){
|
||||
const r = grpRowById(CUR.id);
|
||||
const v = r==null ? NaN : parseFloat(r[6]);
|
||||
if(!isNaN(v)) return v;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/* 当前基准行的采纳备注(对比框「已采纳」灰徽标判定依据,2026-10-11 主人定):
|
||||
清单 = GRP_DATA 里 r[0]===CUR.id 的 r[10];工料机 = LME_ROWS 同查。无选中/无备注 = 空。 */
|
||||
@@ -1400,8 +1682,11 @@ function grpRowById(id){
|
||||
}
|
||||
async function adopt(i){
|
||||
const x=VISIBLE_ROWS[i]; if(!x) return;
|
||||
if(CURTYPE!=='bill') return; // 双保险:非清单一律不写
|
||||
const tr=document.querySelector('tr.sel'); if(!tr) return;
|
||||
if(CURTYPE!=='bill' || !CUR){ dlMsg('请先在上方点选清单行,再采纳历史价','warn'); return; } // 规格⑤:不静默
|
||||
// 规格 ⑭:点过定额后清单行不再带 .sel——采纳基准跟着 CUR 走(CUR 在 pick 时已定),
|
||||
// 不再要求可见 .sel;行被删等异常由服务端「清单不存在」兜底。
|
||||
const tr=document.querySelector('tr.sel') || (grpRowById(CUR.id) ? {basis:1} : null);
|
||||
if(!tr){ dlMsg('请先在上方点选清单行,再采纳历史价','warn'); return; }
|
||||
// ① 数据采纳(决策 68 批次B:规格 9.1 新增清单覆盖 / 9.3 原清单定额追加+原定额临删 /
|
||||
// 9.4 汇总品类追加)。有 bill_id 的入库清单行才落数据;连续采纳认最后一次(服务端语义)。
|
||||
let r0=null;
|
||||
@@ -1423,10 +1708,11 @@ async function adopt(i){
|
||||
}catch(e){ r=null; }
|
||||
if(!r || !r.ok){ dlMsg('备注写入失败:'+(r&&r.msg?r.msg:'服务未响应'),'err'); return; }
|
||||
// ③ 刷新当前视图(9.1 清单行字段被覆盖、9.3 追加定额带临删——重拉才是真状态)
|
||||
// keepView:采纳后停在原组原行(规格 2026-10-16:点采纳跳至第一组 = bug,修复)
|
||||
const cur=document.querySelector('.tab.on');
|
||||
const p=cur?cur.dataset.p:'p2';
|
||||
if(p==='p1') await loadGroups('inconsistent');
|
||||
else if(p==='p2') await loadGroups('similar');
|
||||
if(p==='p1') await loadGroups('inconsistent',false,true);
|
||||
else if(p==='p2') await loadGroups('similar',false,true);
|
||||
else await refreshRaw();
|
||||
renderHist(); // 已采纳灰标记:旧行复原、新行点亮(传递)
|
||||
dlMsg('已采纳'+(r0?('('+r0.mode+':定额 '+r0.n_norm+' 条'+(r0.n_sum?('、汇总补品类 '+r0.n_sum+' 行'):'')+')'):'(仅备注)')+':'+txt,'ok');
|
||||
@@ -1449,12 +1735,12 @@ async function cancelBillAdopt(billId, el){
|
||||
body:JSON.stringify({bill_id:billId,remark:''})});
|
||||
}catch(e){ r2=null; }
|
||||
if(!r2 || !r2.ok){ dlMsg('取消采纳失败:'+(r2&&r2.msg?r2.msg:'备注清空未响应'),'err'); return; }
|
||||
// ③ 刷新当前视图(原数据/组表都可能是取消来源;撤缓存重拉即真状态)
|
||||
// ③ 刷新当前视图(原数据/组表都可能是取消来源;撤缓存重拉即真状态;keepView 停在原地)
|
||||
Object.keys(RV_CACHE).forEach(k=>{ if(String(k).indexOf(SID+'|')===0) delete RV_CACHE[k]; });
|
||||
const cur=document.querySelector('.tab.on');
|
||||
const p=cur?cur.dataset.p:'p2';
|
||||
if(p==='p1') await loadGroups('inconsistent');
|
||||
else if(p==='p2') await loadGroups('similar');
|
||||
if(p==='p1') await loadGroups('inconsistent',false,true);
|
||||
else if(p==='p2') await loadGroups('similar',false,true);
|
||||
else await refreshRaw();
|
||||
renderHist();
|
||||
dlMsg('已取消采纳'+(r.noop?'(该清单无数据采纳,仅清了备注)':'(数据已反向恢复)'),'ok');
|
||||
@@ -1574,7 +1860,10 @@ async function recLoad(){
|
||||
try{ d=await J('/api/sessions'); }
|
||||
catch(e){ return; } // 读不到就静默:错误提示归管理页管,工作台不该弹
|
||||
RECS=d.items||[]; RECMAP={};
|
||||
(RECS||[]).forEach(r=>(r.all||[]).forEach(x=>RECMAP[x.id]=x));
|
||||
(RECS||[]).forEach(r=>(r.all||[]).forEach(x=>{
|
||||
x.can_reparse = r.can_reparse; // 决策 94:组按源文件去重,can_reparse 对组内每个会话同样成立
|
||||
RECMAP[x.id]=x;
|
||||
}));
|
||||
}
|
||||
async function recOpen(sid,keep){
|
||||
const m=RECMAP[sid]||{};
|
||||
@@ -1994,14 +2283,19 @@ async function initFromUrl(){
|
||||
// 2026-10-10 主人定:完成提示改右下角浮层,只报条数(不再顶栏长句)
|
||||
if(r && r.ok){ await recLoad();
|
||||
toast('清单 ' + r.n_bill + ' 条、定额 ' + r.n_norm + ' 条、工料机 ' + r.n_lme + ' 条'); }
|
||||
else if(r && r.msg){ dlMsg(r.msg, 'err'); } // 决策 94:重解析失败要说出来(多半=源文件没了),别静默吞掉
|
||||
}catch(e){}
|
||||
}
|
||||
ldPct(86,'正在加载清单、分组与工料机…');
|
||||
await recOpen(sid, true);
|
||||
if(['p0','p1','p2','p3'].includes(savedTab) && savedTab !== 'p3') await tab(savedTab);
|
||||
// 决策 94:源文件缺失要进门就知道——数据可看,但导出/重解析都没了(最近审核列表也有红标)
|
||||
if(RECMAP[sid] && RECMAP[sid].can_reparse === false){
|
||||
dlMsg('该工程源文件已缺失:数据仍可查看,但无法导出、无法重新解析', 'warn');
|
||||
}
|
||||
} finally { ldHide(); }
|
||||
if(!fromUrl) $('msg').textContent = '已恢复上次审核:《' +
|
||||
(($('sinfo').querySelector('b')||{}).textContent || '') + '》(「最近审核」页可切换其他工程)';
|
||||
// 规格 2026-10-17 工具栏8:取消「已恢复上次审核:《…》」提示(工程名已在顶栏,不再赘述)
|
||||
if(!fromUrl) $('msg').textContent = '';
|
||||
} else if(fromUrl){ ldHide(); }
|
||||
}
|
||||
initFromUrl();
|
||||
|
||||
Reference in New Issue
Block a user