perf(分组): 类似清单分组结果服务端 LRU 缓存,支持强制重载与后台列收编优化
- 服务端按「数据指纹+规则指纹」缓存 _group_v2_output 结果(LRU 上限 12 批次),大幅缩短大工程重复分组耗时;工作台新增「⟳ 重载」入口可跳过缓存按当前数据与规则重算 - 后台弹框显隐收编为 detLayout 单一写入点,修复组树与价格工具行残留 - 列定义引入 wb 声明式标记,「取消采纳」「备注」列后台剔除,工作台布局为唯一来源 - 目录树新增展开/折叠把手与宽度拖动条;会话页加载挂进度条 - 更新决策台账(决策 44-46),附一次性 profile 脚本
This commit is contained in:
@@ -140,8 +140,8 @@ a:hover{text-decoration:underline}
|
||||
必须给 #dright / #drawbox 撑出确定高度,否则 .rawbox 的 height:100% 在弹框里算不出来、整块塌陷。 */
|
||||
#dright{flex:1;min-width:0;display:flex;flex-direction:column;min-height:0}
|
||||
#drawbox{flex:1;min-height:0}
|
||||
#dside{width:300px;min-width:210px;background:#fff;border-right:1px solid var(--line);
|
||||
overflow-y:auto;padding:10px 6px;flex-shrink:0}
|
||||
#dside{width:300px;min-width:180px;background:#fff;border-right:1px solid var(--line);
|
||||
overflow:auto;padding:10px 6px;flex-shrink:0}
|
||||
.treeT{font-size:14px;font-weight:700;margin:4px 8px 12px;color:#111827;line-height:1.4}
|
||||
.secT{padding:6px 8px;margin:1px 0;cursor:pointer;border-radius:6px;color:#374151;
|
||||
white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px}
|
||||
@@ -180,6 +180,15 @@ a:hover{text-decoration:underline}
|
||||
.pnode:hover .ops,.pnode.ops-on .ops,.pnode.on .ops{display:inline-flex}
|
||||
/* ↑ 选中目录的按钮排常显(2026-10-13 主人找不到"+子目录"入口):
|
||||
悬停可见照旧,选中的那一行不用悬停也能看到全部按钮 */
|
||||
/* 展开 / 折叠把手(2026-10-13 主人定):有子级 ▸/▾ 可点;叶子透明占位保持同级对齐 */
|
||||
.pnar{flex:none;width:14px;height:15px;line-height:13px;text-align:center;cursor:pointer;
|
||||
color:#6b7280;font-size:10px;border-radius:3px;user-select:none}
|
||||
.pnar:hover{background:#dbe5f2;color:var(--c1)}
|
||||
.pnar.em{visibility:hidden}
|
||||
.pkids{margin-left:16px;border-left:1px dotted #cbd5e1;padding-left:4px}
|
||||
/* 目录栏宽度拖动条(2026-10-13 主人定:左右拖动调整目录容器宽度) */
|
||||
#presizer{width:6px;flex:none;cursor:col-resize;background:transparent}
|
||||
#presizer:hover,#presizer.on{background:#c9d4e2}
|
||||
.pnode .ops span{min-width:17px;height:17px;padding:0 2px;border-radius:4px;background:#fff;border:1px solid #c9d4e2;
|
||||
color:#34506f;font-size:11px;line-height:15px;text-align:center;cursor:pointer;white-space:nowrap}
|
||||
.pnode .ops span:hover{background:var(--c2);color:#fff;border-color:var(--c2)}
|
||||
@@ -188,7 +197,7 @@ a:hover{text-decoration:underline}
|
||||
.pnode input.ren{width:120px;padding:1px 6px;font-size:12px;border-radius:4px;border:1px solid #9fb6d4}
|
||||
.pnode .cfm{display:inline-flex;gap:3px;align-items:center;background:#fff7e6;border:1px solid #f0d9a8;
|
||||
border-radius:4px;padding:1px 4px;font-size:11px;color:#8a6d1a;flex:none}
|
||||
.pkids{margin-left:12px;border-left:1px dotted #cbd5e1;padding-left:4px}
|
||||
/* .pkids 的缩进规则统一放上面把手那组(16px,2026-10-13 加深层级),这里不再重复定义 */
|
||||
#ptool{display:flex;align-items:center;gap:8px;padding:9px 14px;background:#fafcff;
|
||||
border-bottom:1px solid var(--line);flex-wrap:wrap}
|
||||
#ptool .where{font-size:12px;color:#34506f;background:#eef3fa;border:1px solid #d8e0ec;border-radius:4px;padding:2px 8px}
|
||||
@@ -198,6 +207,8 @@ a:hover{text-decoration:underline}
|
||||
.btn.dis{color:#9aa4b2;background:#f4f6f9;cursor:not-allowed;border-color:#d8e0ec}
|
||||
tr.pedit{background:#fffbef}
|
||||
td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb6d4;border-radius:4px}
|
||||
/* 明细表操作列:同一格里第二个链接(删除/取消)与前面的拉开 12px(2026-10-13 主人定) */
|
||||
#dtbd td a + a{margin-left:12px}
|
||||
.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>
|
||||
@@ -279,6 +290,8 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
<div class="tabs" id="dtabs"></div>
|
||||
<div class="db" id="dbody">
|
||||
<div id="dside" style="display:none"></div>
|
||||
<!-- 价格明细目录栏宽度拖动条(2026-10-13 主人定:左右拖动调宽;与 dside 同步显隐) -->
|
||||
<div id="presizer" style="display:none"></div>
|
||||
<!-- 类似清单(p2)的左组目录树(2026-10-08 主人定:后台同工作台;仅该标签显示) -->
|
||||
<div id="simtree" style="display:none"></div>
|
||||
<div id="dright">
|
||||
@@ -304,7 +317,12 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
<table id="dtb"><colgroup id="dcg"></colgroup><thead id="dth"></thead><tbody id="dtbd"></tbody></table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pager"><span class="tip" id="dcnt"></span></div>
|
||||
<div class="pager"><span class="tip" id="dcnt"></span>
|
||||
<!-- ⟳ 重载(决策 46):仅类似清单标签显示——跳过缓存强制重新分组 -->
|
||||
<a id="reloadsim" style="display:none;margin-left:14px" href="javascript:void(0)"
|
||||
onclick="ldWrap('','正在重新分组(不用缓存,工程大要稍等)…',()=>loadTab('p2',true))"
|
||||
title="不用缓存,按当前批次数据与分组规则重新分组(工程大要稍等)">⟳ 重载</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -516,7 +534,7 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="common.js?v=20261012a"></script>
|
||||
<script src="common.js?v=20261013c"></script>
|
||||
<script src="period.js"></script>
|
||||
<script>
|
||||
const $=id=>document.getElementById(id);
|
||||
@@ -784,7 +802,7 @@ const COL_PRICE=[
|
||||
{t:'操作',a:'c',w:100}
|
||||
];
|
||||
// 树 + 行的全部界面状态(换批次/换标签在 loadTab 价格分支复位)
|
||||
let PD={tree:[],counts:{},nUncat:0,cur:0,curName:'',curPath:'',curLeaf:true,picked:false,
|
||||
let PD={tree:[],counts:{},nUncat:0,cur:0,curName:'',curPath:'',curLeaf:true,picked:false,fold:{},
|
||||
rows:[],total:0,att:{has:false},
|
||||
ren:0, // 正在改名的目录 id(0=无)
|
||||
adding:null, // 新建目录:{parent, mode:'child'|'sib', sib}(sib=-1=插同级末尾)
|
||||
@@ -796,7 +814,7 @@ let PDMAP={}; // 目录 id → {name, leaf, parent, path}(渲染/取
|
||||
function pdClear(){ PD.ren=0; PD.adding=null; PD.cfm=null; PD.cfmRow=0; }
|
||||
|
||||
async function loadPrice(){
|
||||
$('ptool').style.display='flex';
|
||||
// 面板显隐(ptool/presizer 等)由 detLayout('price') 统一负责,这里只取数渲染
|
||||
const [d,a]=await Promise.all([J(`/api/admin/batch/${DID}/dirs`),
|
||||
J(`/api/admin/batch/${DID}/attach`)]);
|
||||
PD.tree=d.tree||[]; PD.counts=d.counts||{}; PD.nUncat=d.n_uncat||0; PD.att=a;
|
||||
@@ -851,29 +869,36 @@ function renderTree(){
|
||||
? PD.tree.reduce((s,n)=>s+(PD.counts[n.id]||0),0)+PD.nUncat
|
||||
: PD.nUncat;
|
||||
dside.innerHTML=`
|
||||
<div class="tot">
|
||||
<div class="lab"><span class="ar">▾</span>${esc(dt.textContent)}
|
||||
<div class="tot${PD.fold[0]?' collapsed':''}">
|
||||
<div class="lab"><span class="ar" onclick="pdFold(0)" title="展开 / 折叠">▾</span>${esc(dt.textContent)}
|
||||
<span style="font-weight:400;color:#6b7280;font-size:11.5px">(${grand} 条)</span>
|
||||
<span class="ops" style="display:inline-flex"><span onclick="event.stopPropagation();dirAddRoot()" title="新增一级目录">+子目录</span></span>
|
||||
</div>
|
||||
<div class="children">${renderNodes(PD.tree,0,0)}
|
||||
<div class="pnode${PD.cur===0?' on':''}" style="${PD.cur===0?'':'color:#9aa4b2'}" onclick="pickDir(0)">
|
||||
<span class="nm">(未分类)</span><span class="cnt">${PD.nUncat}</span></div>
|
||||
<span class="pnar em"></span><span class="nm">(未分类)</span><span class="cnt">${PD.nUncat}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="treefoot"><div class="tipp">
|
||||
悬停目录出按钮:+子 +平级 ✎ ↑ ↓ ✕(↑↓✕ 均需行内二次确认;↑↓ 子目录整枝跟动)。<br>
|
||||
只有最底层目录(没有子目录)可以挂价格行、新增行。
|
||||
点 ▸/▾ 展开 / 折叠;悬停目录出按钮(选中的常显):+子 +平级 ✎ ↑ ↓ ✕(↑↓✕ 均需二次确认)。<br>
|
||||
只有最底层目录(没有子目录)可以挂价格行、新增行。拖动右侧分隔条可调目录栏宽度。
|
||||
</div></div>`;
|
||||
}
|
||||
function pdFold(id){ PD.fold[id]=!PD.fold[id]; renderTree(); }
|
||||
function renderNodes(ns,parent,depth){
|
||||
let h='';
|
||||
ns.forEach(n=>{
|
||||
h+=nodeHTML(n);
|
||||
if(PD.adding&&PD.adding.mode==='sib'&&PD.adding.sib===n.id) h+=newNodeHTML(parent);
|
||||
if(n.children&&n.children.length){
|
||||
// 2026-10-13 修「+子」无反应:叶子(children 为空)也要能渲染新建输入行
|
||||
const hasKids=n.children&&n.children.length;
|
||||
const childAdding=PD.adding&&PD.adding.mode==='child'&&PD.adding.parent===n.id;
|
||||
if(PD.fold[n.id]&&!childAdding) return; // 折叠:整枝不渲染(加子级时自动展开,见 dirAddChild)
|
||||
if(childAdding){
|
||||
const kids=hasKids?renderNodes(n.children,n.id,depth+1):'';
|
||||
h+=`<div class="pkids">${kids}${newNodeHTML(n.id)}</div>`;
|
||||
} else if(hasKids){
|
||||
h+=`<div class="pkids">${renderNodes(n.children,n.id,depth+1)}</div>`;
|
||||
if(PD.adding&&PD.adding.mode==='child'&&PD.adding.parent===n.id) h+=`<div class="pkids">${newNodeHTML(n.id)}</div>`;
|
||||
}
|
||||
});
|
||||
if(PD.adding&&PD.adding.mode==='sib'&&PD.adding.sib===-1&&PD.adding.parent===parent) h+=newNodeHTML(parent);
|
||||
@@ -882,6 +907,11 @@ function renderNodes(ns,parent,depth){
|
||||
function nodeHTML(n){
|
||||
const cnt=PD.counts[n.id]||0, cur=PD.cur===n.id;
|
||||
const stop='event.stopPropagation();';
|
||||
// 展开 / 折叠把手:有子级可点,叶子放透明占位保持同级对齐(2026-10-13 主人定)
|
||||
const hasKids=n.children&&n.children.length;
|
||||
const ar=hasKids
|
||||
? `<span class="pnar" title="展开 / 折叠" onclick="${stop}pdFold(${n.id})">${PD.fold[n.id]?'▸':'▾'}</span>`
|
||||
: '<span class="pnar em"></span>';
|
||||
let mid;
|
||||
if(PD.ren===n.id){
|
||||
mid=`<input class="ren" id="pren" value="${esc(n.name)}" onclick="${stop}">
|
||||
@@ -903,11 +933,11 @@ function nodeHTML(n){
|
||||
<span class="pd" title="删除(需确认)" onclick="${stop}dirCfm(${n.id},'del')">✕</span>
|
||||
</span>`;
|
||||
}
|
||||
return `<div class="pnode${cur?' on':''}" onclick="pickDir(${n.id})">${mid}</div>`;
|
||||
return `<div class="pnode${cur?' on':''}" onclick="pickDir(${n.id})">${ar}${mid}</div>`;
|
||||
}
|
||||
function newNodeHTML(parent){
|
||||
const stop='event.stopPropagation();';
|
||||
return `<div class="pnode ops-on" onclick="${stop}">
|
||||
return `<div class="pnode ops-on" onclick="${stop}"><span class="pnar em"></span>
|
||||
<input class="ren" id="pnew" placeholder="目录名称">
|
||||
<span class="ops ops-on"><span class="pk" title="保存" onclick="${stop}dirAddSave(${parent})">✓</span>
|
||||
<span class="pd" title="取消" onclick="${stop}pdClear();renderTree()">✕</span></span></div>`;
|
||||
@@ -920,6 +950,7 @@ async function dirPost(body){
|
||||
pdClear();
|
||||
const d=await J(`/api/admin/batch/${DID}/dirs`);
|
||||
PD.tree=d.tree||[]; PD.counts=d.counts||{}; PD.nUncat=d.n_uncat||0;
|
||||
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;
|
||||
@@ -927,7 +958,7 @@ async function dirPost(body){
|
||||
return true;
|
||||
}
|
||||
function dirAddRoot(){ PD.ren=0; PD.cfm=null; PD.adding={parent:0,mode:'sib',sib:-1}; renderTree(); const i=$('pnew'); if(i) i.focus(); }
|
||||
function dirAddChild(id){ PD.ren=0; PD.cfm=null; PD.adding={parent:id,mode:'child',sib:0}; renderTree(); const i=$('pnew'); if(i) i.focus(); }
|
||||
function dirAddChild(id){ PD.ren=0; PD.cfm=null; delete PD.fold[id]; PD.adding={parent:id,mode:'child',sib:0}; renderTree(); const i=$('pnew'); if(i) i.focus(); }
|
||||
function dirAddSib(id){ PD.ren=0; PD.cfm=null; const p=PDMAP[id].parent; PD.adding={parent:p,mode:'sib',sib:id}; renderTree(); const i=$('pnew'); if(i) i.focus(); }
|
||||
function dirRen(id){ PD.adding=null; PD.cfm=null; PD.ren=id; renderTree(); const i=$('pren'); if(i){ i.focus(); i.select(); } }
|
||||
function dirCfm(id,op){ PD.ren=0; PD.adding=null; PD.cfm={id:id,op:op}; renderTree(); }
|
||||
@@ -937,7 +968,8 @@ function dirRenSave(id){
|
||||
}
|
||||
function dirAddSave(parent){
|
||||
const i=$('pnew'); if(!i||!i.value.trim()){ alert('目录名称不能为空'); return; }
|
||||
dirPost({op:'add',parent:parent,name:i.value.trim()}).then(ok=>{ if(ok) pickDir(PD.cur); });
|
||||
// ⚠️ 参数名是 parent_id(与服务端一致)——曾误传 parent 导致「+子」建出来的目录全落在根下(2026-10-13 主人报)
|
||||
dirPost({op:'add',parent_id:parent,name:i.value.trim()}).then(ok=>{ if(ok) pickDir(PD.cur); });
|
||||
}
|
||||
async function dirGo(id,op){
|
||||
// ↑↓ 在服务端是同一个 op=seq(dir=up/down),rename/add/move/del 同名同参
|
||||
@@ -958,7 +990,7 @@ function renderRows(){
|
||||
if(editing) $('pdirsel').innerHTML=leavesHTML(PD.editId?curEditDir():PD.cur);
|
||||
$('pwhere').textContent = PD.curLeaf ? `当前:${PD.curName}(最底层目录,可挂价格行)`
|
||||
: `当前:${PD.curName}(含子目录,仅查看)`;
|
||||
$('dsecH').style.display='block';
|
||||
// (dsecH 显隐归 detLayout;这里只刷内容)
|
||||
$('dsecH').innerHTML = esc(PD.curPath || PD.curName)
|
||||
+ `<span class="crumb">${PD.curLeaf?'':'(含子目录汇总) '}共 ${PD.total} 条</span>`;
|
||||
tb.innerHTML=PD.rows.map(rowHTML).join('')
|
||||
@@ -1040,17 +1072,24 @@ async function tog(id,cur){
|
||||
// 列定义来自 common.js(前后台**唯一来源**)—— 禁止在此另写一份,否则两侧会静默分叉
|
||||
const COL_LME = colsObjs(COLS.lme);
|
||||
const COL_BILL = colsObjs(COLS.bill);
|
||||
/* 与工作台的差异**只体现在这两个参数**(数据流独立),渲染逻辑一律走 common.js:
|
||||
/* 后台列(2026-10-13 主人定):从共享层 COLS.* 派生,剔除 wb 标记的**工作台独有列**
|
||||
(取消采纳+备注——会话交互列与采纳备注,后台批次库只存有价值的不变数据,恒空列不占位;
|
||||
工料机后台 9 列 / 清单后台 11 列)。
|
||||
⚠️ 后台一律用派生数组,不直接引 COLS.* —— 列定义维护一套,改列只改 common.js 一处。 */
|
||||
const AC_LME = noWB(COLS.lme);
|
||||
const AC_BILL = noWB(COLS.bill);
|
||||
/* 与工作台的差异**只体现在这几个参数**(数据流独立),渲染逻辑一律走 common.js:
|
||||
rowClick='' → 后台不做「点行 → 历史比对」(那是工作台当前会话的能力)
|
||||
normApi → 定额从**批次库**取,工作台从**会话库**取,两边各查各的库 */
|
||||
var WB_OPTS = { rowClick: '', normApi: '/api/admin/bill/' };
|
||||
normApi → 定额从**批次库**取,工作台从**会话库**取,两边各查各的库
|
||||
backend=1 → renderLme 不输出工作台独有列(取消采纳)的单元格 */
|
||||
var WB_OPTS = { rowClick: '', normApi: '/api/admin/bill/', backend: 1 };
|
||||
|
||||
/* 后台工料机主表排序(2026-10-09 收编进共用层):排序件在 common.js
|
||||
(sortHeadHTML/sortRows,前后台唯一实现),与工作台同一套规则;
|
||||
状态本页管(数据流独立),换批次在 loadTab 的 p0 分支复位。 */
|
||||
let ALME_ROWS=[], ALME_SORT={k:-1,dir:1};
|
||||
const ALME_NUM=new Set([5,6,7,8]); // 数量/除税编制价/税率/含税编制价(数据下标)
|
||||
function almeHead(){ return sortHeadHTML(COLS.lme, ALME_SORT, 'almeSort'); }
|
||||
function almeHead(){ return sortHeadHTML(AC_LME, ALME_SORT, 'almeSort'); }
|
||||
function almeSort(i){
|
||||
if(ALME_SORT.k===i) ALME_SORT.dir=-ALME_SORT.dir;
|
||||
else { ALME_SORT.k=i; ALME_SORT.dir=1; }
|
||||
@@ -1059,12 +1098,11 @@ function almeSort(i){
|
||||
}
|
||||
function almeRender(){
|
||||
// r = [id, 编码, 名称, 规格型号, 单位, 数量, 除税编制价, 税率, 含税编制价, 类型, 备注];
|
||||
// 行 HTML 由 common.js 的 renderLme 提供(与工作台同一份),类型(r[9])不显示,备注留空
|
||||
// 显示位→数据位与工作台同一行:备注列(显示位 9)取 r[10]——批次行只有 10 列,
|
||||
// r[10] 全空 → 比较器恒 0、stable 排序维持原序,与工作台行为自然对齐。
|
||||
const view=sortRows(ALME_ROWS, ALME_SORT.k===9?10:ALME_SORT.k, ALME_SORT.dir, ALME_NUM);
|
||||
// 行 HTML 由 common.js 的 renderLme 提供(与工作台同一份;backend=1 不输出取消采纳/备注两格
|
||||
// → 9 格与 AC_LME 表头对齐)。类型(r[9])/备注(r[10])后台均不显示,显示位=数据位直通。
|
||||
const view=sortRows(ALME_ROWS, ALME_SORT.k, ALME_SORT.dir, ALME_NUM);
|
||||
document.getElementById('dtbd').innerHTML=renderLme(view, WB_OPTS)
|
||||
||`<tr><td colspan="${COLS.lme.length}" class="tip" style="text-align:center;padding:16px">没有数据</td></tr>`;
|
||||
||`<tr><td colspan="${AC_LME.length}" class="tip" style="text-align:center;padding:16px">没有数据</td></tr>`;
|
||||
}
|
||||
// 定额(挂在清单下):定额编码 / 定额名称 / 单位 / 单价(COL_PRICE 已上移进价格明细模块,2026-10-12)
|
||||
const COL_NORM=[{t:'定额编码',a:'c',w:130},{t:'定额名称',a:'l',w:300},
|
||||
@@ -1087,34 +1125,60 @@ var WB_RAW = RawView({
|
||||
treeEl: 'drawtree', tabsEl: 'drawstabs', bodyEl: 'drawbody'
|
||||
});
|
||||
|
||||
/* 明细弹框布局编排(2026-10-13 收编,**单一写入点**):
|
||||
弹框是同一个 DOM 被四种内容复用 —— price=价格明细(左目录树+右一张表)/
|
||||
raw=原数据(左树+右标签卡,撑满弹框高度)/ list=三个列表大表 /
|
||||
sim=类似清单(左组树+右表,其余同 list)。
|
||||
⚠️ 这些面板的 display 与 fx/simflex 类**只允许**在本函数里写,别处再手写一行
|
||||
就是下一次「残留 bug」的起点:此前收面板的代码散在 det/loadTab 各分支,
|
||||
p3 与价格两个提前 return 的分支漏收「类似清单组树」(原数据/价格明细旁边
|
||||
叠出别家目录),价格工具行 ptool 更是只有人开没人收(工程明细上残留
|
||||
「+新增行/导出/附件」按钮,操作的还是上一个价格批次的 PD 状态)。
|
||||
(2026-10-13 追加 reloadsim:⟳ 重载仅类似清单标签显示。) */
|
||||
function detLayout(mode){
|
||||
const price=mode==='price', raw=mode==='raw', sim=mode==='sim';
|
||||
$('drawbox').style.display = raw?'flex':'none';
|
||||
$('dtb').style.display = raw?'none':'';
|
||||
$('simtree').style.display = sim?'':'none';
|
||||
$('reloadsim').style.display = sim?'inline':'none'; // ⟳ 重载仅类似清单标签显示(决策 46)
|
||||
dbody.classList.toggle('fx', price||raw);
|
||||
dbody.classList.toggle('simflex', sim);
|
||||
dside.style.display = price?'block':'none';
|
||||
$('presizer').style.display = price?'block':'none';
|
||||
$('dsecH').style.display = price?'block':'none';
|
||||
$('ptool').style.display = price?'flex':'none';
|
||||
}
|
||||
async function det(id,name){
|
||||
DID=id; dt.textContent=name;
|
||||
const isPrice=(KIND!=='project');
|
||||
// 价格类(信息价/市场价)只有一张价格明细表 → 不显示 4 个标签
|
||||
$('dtabs').style.display = isPrice?'none':'flex';
|
||||
// ⚠️ 明细弹框是**同一个 DOM**被四种内容复用(价格 / 原数据 / 三个列表)。
|
||||
// 这里必须在**进来的瞬间**就把「原数据」面板收掉:loadTab() 里也有同样一句(兜底),
|
||||
// 但那句要等接口回来才执行,中间这一帧旧画面还在。
|
||||
// 不收的后果:先看工程明细 → 再看信息价明细,上一个工程的原数据树会叠在价格表上,
|
||||
// 而且 #drawbox 是 flex:1,会把价格表挤成 0 高(看起来就是「明细显示不对」)。
|
||||
$('drawbox').style.display = isPrice?'none':'';
|
||||
dbody.classList.toggle('fx', isPrice);
|
||||
dside.style.display = isPrice?'block':'none';
|
||||
document.getElementById('dsecH').style.display = isPrice?'block':'none';
|
||||
// 注:后台类似清单已固定走「系统默认(按名称聚类)」分组,不再读专业 / 不再显示专业下拉
|
||||
// (2026-10-01 主人定:后台是历史检索口,统一自动聚类比让操作者选专业更稳)
|
||||
// ⚠️ 明细弹框是**同一个 DOM**被四种内容复用(价格 / 原数据 / 三个列表)——
|
||||
// 必须在**进来的瞬间**(等接口之前)就把面板收干净,否则旧画面这一帧还在
|
||||
// (工程→价格:原数据树叠在价格表上且把表挤成 0 高;价格→工程:ptool 残留)。
|
||||
// 显隐全部走 detLayout 单一写入点,loadTab() 各分支按自己的模式再打开。
|
||||
detLayout(isPrice?'price':'list');
|
||||
// 注:类似清单分组前后台**同一种方式**(决策 32 + 2026-10-13 主人确认「只有一种」)——
|
||||
// 同一套 v2 顺序管线,关键词层读工作台「⚙ 分组&过滤」存的全局分组设置(global.grp_rules);
|
||||
// 专业体系已取消,后台无分组配置入口(配置只在工作台改,两侧同源生效)。
|
||||
mask.classList.add('on');
|
||||
// 记住打开的明细:从后台跳去工作台再回来时,原来那份还在(主人 2026-10-01)
|
||||
try{ sessionStorage.setItem('admin_det', JSON.stringify({id:id, name:name})); }catch(e){}
|
||||
// 2026-10-11 方案 A′(主人定):后台打开明细 = 看一次升一次——旧版批次先原位升级再出数,
|
||||
// 与工作台同一口径;失败静默(服务端保旧数据),绝不挡明细打开。
|
||||
if(!isPrice){
|
||||
try{
|
||||
await J('/api/admin/batch/upgrade', {method:'POST', headers:{'Content-Type':'application/json'},
|
||||
body: JSON.stringify({id: id})});
|
||||
}catch(e){}
|
||||
}
|
||||
loadTab(sessionStorage.getItem('admin_tab') || TAB_DEFAULT); // 与工作台一致:默认「原数据」
|
||||
// 2026-10-13 主人定:打开明细全程挂进度条(共享层 ldWrap)——覆盖旧版批次「看一次升一次」
|
||||
// 的升级 POST(服务端重活,大工程要重解析)+ 首标签取数;ldWrap 150ms 内完成不闪遮罩
|
||||
//(新版批次打开只要几十 ms,不闪),慢了才显示。loadTab 内部 ldStage 分段报阶段。
|
||||
await ldWrap(name, '正在打开明细…', async ()=>{
|
||||
if(!isPrice){
|
||||
// 2026-10-11 方案 A′(主人定):后台打开明细 = 看一次升一次——旧版批次先原位升级再出数,
|
||||
// 与工作台同一口径;失败静默(服务端保旧数据),绝不挡明细打开。
|
||||
ldStage(15,'正在检查数据版本(旧版批次先升级)…');
|
||||
try{
|
||||
await J('/api/admin/batch/upgrade', {method:'POST', headers:{'Content-Type':'application/json'},
|
||||
body: JSON.stringify({id: id})});
|
||||
}catch(e){}
|
||||
}
|
||||
await loadTab(sessionStorage.getItem('admin_tab') || TAB_DEFAULT); // 与工作台一致:默认「原数据」
|
||||
});
|
||||
}
|
||||
function closeDlg(){
|
||||
mask.classList.remove('on');
|
||||
@@ -1130,56 +1194,60 @@ function closeDlg(){
|
||||
}catch(e){}
|
||||
})();
|
||||
|
||||
async function loadTab(pid){
|
||||
async function loadTab(pid, fresh){
|
||||
document.querySelectorAll('#mask .tab').forEach(x=>x.classList.toggle('on',x.dataset.p===pid));
|
||||
const cg=document.getElementById('dcg'), th=document.getElementById('dth'), tb=document.getElementById('dtbd');
|
||||
if(KIND!=='project'){
|
||||
// 面板复位(兜底,见 det() 里的注释):价格明细只有左目录树 + 右一张表,
|
||||
// 「原数据」的写树 / 四个标签卡必须关掉,否则会和价格表抢同一个 dright 的高度。
|
||||
$('drawbox').style.display='none';
|
||||
$('dtb').style.display='';
|
||||
// 面板复位由 detLayout 统一负责(见其注释):价格明细 = 左目录树 + 右一张表
|
||||
detLayout('price');
|
||||
PD.editId=0; PD.addingRow=false; pdClear(); // PD.cur 不复位:换批次由 loadPrice 自愈落首个一级目录
|
||||
ldStage(40,'正在加载价格明细…');
|
||||
await loadPrice(); // 2026-10-12 重做:多级目录树 + 行内编辑(见 loadPrice/renderTree/renderRows)
|
||||
return;
|
||||
}
|
||||
// ---- 原数据(p3):与工作台同一套结构 + 同一份 RawView 渲染,只换接口 ----
|
||||
if(pid==='p3'){
|
||||
$('drawbox').style.display='flex';
|
||||
dbody.classList.add('fx'); // 撑满弹框高度,左右两栏各自滚动(同工作台)
|
||||
$('dtb').style.display='none';
|
||||
detLayout('raw'); // 撑满弹框高度,左右两栏各自滚动(同工作台)
|
||||
dcnt.textContent='';
|
||||
try{ sessionStorage.setItem('admin_tab', pid); }catch(e){}
|
||||
ldStage(40,'正在加载原数据(目录树+汇总卡)…');
|
||||
await WB_RAW.load();
|
||||
return;
|
||||
}
|
||||
dbody.classList.remove('fx');
|
||||
$('drawbox').style.display='none';
|
||||
$('dtb').style.display='';
|
||||
// 类似清单左组树只在此标签显示(其余标签一律收掉,2026-10-08 主人定)
|
||||
$('simtree').style.display='none';
|
||||
dbody.classList.remove('simflex');
|
||||
// 三个列表大表(p0/p1/p2):类清单组树只在 p2 数据到位后由下面的 detLayout('sim') 打开
|
||||
detLayout('list');
|
||||
if(pid==='p0'){
|
||||
ldStage(30,'正在加载项目工料机…');
|
||||
const d=await J(`/api/admin/batch/${DID}/lme`);
|
||||
n0.textContent=d.total+' 项';
|
||||
if(!n1.textContent) { /* 首次也把另两个数量取出来 */
|
||||
// 2026-10-13 主人定进度条:这两个是重计算接口(南屏 1.5 万条清单各要 6s+),
|
||||
// 必须分段报阶段,否则首开工料机标签像卡死
|
||||
ldStage(55,'正在统计组价不一致(同名同规格比对,工程大要稍等)…');
|
||||
const a=await J(`/api/admin/batch/${DID}/inconsistent`); n1.textContent=a.total+' 组';
|
||||
ldStage(75,'正在统计类似清单分组(工程大要稍等)…');
|
||||
const b=await J(`/api/admin/batch/${DID}/similar`); n2.textContent=b.total+(b.extra||[]).length+' 组';
|
||||
}
|
||||
ALME_ROWS=d.rows||[]; ALME_SORT={k:-1,dir:1}; // 新批次:排序复位(同工作台换数据)
|
||||
cg.innerHTML=colgHTML(COLS.lme);
|
||||
flexFit($('dtb'), COLS.lme); // 与工作台同款:伸缩列撑满容器(2026-10-08 主人定)
|
||||
cg.innerHTML=colgHTML(AC_LME); // 后台列=共享层派生(noWB 剔除工作台独有的取消采纳列)
|
||||
flexFit($('dtb'), AC_LME); // 与工作台同款:伸缩列撑满容器(2026-10-08 主人定)
|
||||
th.innerHTML=almeHead(); // 可排序表头(common.js sortHeadHTML,与工作台同一份)
|
||||
almeRender();
|
||||
dcnt.textContent=`工料机 ${d.total} 项`;
|
||||
return;
|
||||
}
|
||||
// similar 的专业取自**批次绑定的 profession**(后端决定),不再靠 URL 临时参数
|
||||
const url = pid==='p1' ? `/api/admin/batch/${DID}/inconsistent` : `/api/admin/batch/${DID}/similar`;
|
||||
ldStage(35, pid==='p1' ? '正在计算组价不一致(同名同规格比对)…'
|
||||
: (fresh ? '正在重新分组(不用缓存,工程大要稍等)…'
|
||||
: '正在计算类似清单分组(工程大要稍等)…'));
|
||||
// fresh=true(⟳ 重载,决策 46):服务端跳过缓存强制重算,算完回填缓存
|
||||
const url = pid==='p1' ? `/api/admin/batch/${DID}/inconsistent`
|
||||
: `/api/admin/batch/${DID}/similar` + (fresh ? '?fresh=1' : '');
|
||||
const d=await J(url);
|
||||
// 徽标含落单组(与左树根一致,2026-10-11 主人定);组价不一致 extra 恒空、数值不变
|
||||
(pid==='p1'?n1:n2).textContent=d.total+(d.extra||[]).length+' 组';
|
||||
BILL_SORT={k:-1,dir:1}; // 新数据:组内排序复位(2026-10-10)
|
||||
cg.innerHTML=colgHTML(COLS.bill); sumw($('dtb')); colwApply($('dtb'));
|
||||
cg.innerHTML=colgHTML(AC_BILL); sumw($('dtb')); colwApply($('dtb')); // 后台列=noWB 派生(隐藏取消采纳)
|
||||
// 2026-10-10 主人定:类似清单/组价不一致表头都可点=在展开的组内排序(与工作台同款)
|
||||
th.innerHTML = billHeadHTML();
|
||||
// 组行 / 清单行 / 组标题文案 / 价差标红 → 全部由 common.js 的 renderGroups 提供(与工作台同一份)
|
||||
@@ -1190,8 +1258,7 @@ async function loadTab(pid){
|
||||
// 类似清单:左组目录树(2026-10-08 主人定,后台同工作台)—— 点根=全部,点组=只显示该组
|
||||
// 点选行为在公共层 grpTreeBind(两侧唯一实现),本页只给树容器和表体 id
|
||||
if(pid==='p2'){
|
||||
$('simtree').style.display='';
|
||||
dbody.classList.add('simflex');
|
||||
detLayout('sim'); // 组树在数据到位后再开(fetch 期间不闪空树)
|
||||
grpTreeBind($('simtree'), 'dtbd', d);
|
||||
}
|
||||
}
|
||||
@@ -1434,10 +1501,33 @@ function resetF(){fq.value='';fp.value='';fc.value='';fd.value='';setPeriod($('f
|
||||
|
||||
document.querySelectorAll('.tab').forEach(t=>t.onclick=()=>{
|
||||
document.querySelectorAll('.tab').forEach(x=>x.classList.remove('on'));
|
||||
t.classList.add('on'); KIND=t.dataset.kind; SORT={key:'',dir:'DESC'}; syncBtns(); load(1);
|
||||
t.classList.add('on'); KIND=t.dataset.kind; SORT={key:'',dir:'DESC'}; syncBtns();
|
||||
ldWrap('','正在加载列表…',()=>load(1)); // 列表取数期间挂进度条(快则不闪)
|
||||
});
|
||||
mask.onclick=e=>{ if(e.target===mask) closeDlg() };
|
||||
document.querySelectorAll('#mask .tab').forEach(t=>t.onclick=()=>loadTab(t.dataset.p));
|
||||
// 2026-10-13 主人定:切标签没出全数据前要有进度条 —— 走共享层 ldWrap(det() 进来的路径
|
||||
// 已有即时遮罩,ldWrap 检测到就只报阶段不接管;这里兜住「直接点标签」的路径)
|
||||
const TAB_STAGE={p0:'正在加载项目工料机…',p1:'正在计算组价不一致(同名同规格比对)…',
|
||||
p2:'正在计算类似清单分组(工程大要稍等)…',p3:'正在加载原数据(目录树+汇总卡)…'};
|
||||
document.querySelectorAll('#mask .tab').forEach(t=>t.onclick=()=>{
|
||||
ldWrap('', TAB_STAGE[t.dataset.p]||'正在加载…', ()=>loadTab(t.dataset.p));
|
||||
});
|
||||
|
||||
/* 价格明细目录栏:拖动右侧分隔条调宽(2026-10-13 主人定),180~560px 之间 */
|
||||
(function(){
|
||||
var pz=document.getElementById('presizer');
|
||||
if(!pz) return;
|
||||
pz.addEventListener('mousedown', function(e){
|
||||
e.preventDefault();
|
||||
var ds=document.getElementById('dside');
|
||||
var x0=e.clientX, w0=ds.getBoundingClientRect().width;
|
||||
function mv(ev){ ds.style.width=Math.min(560,Math.max(180,w0+ev.clientX-x0))+'px'; }
|
||||
function up(){ document.removeEventListener('mousemove',mv); document.removeEventListener('mouseup',up); pz.classList.remove('on'); }
|
||||
pz.classList.add('on');
|
||||
document.addEventListener('mousemove',mv);
|
||||
document.addEventListener('mouseup',up);
|
||||
});
|
||||
})();
|
||||
|
||||
// 期次:三处都换成"一个面板一次选完起~止"
|
||||
mkPeriod($('fper'), ()=>load(1)); // 列表筛选
|
||||
@@ -1875,7 +1965,12 @@ dmask.onclick = e => { if(e.target===dmask) closeDict() };
|
||||
/* 页面初始化(2026-10-06 修):这一行原本调用的是 loadUpMax() —— 本页根本没有这个函数
|
||||
(真名是 upLoad(),就在上面十几行)。顶层一条语句炸掉,后面**全部不执行**:
|
||||
load(1) 没了 → 列表空着、"共 N 个"也不出,页面却看着没坏,最难往这里想。 */
|
||||
loadFilters(); loadSummary(); syncBtns(); upLoad(); load(1);
|
||||
// 页面初载(2026-10-13 主人定:进页面要等待时挂进度条——从工作台切过来时首屏不再是空白静默)
|
||||
(async function(){
|
||||
await ldWrap('','正在加载后台数据(项目/筛选/汇总)…', async ()=>{
|
||||
await loadFilters(); syncBtns(); upLoad(); await load(1); loadSummary();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<script>licMount('.tabs');</script><!-- 统一设置窗口+到期预警(决策 31,实现在 common.js) -->
|
||||
</body>
|
||||
|
||||
@@ -87,10 +87,14 @@ function WB_TAB(p) {
|
||||
}
|
||||
|
||||
/* ---------------- ③ 列定义 ----------------
|
||||
格式:[列名, 宽度px, 对齐, 标记] 对齐:c=居中 l=左 r=右
|
||||
标记:'attr'=项目特征(可换行) 'tg'=展开把手 */
|
||||
格式:[列名, 宽度px, 对齐, 标记, …] 对齐:c=居中 l=左 r=右
|
||||
标记:'attr'=项目特征(可换行) 'tg'=展开把手 'F'=固定宽 'ns'=纯展示不可排序
|
||||
'wb'=**工作台独有列**(第 6 位;取消采纳等会话交互列)—— 后台批次库只是存有
|
||||
价值的不变数据(主人 2026-10-13 定),渲染时整列剔除(noWB(),真不输出
|
||||
col/th/td,display:none 会错位)。列定义仍以工作台布局为**唯一来源**,
|
||||
后台数组由 noWB() 派生、绝不另写一份 —— 改列只改 COLS.* 这一处。 */
|
||||
const COLS = {
|
||||
// 类似清单 / 组价不一致清单 共用(13 列,2026-10-11 主人定:备注列**左边**加独立「取消采纳」列,
|
||||
// 类似清单 / 组价不一致清单 共用(13 列,2026-10-11 决策 39:备注列**左边**加独立「取消采纳」列,
|
||||
// 与项目工料机表同布局——取消采纳 | 备注;13 列 = 显示列,数据下标 0~10 不变)
|
||||
// ⚠️ 与后端 BILLROW() 数组下标一一对应:
|
||||
// 0=id 1=编码 2=名称 3=项目特征 4=单位 5=工程量 6=单价 7=合价 8=序号 9=单位工程名称
|
||||
@@ -98,15 +102,20 @@ const COLS = {
|
||||
bill: [['', 44, 'c', 'tg'], ['序号', 52, 'c'], ['编码', 120, 'c'], ['类别', 52, 'c'],
|
||||
['单位工程名称', 150, 'l'], ['名称', 210, 'l'], ['项目特征', 260, 'l', 'attr'],
|
||||
['单位', 56, 'c'], ['工程量', 90, 'r'], ['单价', 100, 'r'], ['合价', 110, 'r'],
|
||||
['取消采纳', 76, 'c'], ['备注', 150, 'l']],
|
||||
['取消采纳', 76, 'c', '', '', 'wb'], ['备注', 150, 'l', '', '', 'wb']],
|
||||
|
||||
// 项目工料机(显示 10 列,2026-10-08 主人定:类型列不再显示,数据下标 9=类型 保持不变)
|
||||
// 标记 'F' = 固定宽列;无标记 = 伸缩列(名称/规格型号/备注),平分容器剩余宽度
|
||||
// 项目工料机(工作台 11 列,2026-10-13 主人定:以工作台布局为唯一来源;「取消采纳」「备注」
|
||||
// 两列**工作台独有**(wb 标记,后台 noWB() 剔除后 9 列——采纳备注从不入历史库,后台恒空列不占位);
|
||||
// 类型列不显示,数据下标 9=类型 保持不变)
|
||||
// 标记 'F' = 固定宽列;无标记 = 伸缩列(名称/规格型号),平分容器剩余宽度
|
||||
// —— 表宽始终贴合容器撑满屏幕,见 flexFit() / flexRedistribute()。
|
||||
lme: [['序号', 52, 'c', 'F'], ['编码', 120, 'c', 'F'], ['名称', 220, 'l'], ['规格型号', 200, 'l'],
|
||||
['单位', 56, 'c', 'F'], ['数量', 90, 'r', 'F'], ['除税编制价', 110, 'r', 'F'], ['税率', 70, 'r', 'F'],
|
||||
['含税编制价', 110, 'r', 'F'], ['备注', 160, 'l']]
|
||||
['含税编制价', 110, 'r', 'F'], ['取消采纳', 76, 'c', 'F', 'ns', 'wb'], ['备注', 160, 'l', '', '', 'wb']]
|
||||
};
|
||||
/* 后台列数组 = 工作台列剔除 wb 列(派生,不另维护)。
|
||||
两侧共用同一份 COLS.*:工作台直接用(全量),后台一律经 noWB() 取用。 */
|
||||
function noWB(cols) { return cols.filter(c => c[5] !== 'wb'); }
|
||||
function colsObjs(arr) {
|
||||
return arr.map(c => {
|
||||
const o = { t: c[0], a: c[2], w: c[1] };
|
||||
@@ -173,7 +182,7 @@ const BILL_ATTR_IDX = COLS.bill.findIndex(c => c[3] === 'attr'); // 项目特
|
||||
const BILL_SORT_DS = { 1: 8, 2: 1, 4: 9, 5: 2, 6: 3, 7: 4, 8: 5, 9: 6, 10: 7 };
|
||||
const BILL_SORT_NUM = new Set([8, 5, 6, 7]); // 序号/工程量/单价/合价 按数值比
|
||||
function billHeadHTML() {
|
||||
return '<tr>' + COLS.bill.map((c, i) => {
|
||||
return '<tr>' + billCols().map((c, i) => {
|
||||
const can = BILL_SORT_DS[i] != null;
|
||||
const mark = (can && BILL_SORT.k === i) ? (BILL_SORT.dir > 0 ? ' ▲' : ' ▼') : '';
|
||||
const click = can
|
||||
@@ -487,8 +496,17 @@ function sumw(tb) {
|
||||
/* ---------------- ④ 清单分组渲染 ----------------
|
||||
行数组 r = [id, 编码, 名称, 项目特征, 单位, 工程量, 单价, 合价, 序号, 单位工程名称]
|
||||
opts.rowClick:行点击回调名(工作台='pick',后台='' 表示不绑)
|
||||
opts.normApi:展开定额的接口前缀(会话 /api/session/bill/,批次 /api/admin/bill/) */
|
||||
const CB_LAST = COLS.bill.length - 1, CB_TOTAL = COLS.bill.length - 2; // 组标题 colspan 随列数推导,去魔数
|
||||
opts.normApi:展开定额的接口前缀(会话 /api/session/bill/,批次 /api/admin/bill/)
|
||||
opts.backend:后台标记 —— 取消采纳列(wb)整列不输出(主人 2026-10-13 定:列定义
|
||||
维护一套、后台隐藏),组表各处 colspan 由 billCols() 按当前布局推导。 */
|
||||
/* 组表当前布局(2026-10-13 主人定:尽量维护一套系统):列定义只有 COLS.bill 一份
|
||||
(工作台全量 13 列);后台 = noWB() 剔除 wb 列(取消采纳)→ 12 列。
|
||||
表头 / 组标题 / 分隔行 / 定额子行 / 空表占位的格数与 colspan 全由它推导。 */
|
||||
function billCols() {
|
||||
const bk = (typeof WB_OPTS !== 'undefined') && WB_OPTS && WB_OPTS.backend;
|
||||
return bk ? noWB(COLS.bill) : COLS.bill;
|
||||
}
|
||||
const CB_LAST = () => billCols().length - 1, CB_TOTAL = () => billCols().length - 2;
|
||||
|
||||
function grpTitle(tag, g) {
|
||||
let t = tag + ' · ' + (g.n != null ? g.n : (g.rows ? g.rows.length : 0)) + ' 条清单';
|
||||
@@ -514,12 +532,14 @@ function billTR(r, grp, hide, opts) {
|
||||
+ '<td class="r">' + num(r[5], 3) + '</td>'
|
||||
+ '<td class="r">' + num(r[6]) + '</td>'
|
||||
+ '<td class="r">' + num(r[7]) + '</td>'
|
||||
+ '<td class="c">' + billAdoptCellHTML(r) + '</td>'
|
||||
+ '<td>' + billRemarkCell(r) + '</td></tr>';
|
||||
+ (opts.backend ? '' : '<td class="c">' + billAdoptCellHTML(r) + '</td>'
|
||||
+ '<td>' + billRemarkCell(r) + '</td>')
|
||||
+ '</tr>';
|
||||
}
|
||||
/* 清单「取消采纳」列(2026-10-11 主人定:备注列**左边**独立一列,与项目工料机表同布局):
|
||||
/* 清单「取消采纳」列(2026-10-11 决策 39;2026-10-13 主人定:**工作台独有**,wb 标记、
|
||||
后台 noWB() 整列隐藏——后台批次库只是存有价值的不变数据,交互列不占列):
|
||||
有采纳备注(r[10],BILLROW 尾位)= 「取消采纳」链接;无 = —。
|
||||
后台批次行没有备注(BILLROW 尾位恒 None)→ 恒 —,链接不会出现在后台。 */
|
||||
后台不输出该格(opts.backend),链接永远不会出现在后台。 */
|
||||
function billAdoptCellHTML(r) {
|
||||
return (r && r[10])
|
||||
? '<a class="lk" onclick="cancelBillAdopt(' + r[0] + ',this)"'
|
||||
@@ -534,7 +554,7 @@ function grpTR(cls, key, title, sum, open) {
|
||||
return '<tr class="' + cls + '" data-grp="' + key + '" onclick="tgGrp(\'' + key + '\',this)">'
|
||||
+ '<td class="tg"><span class="tog' + (open ? ' g' : '') + '" data-open="' + (open ? 1 : 0) + '" id="gt_' + key + '">' + (open ? '−' : '+') + '</span></td>'
|
||||
+ '<td class="c"></td>'
|
||||
+ '<td class="gtitle" colspan="' + (CB_TOTAL - 2) + '">' + title + '</td>'
|
||||
+ '<td class="gtitle" colspan="' + (CB_TOTAL() - 2) + '">' + title + '</td>'
|
||||
+ '<td class="r"><b>' + num(sum) + '</b></td>'
|
||||
+ '<td></td></tr>';
|
||||
}
|
||||
@@ -592,14 +612,14 @@ function renderGroups(d, kind, opts) {
|
||||
});
|
||||
// 落单组(决策 32:单个「其他」批)跟着组序连续编为第 N+1 组,与左树同号(决策 33 对齐口径)
|
||||
if (kind === 'similar' && d && d.extra && d.extra.length) {
|
||||
html += '<tr class="sep"><td></td><td colspan="' + CB_LAST + '">以下清单符合筛选条件,但未形成相似组</td></tr>';
|
||||
html += '<tr class="sep"><td></td><td colspan="' + CB_LAST() + '">以下清单符合筛选条件,但未形成相似组</td></tr>';
|
||||
d.extra.forEach((g, i) => {
|
||||
const key = pfx + 'x' + i;
|
||||
const bad = (g.spread != null && Number(g.spread) >= 20) ? ' bad' : '';
|
||||
html += grpTR('grp2' + bad, key, grpTitle('第 ' + (groups.length + i + 1) + ' 组', g), g.tsum, false);
|
||||
});
|
||||
}
|
||||
return html || '<tr><td colspan="' + COLS.bill.length + '" class="empty">没有数据</td></tr>';
|
||||
return html || '<tr><td colspan="' + billCols().length + '" class="empty">没有数据</td></tr>';
|
||||
}
|
||||
|
||||
/* ---- 类似清单左目录树(2026-10-08 主人定:工作台/后台的类似清单都有;2026-10-10 决策 30 改格式)----
|
||||
@@ -662,12 +682,12 @@ function grpTreeBind(box, tbId, d) {
|
||||
}
|
||||
|
||||
/* ---------------- ⑤ 工料机行 ----------------
|
||||
⚠️ 与后端 _lme_rows() 的 10 列一一对应(第 11 列「备注」:会话侧 = 采纳备注 r[10],批次侧无 → 空):
|
||||
⚠️ 与后端 _lme_rows() 的数据 11 列一一对应:
|
||||
0=id 1=编码 2=名称 3=规格型号 4=单位 5=数量 6=除税编制价 7=税率 8=含税编制价 9=类型 10=备注
|
||||
2026-10-08 主人定:**类型列不显示**(r[9] 照常拿到但不渲染格);备注列显示采纳写入的审核备注
|
||||
(工作台 /api/session/rows 返回 r[10]=x_remark;后台批次行没有这列,留空 —— 两侧同一份渲染)。
|
||||
2026-10-09:opts.lmeExtra(r,i) 可选钩子 —— 在「备注」格**前**插一格(工作台的「取消采纳」列;
|
||||
后台不传 = 不显示)。会话侧行渲染 11 格、批次侧仍 10 格,列序由各页自己的 cols 数组决定。 */
|
||||
2026-10-13 主人定:「取消采纳」列**工作台独有**(COLS.lme 里 wb 标记,后台 noWB() 剔除整列;
|
||||
原工作台页内插列 + renderLme 的 lmeExtra 钩子退役)。opts.backend=后台时不输出该格。 */
|
||||
function renderLme(rows, opts) {
|
||||
opts = opts || (typeof WB_OPTS !== 'undefined' ? WB_OPTS : {}) || {};
|
||||
const click = opts.rowClick
|
||||
@@ -684,16 +704,26 @@ function renderLme(rows, opts) {
|
||||
+ '<td class="r">' + num(r[6]) + '</td>'
|
||||
+ '<td class="r">' + num(r[7], 2) + '</td>'
|
||||
+ '<td class="r">' + num(r[8]) + '</td>'
|
||||
+ (opts.lmeExtra ? opts.lmeExtra(r, i) : '')
|
||||
+ '<td title="' + esc(r[10] || '') + '">' + esc(r[10] || '') + '</td></tr>').join('');
|
||||
+ (opts.backend ? '' : '<td class="c">' + lmeAdoptCellHTML(r) + '</td>'
|
||||
+ '<td title="' + esc(r[10] || '') + '">' + esc(r[10] || '') + '</td>')
|
||||
+ '</tr>').join('');
|
||||
}
|
||||
/* 工料机「取消采纳」格(2026-10-13 收编,工作台侧唯一调用方;后台整列不输出):
|
||||
有采纳备注(r[10] 以「采纳:」开头,会话侧 s_lme_proj.x_remark)→「取消采纳」链接,
|
||||
点击清备注 + 把它收进的附件移出「询价附件」目录(cancelAdopt 由工作台页提供);其余 = 灰 —。 */
|
||||
function lmeAdoptCellHTML(r) {
|
||||
return (r && /^采纳:/.test(r[10] || ''))
|
||||
? '<a class="lk" onclick="cancelAdopt(' + r[0] + ')"'
|
||||
+ ' title="清空本行采纳备注;其收进的附件同时移出「询价附件」目录">取消采纳</a>'
|
||||
: '<span style="color:#b9c4d2">—</span>';
|
||||
}
|
||||
|
||||
/* ---------------- ⑦ 定额展开交互 ----------------
|
||||
清单首列「+」→ 展开其下的定额。两侧同一份实现,只是查的库不同
|
||||
(工作台 /api/session/bill/… 会话库,后台 /api/admin/bill/… 历史库),
|
||||
差异**只允许**体现在 WB_OPTS.normApi 这个前缀上。
|
||||
⚠️ 子行必须 12 个 td,和 COLS.bill 对齐 —— 早年后台写过 4 列的子行版本,
|
||||
跟工作台对不齐(也对不上列头),已废弃。 */
|
||||
⚠️ 子行格数 = 当前布局列数(billCols():工作台 13 格 / 后台 12 格,取消采纳格
|
||||
backend 时不输出)—— 必须和列头对齐,早年后台写过 4 列的子行版本已废弃。 */
|
||||
function tgNorm(el, billId) {
|
||||
const opts = (typeof WB_OPTS !== 'undefined' ? WB_OPTS : {}) || {};
|
||||
const base = opts.normApi || '/api/session/bill/';
|
||||
@@ -710,7 +740,7 @@ function tgNorm(el, billId) {
|
||||
const rows = (d && d.rows) || [];
|
||||
if (!rows.length) {
|
||||
frag.innerHTML = '<tr class="sub" data-grp="' + gp + '"><td class="tg"></td>'
|
||||
+ '<td colspan="' + CB_LAST + '">(该清单下没有定额)</td></tr>';
|
||||
+ '<td colspan="' + CB_LAST() + '">(该清单下没有定额)</td></tr>';
|
||||
} else {
|
||||
// 定额 0=编码 1=名称 2=单位 3=工程量 4=单价 5=合价,其余列按清单的对应位置排空(含取消采纳/备注两空位)
|
||||
frag.innerHTML = rows.map(r => '<tr class="sub" data-grp="' + gp + '">'
|
||||
@@ -723,8 +753,8 @@ function tgNorm(el, billId) {
|
||||
+ '<td class="r">' + num(r[3], 3) + '</td>'
|
||||
+ '<td class="r">' + num(r[4]) + '</td>'
|
||||
+ '<td class="r">' + num(r[5]) + '</td>'
|
||||
+ '<td class="c">—</td>'
|
||||
+ '<td></td></tr>').join('');
|
||||
+ (opts.backend ? '' : '<td class="c">—</td><td></td>')
|
||||
+ '</tr>').join('');
|
||||
}
|
||||
let n2 = tr.nextElementSibling;
|
||||
while (n2 && n2.classList.contains('sub')) n2 = n2.nextElementSibling;
|
||||
@@ -2158,3 +2188,95 @@ function licActivate() {
|
||||
licLoad();
|
||||
}).catch(() => { go.disabled = false; toast('网络错误:无法连接本机服务', 'err'); });
|
||||
}
|
||||
|
||||
/* ---------------- ⑧ 加载进度遮罩(2026-10-13 升入共享层,前后台/会话页同一份)----------------
|
||||
来源:工作台 ldmask(2026-10-11 主人定「打开项目要有正在加载的感觉」);2026-10-13 主人定
|
||||
「所有需要等待的进入点都要进度条:切标签卡没展开全部数据前、打开明细、前后台互切、页面初载」。
|
||||
HTML 由本模块**懒注入**(全内联样式,不依赖页面局部 .mask/.dlg 类——sessions 页没引 common.css)。
|
||||
基础 API(与原工作台同名同义,initFromUrl 等既有调用零改动):
|
||||
ldShow(名称, 阶段文案, 起始%) → ldPct(p, text) 推进 → ldCreep(from,to,text) 长活爬升 → ldHide() 收尾
|
||||
便捷包装:
|
||||
ldWrap(名称, 阶段, fn) —— 包一个 async 操作:150ms 内完成**不闪遮罩**(快操作无感);
|
||||
显示后至少停留 500ms(防一闪而过);结束时若遮罩不是我显示的(外层流程在管),只更新
|
||||
阶段文案、不代管收尾。LD_SEQ 守卫:连续操作只有最新一次的收尾生效(慢的旧操作不许盖新的)。
|
||||
ldStage(pct, text) —— 遮罩在显示时更新阶段文案(不在显示时为 no-op),长流程内分段报进度用。 */
|
||||
(function(){
|
||||
let mounted = false;
|
||||
function mount(){
|
||||
if (mounted) return; mounted = true;
|
||||
const d = document.createElement('div');
|
||||
d.id = 'ldmask';
|
||||
d.style.cssText = 'position:fixed;inset:0;background:rgba(0,0,0,.35);display:none;'
|
||||
+ 'align-items:center;justify-content:center;z-index:130';
|
||||
d.innerHTML = '<div style="background:#fff;border-radius:8px;width:460px;max-width:92vw;'
|
||||
+ 'padding:18px 20px;display:flex;flex-direction:column;gap:12px;box-shadow:0 8px 30px rgba(0,0,0,.18)">'
|
||||
+ '<div style="font-size:13.5px;font-weight:700;color:#2c5f8a">正在加载</div>'
|
||||
+ '<div id="ldname" style="font-size:14px;font-weight:600;color:var(--c1,#2c5f8a);word-break:break-all;min-height:18px"></div>'
|
||||
+ '<div style="height:8px;border-radius:5px;background:#e6edf5;overflow:hidden">'
|
||||
+ '<div id="ldbar" style="height:100%;width:0;border-radius:5px;transition:width .35s ease;'
|
||||
+ 'background:linear-gradient(90deg,var(--c1,#2c5f8a),var(--c2,#5a8fc0))"></div></div>'
|
||||
+ '<div id="ldtext" style="font-size:12.5px;color:#5a6b7f">准备中…</div></div>';
|
||||
document.body.appendChild(d);
|
||||
}
|
||||
function el(id){ return document.getElementById(id); }
|
||||
window.ldShow = function(name, text, pct){
|
||||
mount();
|
||||
el('ldname').textContent = name ? ('《' + name + '》') : '';
|
||||
el('ldmask').style.display = 'flex';
|
||||
ldPct(pct, text);
|
||||
};
|
||||
function ldPct(p, text){
|
||||
if (text != null) el('ldtext').textContent = text;
|
||||
el('ldbar').style.width = Math.max(0, Math.min(100, p)) + '%';
|
||||
}
|
||||
window.ldPct = ldPct;
|
||||
window.ldStage = function(p, text){
|
||||
const m = el('ldmask');
|
||||
if (m && m.style.display !== 'none') ldPct(p, text);
|
||||
};
|
||||
let LD_T = 0;
|
||||
window.ldCreep = function(from, to, text){
|
||||
ldPct(from, text);
|
||||
clearInterval(LD_T);
|
||||
let p = from;
|
||||
LD_T = setInterval(function(){ p += 0.5; if (p < to) ldPct(p); }, 300);
|
||||
};
|
||||
window.ldHide = function(){
|
||||
clearInterval(LD_T);
|
||||
ldPct(100, '完成');
|
||||
setTimeout(function(){
|
||||
const m = el('ldmask'); if (!m) return;
|
||||
// 尾巴期间若有新加载接管(bar 已被重设 <100%),不许把人家的遮罩藏掉
|
||||
if ((parseFloat(el('ldbar').style.width) || 0) >= 99){
|
||||
m.style.display = 'none'; ldPct(0, '准备中…');
|
||||
}
|
||||
}, 280);
|
||||
};
|
||||
/* 遮罩是否「真在加载」:display 开着且进度 <100%。
|
||||
⚠️ ldHide 有 280ms「完成」收尾尾巴(bar 已打到 100%、display 还没藏)——这期间
|
||||
新操作若只看 display 会误判「有人在管」而不接管,结果没人管、长活裸奔
|
||||
(南屏 p2 实测前 0.4s 有遮罩、后 6.2s 空窗,就是这只尾巴)。所以判定看 bar。 */
|
||||
function ldActive(){
|
||||
const m = el('ldmask');
|
||||
if (!m || m.style.display === 'none') return false;
|
||||
return (parseFloat(el('ldbar').style.width) || 0) < 99;
|
||||
}
|
||||
let LD_SEQ = 0;
|
||||
window.ldWrap = async function(name, text, fn, opts){
|
||||
const seq = ++LD_SEQ;
|
||||
const delay = (opts && opts.delay != null) ? opts.delay : 150;
|
||||
let owner = false, shownAt = 0;
|
||||
const tm = setTimeout(function(){
|
||||
if (ldActive()) return; // 已有遮罩在真加载(外层流程在管):不接管也不收尾
|
||||
ldShow(name, text, 10); owner = true; shownAt = Date.now();
|
||||
}, delay);
|
||||
try { ldStage(12, text); return await fn(); }
|
||||
finally {
|
||||
clearTimeout(tm);
|
||||
if (!owner) return; // 不是我显示的遮罩,不归我收
|
||||
const rest = 500 - (Date.now() - shownAt);
|
||||
const fin = function(){ if (seq === LD_SEQ) ldHide(); };
|
||||
if (rest > 0) setTimeout(fin, rest); else fin();
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
@@ -61,7 +61,7 @@ a:hover{text-decoration:underline}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="common.js?v=20261011f"></script>
|
||||
<script src="common.js?v=20261013c"></script>
|
||||
<script>
|
||||
/* 会话管理页:照后台「项目界面」的版式,管的是**还没入库**的工作台会话。
|
||||
会话库不自动清(SESSION_KEEP_DAYS=0),要删只能在这里手动删。
|
||||
@@ -174,7 +174,7 @@ head();
|
||||
sumw($('tb')); // 表宽=列宽和(先按基础宽出表)
|
||||
colwApply($('tb')); // 套用上次拖动记忆(伸缩列只记基础宽)
|
||||
attrFillBind($('tb'), NAME_IDX, 260); // 项目名称列吃掉全部余宽 → 表格撑满屏幕(RO 盯缩放)
|
||||
load();
|
||||
ldWrap('','正在加载会话…',()=>load()); // 2026-10-13 主人定:进页面等待挂进度条(共享层)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -294,7 +294,13 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
<div class="grpbox">
|
||||
<div class="grptree" id="grptree"></div>
|
||||
<div class="grpsplit" id="grpsplit"><span class="gsplitbtn" title="收起/展开目录树">◀</span></div>
|
||||
<div class="grpmain"><table id="t2" data-page-node-id="ta5tNexyK4bepH302bOYRs"><colgroup id="cg2" data-page-node-id="I2Ng536RW9f2GJQevDwZru"></colgroup><thead id="th2" data-page-node-id="NomC50uaobhcg7IggoJT6G"></thead><tbody id="tb2" data-page-node-id="Gs6bHmPPPXWmG8SrazuW6d"></tbody></table></div>
|
||||
<div 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">
|
||||
<a class="lk" onclick="reloadSim()" title="不用缓存,按当前工程数据与分组规则重新分组(工程大要稍等)">⟳ 重载</a>
|
||||
<span style="font-size:11.5px;color:var(--muted)">分组结果已缓存(改分组规则后自动按新规则重算)</span>
|
||||
</div>
|
||||
<table id="t2" data-page-node-id="ta5tNexyK4bepH302bOYRs"><colgroup id="cg2" data-page-node-id="I2Ng536RW9f2GJQevDwZru"></colgroup><thead id="th2" data-page-node-id="NomC50uaobhcg7IggoJT6G"></thead><tbody id="tb2" data-page-node-id="Gs6bHmPPPXWmG8SrazuW6d"></tbody></table></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -432,18 +438,8 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
「最近审核」点打开跳 ?sid=N:重解析+首屏加载有几秒到几十秒静默期,观感像死机。
|
||||
这层遮罩在 initFromUrl 里分段推进:显示**正在加载的项目名称**+阶段文案+进度条;
|
||||
重解析是服务端单线程长活,用缓慢爬升的假进度占位(到 82% 封顶等真实阶段接棒)。 -->
|
||||
<div class="mask" id="ldmask" style="z-index:130">
|
||||
<div class="dlg" style="width:460px">
|
||||
<h4>正在打开项目</h4>
|
||||
<div class="mbody" style="gap:12px">
|
||||
<div id="ldname" style="font-size:14px;font-weight:600;color:var(--c1);word-break:break-all;min-height:18px"></div>
|
||||
<div style="height:8px;border-radius:5px;background:#e6edf5;overflow:hidden">
|
||||
<div id="ldbar" style="height:100%;width:0;border-radius:5px;transition:width .35s ease;background:linear-gradient(90deg,var(--c1),var(--c2))"></div>
|
||||
</div>
|
||||
<div id="ldtext" style="font-size:12.5px;color:#5a6b7f">准备中…</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 加载进度遮罩已升入共享层(2026-10-13):common.js 懒注入 #ldmask,三页同一份。
|
||||
本页 ldShow/ldPct/ldCreep/ldHide 调用零改动(共享层同名同义接管)。 -->
|
||||
|
||||
<div class="mask" id="inqmask">
|
||||
<div class="dlg" style="width:min(880px,94vw)">
|
||||
@@ -465,7 +461,7 @@ body.grptree-dragging{cursor:col-resize !important;user-select:none}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="common.js?v=20261012a"></script>
|
||||
<script src="common.js?v=20261013c"></script>
|
||||
<script src="period.js"></script>
|
||||
<script>
|
||||
let SID=0, CUR=null, CURTYPE='lme', HROWS=[];
|
||||
@@ -490,10 +486,10 @@ function ym(s){const m=/^(\d{4})-(\d{1,2})$/.exec((s||'').trim());return m?(+m[1
|
||||
// 后端 BILLROW() 的数组下标与 common.js 的 COLS.bill 一一对应,改列序必须两处同步。
|
||||
const C_LME = COLS.lme;
|
||||
const C_BILL = COLS.bill;
|
||||
/* 工作台专属:工料机主表在「备注」左边加一列「取消采纳」(2026-10-09 主人定)。
|
||||
'ns'=纯展示列不可排序(sortHeadHTML 支持);数据位不变(r[10]=备注),显示位 9=取消采纳、10=备注。
|
||||
后台批次表不挂这一列(renderLme 的 lmeExtra 钩子只在 WB_OPTS 里给)。 */
|
||||
const C_LME_WB = COLS.lme.slice(0, 9).concat([['取消采纳', 76, 'c', 'F', 'ns']], COLS.lme.slice(9));
|
||||
/* 工料机列 = 共享层 COLS.lme 全量(含「取消采纳」列,2026-10-13 主人定:该列**工作台独有**,
|
||||
在共享层打 wb 标记、后台经 noWB() 派生剔除 → 后台 10 列;原本页插列 + renderLme 的
|
||||
lmeExtra 钩子已退役)。数据位不变(r[10]=备注),显示位 9=取消采纳('ns' 不可排序)、10=备注。 */
|
||||
const C_LME_WB = COLS.lme;
|
||||
// 期次 76→96 且改左对齐:区间型「2026-07~2026-09」15 字符 ≈108px,76px 必撑破;
|
||||
// 左对齐让数字串更好扫读,截断位置也比居中自然(居中时末尾的 … 看着像没对齐)。
|
||||
// 2026-10-08 主人定:①首列=± 展开把手(同「类似清单」,带 bill_id 的历史清单行可展开定额);
|
||||
@@ -570,13 +566,16 @@ function syncHist(p){
|
||||
// 折叠状态不跨标签共享(主人 10-08:切到项目工料机「缺容器框」= 在别的标签收过没展开)
|
||||
if(!w.classList.contains('rawmode') && w.classList.contains('folded')) toggleFold();
|
||||
}
|
||||
function tab(p){
|
||||
async function tab(p){
|
||||
document.querySelectorAll('.tab').forEach(t=>t.classList.toggle('on',t.dataset.p===p));
|
||||
['p0','p1','p2','p3'].forEach((x,i)=>$('pan'+i).classList.toggle('on',x===p));
|
||||
syncHist(p);
|
||||
if(p==='p1') loadGroups('inconsistent');
|
||||
if(p==='p2') loadGroups('similar');
|
||||
if(p==='p3') loadRaw();
|
||||
// 2026-10-13 主人定:切标签没展开全部数据前要有进度条 —— 三个取数标签都包 ldWrap
|
||||
//(快工程 150ms 内出完数据不闪遮罩;南屏这类大工程显示遮罩+阶段文案直到渲染完)。
|
||||
// 外层已有进度(打开工程/切会话)时 ldWrap 只更新阶段文案、不接管收尾。
|
||||
if(p==='p1') await ldWrap('','正在加载组价不一致清单…',()=>loadGroups('inconsistent'));
|
||||
if(p==='p2') await ldWrap('','正在加载类似清单(分组计算,工程大要稍等)…',()=>loadGroups('similar'));
|
||||
if(p==='p3') await ldWrap('','正在加载原数据…',()=>loadRaw());
|
||||
// 项目工料机撑满容器:渲染时面板可能还藏着(clientWidth=0 算不准),面板显出来再贴一次
|
||||
if(p==='p0'){ const t0=$('t0'); if(t0 && t0._cols) flexFit(t0, t0._cols); }
|
||||
try{ localStorage.setItem('wb_tab', p); }catch(e){} // 记住停留的标签(切页回来接着看)
|
||||
@@ -619,21 +618,27 @@ async function doOpen(){
|
||||
const pv=PVAL($('oper'));
|
||||
if(pv.f==null||pv.t==null){ $('omsg').textContent='基准期次必填:点开选起~止(同一个月就选同一个)'; return; }
|
||||
$('omsg').textContent='正在上传并解析…';
|
||||
// 2026-10-13 主人定:打开工程的全程(上传→解析→首屏)挂进度条,工程名+阶段可见
|
||||
ldShow($('oname').value||f.name,'正在上传工程文件…',6);
|
||||
ldCreep(8,80,'正在解析工程文件…(工程大要等一会)');
|
||||
const up=await uploadFile('/api/admin/upload', f);
|
||||
if(!up.ok){ $('omsg').textContent=up.msg; return; }
|
||||
const r=await J('/api/audit',{method:'POST',headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify({path:up.path,name:$('oname').value||f.name,
|
||||
if(!up.ok){ ldHide(); $('omsg').textContent=up.msg; return; }
|
||||
try{
|
||||
const r=await J('/api/audit',{method:'POST',headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify({path:up.path,name:$('oname').value||f.name,
|
||||
period_from:pv.f, period_to:pv.t, base_period_m:pv.f,
|
||||
province:$('oprov').value,city:$('ocity').value,district:$('odist').value,
|
||||
bulid_unit:$('obuid').value})});
|
||||
if(!r.ok){ $('omsg').textContent=r.msg; return; }
|
||||
SID=r.session_id;
|
||||
try{ localStorage.setItem('wb_sid', SID); }catch(e){} // 记住上次审核的会话(切页回来恢复用)
|
||||
loadAdopt(); // 决策 28:徽章随会话切(新会话=空目录)
|
||||
$('sinfo').innerHTML=`<b>${esc($('oname').value||f.name)}</b>`; // 2026-10-10 主人定:只留名称(基准/条数尾串取消)
|
||||
$('omask').classList.remove('on');
|
||||
await loadLme(); tab('p3'); // 2026-09-30:打开后先看「原数据」
|
||||
$('msg').textContent=r.msg;
|
||||
if(!r.ok){ $('omsg').textContent=r.msg; return; }
|
||||
SID=r.session_id;
|
||||
try{ localStorage.setItem('wb_sid', SID); }catch(e){} // 记住上次审核的会话(切页回来恢复用)
|
||||
loadAdopt(); // 决策 28:徽章随会话切(新会话=空目录)
|
||||
$('sinfo').innerHTML=`<b>${esc($('oname').value||f.name)}</b>`; // 2026-10-10 主人定:只留名称(基准/条数尾串取消)
|
||||
$('omask').classList.remove('on');
|
||||
ldStage(86,'正在加载清单与原数据…');
|
||||
await loadLme(); await tab('p3'); // 2026-09-30:打开后先看「原数据」
|
||||
$('msg').textContent=r.msg;
|
||||
} finally { ldHide(); }
|
||||
}
|
||||
|
||||
/* ---------- 询价附件(2026-10-09 改版;2026-10-10 决策 28 改**会话级** 主人定)----------
|
||||
@@ -754,14 +759,12 @@ async function loadLme(){
|
||||
}
|
||||
// billTR / grpTR / grpTitle / tgGrp / tgNorm / CB_TOTAL / CB_LAST / fmtAttr 全部由 common.js 提供
|
||||
// (前后台唯一来源)。本页只负责「取哪个接口的数据」,渲染一律走公共层。
|
||||
const WB_OPTS = { rowClick: 'pick', normApi: '/api/session/bill/',
|
||||
/* 「取消采纳」列(备注左边,主人定):有采纳备注的行给按钮,其余占位 —。
|
||||
r[0]=s_lmes.id;点击=清备注+把它收进的附件移出「询价附件」目录。 */
|
||||
lmeExtra: (r) => /^采纳:/.test(r[10] || '')
|
||||
? `<td class="c"><a class="lk" onclick="cancelAdopt(${r[0]})" title="清空本行采纳备注;其收进的附件同时移出「询价附件」目录">取消采纳</a></td>`
|
||||
: '<td class="c" style="color:#b9c4d2">—</td>' };
|
||||
async function loadGroups(kind){
|
||||
const d=await J(`/api/session/${kind}?session_id=${SID}`);
|
||||
const WB_OPTS = { rowClick: 'pick', normApi: '/api/session/bill/'
|
||||
/* 「取消采纳」列已由 common.js 统一渲染(lmeAdoptCellHTML,2026-10-13 收编):
|
||||
有采纳备注的行给链接、其余灰 —,本页提供 cancelAdopt(id) 全局函数供其调用。 */ };
|
||||
async function loadGroups(kind, fresh){
|
||||
// fresh=true(⟳ 重载按钮,决策 46):服务端跳过缓存强制重算,算完回填缓存
|
||||
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+' 组';
|
||||
const el = kind==='inconsistent' ? ['cg1','th1','tb1'] : ['cg2','th2','tb2'];
|
||||
@@ -777,6 +780,12 @@ async function loadGroups(kind){
|
||||
if(kind==='similar') grpTreeBind($('grptree'), 'tb2', d);
|
||||
}
|
||||
|
||||
/* ⟳ 重载(决策 46):跳过服务端缓存,按当前数据与分组规则强制重新分组 */
|
||||
function reloadSim(){
|
||||
ldWrap('', '正在重新分组(不用缓存,工程大要稍等)…', ()=>loadGroups('similar', true))
|
||||
.then(()=>{ $('msg').textContent='已按当前数据与分组规则重新分组'; });
|
||||
}
|
||||
|
||||
// 清单首列「+」→ 展开其下定额:由 common.js 提供(读全局 WB_OPTS.normApi)。
|
||||
// 本页不再各写一份 —— 后台共用同一实现,只是 WB_OPTS.normApi 指向 /api/admin/bill/
|
||||
|
||||
@@ -1131,7 +1140,7 @@ async function adoptLme(i){
|
||||
if(!r || !r.ok){ dlMsg('备注写入失败:'+(r&&r.msg?r.msg:'服务未响应'),'err'); return; }
|
||||
const row=(LME_ROWS||[]).find(y=>y[0]===CUR.id); // 数据先行:排序/重画后备注与取消采纳不丢
|
||||
if(row){ row[10]=txt;
|
||||
// 就地更新两格(不整表重画——重画会丢 tr.sel 选中态);lmeExtra 的口径=备注以「采纳:」开头
|
||||
// 就地更新两格(不整表重画——重画会丢 tr.sel 选中态);取消采纳格口径=备注以「采纳:」开头(lmeAdoptCellHTML)
|
||||
const tr0=document.querySelector(`#tb0 tr[data-id="${CUR.id}"]`);
|
||||
const c9=tr0&&tr0.children[9], c10=tr0&&tr0.children[10];
|
||||
if(c10){ c10.textContent=txt; c10.title=txt; }
|
||||
@@ -1226,7 +1235,7 @@ async function recOpen(sid,keep){
|
||||
loadAdopt(); // 决策 28:切会话=切附件目录(该会话上次收的还在)
|
||||
$('sinfo').innerHTML=`<b>${esc(m.name||'')}</b>`; // 2026-10-10 主人定:只留名称(基准/条数尾串取消)
|
||||
if(!keep) closePops();
|
||||
await loadLme(); tab((document.querySelector('.tab.on')||{dataset:{p:'p0'}}).dataset.p);
|
||||
await loadLme(); await tab((document.querySelector('.tab.on')||{dataset:{p:'p0'}}).dataset.p);
|
||||
$('msg').textContent='已切到该会话';
|
||||
}
|
||||
document.addEventListener('mousedown', e=>{
|
||||
@@ -1586,30 +1595,10 @@ async function initFilters(){
|
||||
initFilters();
|
||||
loadAdopt(); // 顶栏「询价附件」常驻按钮:进页面先取一次(此时无会话=空);打开/切会话由 doOpen/recOpen 再取
|
||||
|
||||
/* ---------- 加载进度条(2026-10-11 主人定:点「打开」要有正在加载的感觉)----------
|
||||
ldShow(项目名, 阶段文案, 起始%) → ldPct 推进 → ldCreep 在服务端长活(重解析)期间
|
||||
缓慢爬升占位 → ldHide 收尾。LD_T 是爬升计时器,换阶段/收尾都要清。 */
|
||||
let LD_T=0;
|
||||
function ldShow(name,text,pct){
|
||||
$('ldname').textContent = name ? ('《'+name+'》') : '';
|
||||
$('ldmask').classList.add('on');
|
||||
ldPct(pct,text);
|
||||
}
|
||||
function ldPct(p,text){
|
||||
if(text!=null) $('ldtext').textContent=text;
|
||||
$('ldbar').style.width=Math.max(0,Math.min(100,p))+'%';
|
||||
}
|
||||
function ldCreep(from,to,text){
|
||||
ldPct(from,text);
|
||||
clearInterval(LD_T);
|
||||
let p=from;
|
||||
LD_T=setInterval(()=>{ p+=0.5; if(p<to) ldPct(p); },300);
|
||||
}
|
||||
function ldHide(){
|
||||
clearInterval(LD_T);
|
||||
ldPct(100,'完成');
|
||||
setTimeout(()=>{ $('ldmask').classList.remove('on'); ldPct(0,'准备中…'); },280);
|
||||
}
|
||||
/* ---------- 加载进度条(2026-10-13 升入共享层)----------
|
||||
ldShow/ldPct/ldCreep/ldHide(及 ldWrap/ldStage)由 common.js 提供(三页同一份),
|
||||
本页 initFromUrl 的既有调用零改动;「打开工程」doOpen 也改走 ldWrap(原来只有弹框内一行字,
|
||||
解析大工程时整页无加载感)。 */
|
||||
|
||||
/* 从会话管理页 /workbench.html?sid=N 直接打开某个会话(management 页「打开」用)。
|
||||
2026-10-07 主人报「从后台/最近审核切回工作台,原数据消失」:URL 没有 sid 时,
|
||||
@@ -1650,7 +1639,7 @@ async function initFromUrl(){
|
||||
}
|
||||
ldPct(86,'正在加载清单、分组与工料机…');
|
||||
await recOpen(sid, true);
|
||||
if(['p0','p1','p2','p3'].includes(savedTab) && savedTab !== 'p3') tab(savedTab);
|
||||
if(['p0','p1','p2','p3'].includes(savedTab) && savedTab !== 'p3') await tab(savedTab);
|
||||
} finally { ldHide(); }
|
||||
if(!fromUrl) $('msg').textContent = '已恢复上次审核:《' +
|
||||
(($('sinfo').querySelector('b')||{}).textContent || '') + '》(「最近审核」页可切换其他工程)';
|
||||
|
||||
Reference in New Issue
Block a user