refactor(cost): 优化LME成员去重与措施清单标签还原,清理临时核查脚本
This commit is contained in:
@@ -323,7 +323,7 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
margin-bottom:5px(2026-11-02 主人定)—— 距蓝色线条的间距按工作台口径统一 5px,
|
||||
也免得看起来像第四个标签。 -->
|
||||
<button class="btn" id="btnFrames" style="margin-left:auto;margin-bottom:5px;height:28px;padding:0 12px;display:inline-flex;align-items:center;justify-content:center;line-height:1" onclick="openFrames()"
|
||||
title="导出设置:管理各格式导出文件数据结构">导出设置</button>
|
||||
title="设置:导出文件数据结构库(导出)与工料机导出配置">设置</button>
|
||||
<button class="btn" id="btnDict" style="margin-bottom:5px;height:28px;padding:0 12px;display:inline-flex;align-items:center;justify-content:center;line-height:1" onclick="openDict()"
|
||||
title="字典设置:地区 / 询价单位 / 发布单位 / 建设单位 下拉选项 + 上传大小上限">⚙ 字典</button>
|
||||
<!-- 工作台入口(2026-10-06 主人定):从标题行右上角搬到标签栏,排在「设置」右边。
|
||||
@@ -677,23 +677,57 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
阶段二(上市版)切「骨架包升级分发」时本弹框撤添加钮、客户端静默接收(决策台账 257)。 -->
|
||||
<div class="mask" id="fmask">
|
||||
<div class="dlg" style="width:min(760px,94vw)">
|
||||
<div class="dh"><b>导出设置</b><span class="close" onclick="closeFrames()">×</span></div>
|
||||
<div style="padding:14px 16px;display:flex;flex-direction:column;gap:10px">
|
||||
<div style="display:flex;justify-content:flex-end">
|
||||
<button class="btn pri" onclick="framesAdd()" title="选择 .cos / .cos4 原件或骨架包(zip 内含 cos 族件),入库后自动按后缀归类">添加</button>
|
||||
<input type="file" id="ffile" style="display:none" onchange="framesSeed(this)">
|
||||
<div class="dh"><b>设置</b><span class="close" onclick="closeFrames()">×</span></div>
|
||||
<div style="padding:10px 16px 0">
|
||||
<div class="tabs">
|
||||
<div class="dtab on" id="ftabExp" onclick="ftabSet('exp')">导出</div>
|
||||
<div class="dtab" id="ftabLme" onclick="ftabSet('lme')">工料机</div>
|
||||
<button class="btn pri" style="margin-left:auto;height:24px;padding:0 16px" onclick="fsetAdd()"
|
||||
title="导出卡:选 .cos / .cos4 原件或骨架包入库;工料机卡:列设置(自定义列增删改/排序)">添加</button>
|
||||
</div>
|
||||
<div class="tw" style="max-height:52vh">
|
||||
<table><colgroup><col style="width:56px"><col style="width:110px"><col style="width:110px"><col></colgroup>
|
||||
<thead><tr><th class="c">#</th><th>后缀</th><th>上传日期</th><th>导出文件数据结构</th></tr></thead>
|
||||
<tbody id="frameBody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div style="padding:14px 16px;display:flex;flex-direction:column;gap:10px">
|
||||
<div id="fpaneExp">
|
||||
<div style="display:flex;justify-content:flex-end">
|
||||
<button class="btn pri" onclick="framesAdd()" title="选择 .cos / .cos4 原件或骨架包(zip 内含 cos 族件),入库后自动按后缀归类">添加</button>
|
||||
<input type="file" id="ffile" style="display:none" onchange="framesSeed(this)">
|
||||
</div>
|
||||
<div class="tw" style="max-height:52vh">
|
||||
<table><colgroup><col style="width:56px"><col style="width:110px"><col style="width:110px"><col></colgroup>
|
||||
<thead><tr><th class="c">#</th><th>后缀</th><th>上传日期</th><th>导出文件数据结构</th></tr></thead>
|
||||
<tbody id="frameBody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div id="fpaneLme" style="display:none">
|
||||
<div class="tw" style="max-height:52vh">
|
||||
<table><colgroup><col style="width:56px"><col></colgroup>
|
||||
<thead><tr id="lmeSetHead"></tr></thead>
|
||||
<tbody id="lmeSetBody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="tip" style="padding:0">行数=导出卡后缀列去重数(cos4 算一行);起点由软件商或租户填写</div>
|
||||
</div>
|
||||
<div class="tip" id="fmsg" style="padding:0;min-height:18px"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ===== 列设置弹框(2026-11-04 主人定:序号|名称|值|操作;值=复选框;操作=上移/下移/插/删) ===== -->
|
||||
<div class="mask" id="colmask">
|
||||
<div class="dlg" style="width:min(520px,92vw)">
|
||||
<div class="dh"><b>列设置(工料机)</b><span class="close" onclick="closeColSet()">×</span></div>
|
||||
<div style="padding:14px 16px;display:flex;flex-direction:column;gap:10px">
|
||||
<div class="tw" style="max-height:46vh">
|
||||
<table><colgroup><col style="width:56px"><col><col style="width:64px"><col style="width:130px"></colgroup>
|
||||
<thead><tr><th class="c">序号</th><th>名称</th><th class="c">值</th><th class="c">操作</th></tr></thead>
|
||||
<tbody id="colBody"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ===== 询价附件(2026-10-21 决策 152 主人定:左=附件目录树(根目录「附件目录」,上传/删除挂根行右侧);
|
||||
右=项目工料机/类似清单 双页签 + 行最右搜索框;两类都可绑附件,工作台对比框可下载) ===== -->
|
||||
|
||||
@@ -2515,8 +2549,231 @@ let FRAMES = [];
|
||||
async function openFrames(){
|
||||
$('fmask').classList.add('on');
|
||||
$('fmsg').textContent='';
|
||||
ftabSet('exp');
|
||||
await framesLoad();
|
||||
}
|
||||
/* ---- 设置弹框标签卡 + 工料机卡 + 列设置(2026-11-04 主人定)---- */
|
||||
function ftabSet(which){
|
||||
const exp = which === 'exp';
|
||||
$('ftabExp').classList.toggle('on', exp);
|
||||
$('ftabLme').classList.toggle('on', !exp);
|
||||
$('fpaneExp').style.display = exp ? '' : 'none';
|
||||
$('fpaneLme').style.display = exp ? 'none' : '';
|
||||
if(!exp) lmeSetRender();
|
||||
}
|
||||
function fsetAdd(){ // 共用「添加」:导出卡=选文件入库;工料机卡=列设置
|
||||
const exp = $('fpaneExp').style.display !== 'none';
|
||||
if(exp) framesAdd(); else openColSet();
|
||||
}
|
||||
function escLme(v){ return String(v==null?'':v).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"'); }
|
||||
function colSetLoad(){ // 自定义列清单(localStorage 持久;损坏回空)
|
||||
try{ const v = JSON.parse(localStorage.getItem('lme_colset')||'null');
|
||||
if(Array.isArray(v) && v.every(c => c && c.key && 'name' in c))
|
||||
return v; }catch(e){}
|
||||
return [];
|
||||
}
|
||||
function colSetSave(cs){ try{ localStorage.setItem('lme_colset', JSON.stringify(cs)); }catch(e){} }
|
||||
function lmeStartGet(key, sfx){ try{ return localStorage.getItem('lme_start_'+key+'_'+sfx)||''; }catch(e){ return ''; } }
|
||||
function lmeStartSet(key, sfx, v){ try{ localStorage.setItem('lme_start_'+key+'_'+sfx, v); }catch(e){} }
|
||||
function lmeSetRender(){ // 工料机卡:# /后缀 /起点 固定最前 + 自定义勾选列按序
|
||||
const suffixes = [];
|
||||
(FRAMES||[]).forEach(r => { if(!suffixes.includes(r.suffix)) suffixes.push(r.suffix); });
|
||||
const cols = colSetLoad().filter(c => c.on);
|
||||
$('lmeSetHead').innerHTML = '<th class="c" style="width:56px">#</th><th>后缀</th><th>起点</th>'
|
||||
+ cols.map(c => '<th>' + escLme(c.name) + '</th>').join('');
|
||||
let html = '';
|
||||
suffixes.forEach((sfx, i) => {
|
||||
html += '<tr><td class="c">' + (i+1) + '</td><td>' + escLme(sfx) + '</td>'
|
||||
+ lmeCell('start', sfx)
|
||||
+ cols.map(c => lmeCell(c.key, sfx, true)).join('')
|
||||
+ '</tr>';
|
||||
});
|
||||
$('lmeSetBody').innerHTML = html
|
||||
|| '<tr><td colspan="9" class="c" style="color:#888">还没有骨架:先在「导出」卡添加,后缀会带到这里</td></tr>';
|
||||
}
|
||||
/* 单元格(2026-11-04 主人定):常显值文本(自定义列带圆形「代」按钮=haobtn 同款);
|
||||
双击进入行内编辑——编辑框布满单元格、与单元格边线偏差≤2px(决策 174 通用设计);
|
||||
代按钮占位不算编辑区(点击它不开编辑)。 */
|
||||
function lmeCell(key, sfx, dai){
|
||||
const val = escLme(lmeStartGet(key, sfx));
|
||||
return '<td class="lmetd" data-key="' + escLme(key) + '" data-sfx="' + escLme(sfx) + '"'
|
||||
+ ' ondblclick="lmeCellEdit(this)" title="双击编辑">'
|
||||
+ '<span class="lmeval">' + val + '</span>'
|
||||
+ (dai ? '<span class="haobtn" title="代号清单:插行/删行,点行代入"'
|
||||
+ ' onclick="event.stopPropagation();daiPop(this,\'' + escLme(key) + '\',\'' + escLme(sfx) + '\')">代</span>' : '')
|
||||
+ '</td>';
|
||||
}
|
||||
function lmeCellEdit(td){
|
||||
if(td.querySelector('input')) return;
|
||||
const key = td.dataset.key, sfx = td.dataset.sfx;
|
||||
const old = lmeStartGet(key, sfx);
|
||||
td.style.position = 'relative';
|
||||
const inp = document.createElement('input');
|
||||
inp.type = 'text'; inp.value = old;
|
||||
inp.style.cssText = 'position:absolute;left:1px;top:1px;right:1px;bottom:1px;width:calc(100% - 2px);'
|
||||
+ 'height:calc(100% - 2px);border:1px solid var(--c2);padding:0 3px;box-sizing:border-box;font-size:12px;z-index:5';
|
||||
td.appendChild(inp);
|
||||
inp.focus(); inp.select();
|
||||
let done = false;
|
||||
const finish = save => {
|
||||
if(done) return; done = true;
|
||||
if(save && inp.value !== old) lmeStartSet(key, sfx, inp.value);
|
||||
lmeSetRender();
|
||||
};
|
||||
inp.onkeydown = e => { if(e.key === 'Enter') finish(true); if(e.key === 'Escape') finish(false); };
|
||||
inp.onblur = () => finish(true);
|
||||
}
|
||||
/* ---- 「代」按钮浮层:该列的代号清单(字段=序号|代号;可插行/删行;点行代入本格)---- */
|
||||
function daiGet(key, sfx){
|
||||
try{ const v = JSON.parse(localStorage.getItem('lme_dai_' + key + '_' + sfx) || 'null');
|
||||
return Array.isArray(v) ? v : []; }catch(e){ return []; }
|
||||
}
|
||||
function daiSet(key, sfx, arr){ try{ localStorage.setItem('lme_dai_' + key + '_' + sfx, JSON.stringify(arr)); }catch(e){} }
|
||||
let DAI_POP = null;
|
||||
function daiClose(){ if(DAI_POP){ DAI_POP.remove(); DAI_POP = null; } }
|
||||
function daiPop(btn, key, sfx){
|
||||
daiClose();
|
||||
const list = daiGet(key, sfx);
|
||||
const p = document.createElement('div');
|
||||
p.className = 'haopop';
|
||||
p.style.cssText = 'width:230px;padding:8px';
|
||||
p.innerHTML = '<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:6px">'
|
||||
+ '<b style="color:#123a6b;font-size:12px">代号清单</b>'
|
||||
+ '<a href="javascript:daiAdd(\'' + escLme(key) + '\',\'' + escLme(sfx) + '\')" style="color:#26405e">+插行</a></div>'
|
||||
+ '<table style="width:100%"><thead><tr>'
|
||||
+ '<th class="c" style="width:44px">序号</th><th>代号</th><th style="width:44px"></th></tr></thead><tbody>'
|
||||
+ (list.length ? list.map((d, i) =>
|
||||
'<tr><td class="c">' + (i+1) + '</td>'
|
||||
+ '<td><input type="text" value="' + escLme(d) + '" style="width:100%;border:1px solid #c9d4e2;padding:1px 4px"'
|
||||
+ ' onchange="daiRename(\'' + escLme(key) + '\',\'' + escLme(sfx) + '\',' + i + ',this.value)"></td>'
|
||||
+ '<td class="c"><a href="javascript:daiPick(\'' + escLme(key) + '\',\'' + escLme(sfx) + '\',' + i + ')"'
|
||||
+ ' style="color:#26405e" title="代入本格">代</a> '
|
||||
+ '<a href="javascript:daiDel(\'' + escLme(key) + '\',\'' + escLme(sfx) + '\',' + i + ')" style="color:#c0392b">×</a></td></tr>').join('')
|
||||
: '<tr><td colspan="3" class="c" style="color:#888">空——点右上「+插行」加代号</td></tr>')
|
||||
+ '</tbody></table>';
|
||||
document.body.appendChild(p);
|
||||
const rc = btn.getBoundingClientRect();
|
||||
p.style.left = Math.max(4, Math.min(rc.left, window.innerWidth - 244)) + 'px';
|
||||
p.style.top = Math.min(rc.bottom + 4, window.innerHeight - 160) + 'px';
|
||||
DAI_POP = p;
|
||||
setTimeout(() => document.addEventListener('mousedown', daiOutside, true), 0);
|
||||
}
|
||||
function daiOutside(e){
|
||||
if(DAI_POP && !DAI_POP.contains(e.target)) { daiClose();
|
||||
document.removeEventListener('mousedown', daiOutside, true); }
|
||||
}
|
||||
function daiAdd(key, sfx){
|
||||
const a = daiGet(key, sfx); a.push(''); daiSet(key, sfx, a);
|
||||
const btn = document.querySelector('.haobtn[title*="代号清单"]');
|
||||
daiClose();
|
||||
if(btn) daiPop(btn, key, sfx);
|
||||
}
|
||||
function daiRename(key, sfx, i, v){
|
||||
const a = daiGet(key, sfx); a[i] = v; daiSet(key, sfx, a);
|
||||
}
|
||||
function daiPick(key, sfx, i){
|
||||
const a = daiGet(key, sfx);
|
||||
if(a[i] === '' ) { $('fmsg').textContent = '代号是空的,先填内容'; return; }
|
||||
lmeStartSet(key, sfx, a[i]);
|
||||
daiClose();
|
||||
lmeSetRender();
|
||||
$('fmsg').textContent = '已代入:' + a[i];
|
||||
}
|
||||
function daiDel(key, sfx, i){
|
||||
const a = daiGet(key, sfx); a.splice(i, 1); daiSet(key, sfx, a);
|
||||
const btn = document.querySelector('.haobtn[title*="代号清单"]');
|
||||
daiClose();
|
||||
if(btn) daiPop(btn, key, sfx);
|
||||
}
|
||||
/* ---- 列设置弹框(2026-11-04 主人定 v2:无确定/取消=即时保存;插=往后面一行插入;
|
||||
# /后缀/起点 固定最前、不进列设置——这里只管自定义列;新建时固定送一行空列;
|
||||
自定义列有值不可删、无值才可删。---- */
|
||||
function openColSet(){
|
||||
const cs = colSetLoad();
|
||||
if(cs.length === 0){ // 新建时固定有一行(空列占位)
|
||||
cs.push({ key: 'c' + Date.now(), name: '', on: true });
|
||||
colSetSave(cs);
|
||||
}
|
||||
colRender();
|
||||
$('colmask').classList.add('on');
|
||||
}
|
||||
function closeColSet(){ $('colmask').classList.remove('on'); }
|
||||
colmask.onclick = e => { if(e.target===colmask) closeColSet() };
|
||||
function colSaveRender(){ // 每次改动即时落存+两处同步刷新
|
||||
colRender();
|
||||
lmeSetRender();
|
||||
}
|
||||
function colRender(){
|
||||
const cs = colSetLoad();
|
||||
$('colBody').innerHTML = cs.map((c, i) =>
|
||||
'<tr><td class="c">' + (i+1) + '</td>'
|
||||
+ '<td class="colnm" data-i="' + i + '" ondblclick="colNameEdit(this)" title="双击编辑列名">'
|
||||
+ '<span class="lmeval">' + escLme(c.name) + '</span></td>'
|
||||
+ '<td class="c"><input type="checkbox" ' + (c.on?'checked':'') + ' onchange="colToggle(' + i + ',this.checked)"></td>'
|
||||
+ '<td class="c">'
|
||||
+ '<a href="javascript:colMove(' + i + ',-1)" style="color:#26405e">↑</a> '
|
||||
+ '<a href="javascript:colMove(' + i + ',1)" style="color:#26405e">↓</a> '
|
||||
+ '<a href="javascript:colInsert(' + i + ')" style="color:#26405e" title="往后面一行插入新列">插</a> '
|
||||
+ '<a href="javascript:colDel(' + i + ')" style="color:#c0392b">×</a>'
|
||||
+ '</td></tr>').join('');
|
||||
}
|
||||
function colNameEdit(td){ // 列名:双击编辑(决策174 布满单元格)
|
||||
if(td.querySelector('input')) return;
|
||||
const i = +td.dataset.i;
|
||||
const cs = colSetLoad();
|
||||
const old = cs[i].name;
|
||||
td.style.position = 'relative';
|
||||
const inp = document.createElement('input');
|
||||
inp.type = 'text'; inp.value = old;
|
||||
inp.style.cssText = 'position:absolute;left:1px;top:1px;right:1px;bottom:1px;width:calc(100% - 2px);'
|
||||
+ 'height:calc(100% - 2px);border:1px solid var(--c2);padding:0 3px;box-sizing:border-box;font-size:12px;z-index:5';
|
||||
td.appendChild(inp);
|
||||
inp.focus(); inp.select();
|
||||
let done = false;
|
||||
const finish = save => {
|
||||
if(done) return; done = true;
|
||||
if(save && inp.value !== old){ cs[i].name = inp.value; colSetSave(cs); }
|
||||
colSaveRender();
|
||||
};
|
||||
inp.onkeydown = e => { if(e.key === 'Enter') finish(true); if(e.key === 'Escape') finish(false); };
|
||||
inp.onblur = () => finish(true);
|
||||
}
|
||||
function colRename(i, v){
|
||||
const cs = colSetLoad(); cs[i].name = v; colSetSave(cs);
|
||||
colSaveRender();
|
||||
}
|
||||
function colToggle(i, on){
|
||||
const cs = colSetLoad(); cs[i].on = on; colSetSave(cs);
|
||||
colSaveRender();
|
||||
}
|
||||
function colMove(i, d){
|
||||
const cs = colSetLoad();
|
||||
const j = i + d;
|
||||
if(j < 0 || j >= cs.length) return;
|
||||
const t = cs[i]; cs[i] = cs[j]; cs[j] = t;
|
||||
colSetSave(cs);
|
||||
colSaveRender();
|
||||
}
|
||||
function colInsert(i){
|
||||
const cs = colSetLoad();
|
||||
cs.splice(i + 1, 0, { key: 'c' + Date.now(), name: '', on: true }); // 往后面一行插入
|
||||
colSetSave(cs);
|
||||
colSaveRender();
|
||||
}
|
||||
function colHasValue(i){ // 该列在所有后缀行上是否有值
|
||||
const cs = colSetLoad();
|
||||
const key = cs[i] ? cs[i].key : null;
|
||||
const suffixes = [];
|
||||
(FRAMES||[]).forEach(r => { if(!suffixes.includes(r.suffix)) suffixes.push(r.suffix); });
|
||||
return suffixes.some(sfx => lmeStartGet(key, sfx) !== '');
|
||||
}
|
||||
function colDel(i){
|
||||
if(colHasValue(i)) { $('fmsg').textContent = '该列已有值,不能删除'; return; }
|
||||
const cs = colSetLoad();
|
||||
cs.splice(i, 1);
|
||||
colSetSave(cs);
|
||||
colSaveRender();
|
||||
}
|
||||
function closeFrames(){ $('fmask').classList.remove('on'); }
|
||||
fmask.onclick = e => { if(e.target===fmask) closeFrames() };
|
||||
|
||||
@@ -2571,6 +2828,11 @@ function framesExportAnnotated(sig){
|
||||
framesSaveFile(sig, r.original_name || '骨架', '空骨架(标注)', r.suffix || 'cos4');
|
||||
}
|
||||
|
||||
/* 工料机卡单元格(2026-11-04):值+圆形代按钮;双击编辑(决策174 布满) */
|
||||
.lmetd{position:relative;cursor:default;min-width:90px}
|
||||
.lmetd .lmeval{white-space:pre-wrap}
|
||||
.lmetd .haobtn{float:right;margin-left:6px}
|
||||
.colnm{position:relative;cursor:default;min-width:110px}
|
||||
/* 统一另存为(2026-11-03 主人定「导出一律另存为方式」):
|
||||
showSaveFilePicker 弹系统保存对话框,用户选路径后写入。
|
||||
kind='空骨架(标注)' → /api/admin/frames/blankpkg/{sig}(原格式空骨架+自增/固定标注,后缀跟骨架);
|
||||
|
||||
@@ -2119,9 +2119,11 @@ function haoRes(tg) {
|
||||
return;
|
||||
}
|
||||
const base = (typeof RVO.lmeApi === 'function') ? RVO.lmeApi() : RVO.lmeApi;
|
||||
// 2026-11-04:先占位再取数——此前 open 标记在 then 里才置位,fetch 期间连点「+」会插两套
|
||||
tr.dataset.open = '1'; tg.textContent = '−';
|
||||
fetch(base + '&code=' + encodeURIComponent(tg.dataset.code)).then(r => r.json()).then(d => {
|
||||
if (tr.dataset.open !== '1') return; // 期间被收起:丢弃迟到响应
|
||||
const rows = (d && d.rows) || [];
|
||||
tr.dataset.open = '1'; tg.textContent = '−';
|
||||
const frag = document.createElement('tbody');
|
||||
// 决策 188:子级行挂 data-pcode/data-ccode + 标题提示(工作台侧单击可编辑 含量/除税/含税)
|
||||
frag.innerHTML = rows.length
|
||||
@@ -2137,6 +2139,8 @@ function haoRes(tg) {
|
||||
let nx = tr.nextElementSibling;
|
||||
while (nx && nx.classList.contains('resk')) nx = nx.nextElementSibling;
|
||||
while (frag.firstChild) tr.parentNode.insertBefore(frag.firstChild, nx);
|
||||
}).catch(() => { // 取数失败:回退成未展开,别卡成假「−」
|
||||
if (tr.dataset.open === '1') { tr.dataset.open = '0'; tg.textContent = '+'; }
|
||||
});
|
||||
}
|
||||
/* ---- 树 / 内容 分隔条(2026-10-07,主人要求)----
|
||||
|
||||
Reference in New Issue
Block a user