feat(mcp): 新增 Excel 批量清单匹配工具并调整分页与采纳锚策略
This commit is contained in:
@@ -14,7 +14,7 @@ body{font-family:"Source Han Sans SC","Noto Sans SC","Source Han Sans CN","MiSan
|
||||
用固定 height + flex 居中,而不是 padding —— 高度不再随字号 / 行高浮动,调一处就准。
|
||||
align-items:flex-end —— 右侧「设置 / 工作台」两个按钮底部与标签对齐、保持自身自然高度(≈29px),
|
||||
比标签矮 3px,一眼能分清「标签」和「按钮」,不用再靠 margin-bottom 人为错开。 */
|
||||
.tabs{display:flex;align-items:flex-end;gap:4px;border-bottom:2px solid var(--c1)}
|
||||
.tabs{display:flex;align-items:flex-end;gap:5px;border-bottom:2px solid var(--c1)}
|
||||
.tab{height:24px;display:flex;align-items:center;padding:0 22px;cursor:pointer; /* 2026-10-21 决策 151 主人定:与工作台数据页签同高(原 32px 口径取消) */
|
||||
border:1px solid var(--line);border-bottom:none;background:#e7edf5;
|
||||
color:#34506f;font-weight:600;font-size:13px;border-radius:8px 8px 0 0;user-select:none}
|
||||
@@ -54,13 +54,15 @@ body{font-family:"Source Han Sans SC","Noto Sans SC","Source Han Sans CN","MiSan
|
||||
.panel{background:#fff;border:1px solid var(--line);border-top:none}
|
||||
/* 查询栏:**强制单行**(2026-10-07 主人定:保证一行,不要 2 行)——
|
||||
可收缩控件按比例让宽,窗口放不下时查询栏内部出细横向滚动条(仍是一行)。 */
|
||||
.bar{display:flex;gap:6px;align-items:center;flex-wrap:nowrap;overflow-x:auto;
|
||||
.bar{display:flex;gap:5px;align-items:center;flex-wrap:nowrap;overflow-x:auto;
|
||||
padding:8px 12px;border-bottom:1px solid var(--line);background:#fafcff}
|
||||
.bar::-webkit-scrollbar{height:6px}
|
||||
.bar::-webkit-scrollbar-thumb{background:#c4d2e3;border-radius:3px}
|
||||
.bar input,.bar select{padding:6px 10px;border:1px solid #b8c4d4;border-radius:6px;font-size:13px}
|
||||
/* 原生 select 的行高比 input 高 2px(31 vs 29),查询栏里会显得没对齐 —— 收一帧(2026-10-08) */
|
||||
.bar select{padding-top:5px;padding-bottom:5px;line-height:1.4}
|
||||
/* 2026-11-02 主人定:输入框/下拉与按钮统一 28px 高(对齐工作台) */
|
||||
.bar input,.bar select{height:28px;padding:0 10px;border:1px solid #b8c4d4;border-radius:6px;font-size:13px;box-sizing:border-box;line-height:26px}
|
||||
/* 本页搜索框/跳页钮:common.css 全局 24px(工作台共用不动),此处随查询栏统一 28px */
|
||||
.bar .pgsrch{height:28px}
|
||||
.bar .pgsnav{height:28px;white-space:nowrap;flex:none} /* 2026-11-02 主人定:「上一个/下一个」不许换行 */
|
||||
.bar .btn,.bar .tip{flex:none}
|
||||
.bar .dlmsg{flex:0 1 auto;min-width:0}
|
||||
#fper{flex:0 1 140px;min-width:96px}
|
||||
@@ -78,13 +80,16 @@ body{font-family:"Source Han Sans SC","Noto Sans SC","Source Han Sans CN","MiSan
|
||||
.cin[data-for=fq]{flex:1 1 150px;min-width:100px;max-width:320px}
|
||||
.cin[data-for=ftotal_min],.cin[data-for=ftotal_max]{flex:0 1 92px;min-width:60px}
|
||||
/* 地区三combo收窄(可输入搜索后不需要宽下拉,主人 10-07 指出太宽) */
|
||||
.combo[data-for=fp],.combo[data-for=fc],.combo[data-for=fd]{flex:0 1 88px;min-width:60px}
|
||||
.combo[data-for=fp],.combo[data-for=fc],.combo[data-for=fd]{flex:0 1 72px;min-width:56px} /* 2026-11-02 主人定:地区三框减窄 */
|
||||
.combo[data-for=fkind]{flex:0 1 130px;min-width:90px}
|
||||
.combo[data-for=fbu],.combo[data-for=fpub]{flex:0 1 170px;min-width:90px}
|
||||
#ftotal_min,#ftotal_max{flex:0 1 92px;min-width:60px}
|
||||
.btn{padding:6px 13px;border-radius:6px;border:1px solid #b8c4d4;background:#fff;cursor:pointer;font-size:12.5px}
|
||||
/* 2026-11-02 主人定:按钮/输入框形式对齐工作台(28px 高 inline-flex 同款),间距 5px */
|
||||
.btn{display:inline-flex;align-items:center;justify-content:center;gap:4px;height:28px;padding:0 12px;border-radius:6px;border:1px solid #b8c4d4;background:#fff;cursor:pointer;font:inherit;font-size:12.5px;color:#26405e;line-height:1;white-space:nowrap;vertical-align:middle;user-select:none}
|
||||
.btn:hover{background:#eef3fa}
|
||||
.btn.pri{background:var(--c2);color:#fff;border-color:var(--c2)}
|
||||
.btn:active{background:#e0effc}
|
||||
.btn:disabled{opacity:.45;cursor:not-allowed}
|
||||
.btn.pri{background:var(--c2);color:#fff;border-color:var(--c2);font-weight:600}
|
||||
.btn.danger{color:#c0392b;border-color:#e0b4b4}
|
||||
/* ---- 询价附件弹窗(2026-10-06)----
|
||||
左 38% 上传区 / 右 62% 工料机:右边 7 列给窄了必然横滚,等于白做。
|
||||
@@ -315,14 +320,18 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
放在标签栏最右(margin-left:auto),不参与上面三个数据标签的切换。
|
||||
2026-10-10 决策 31:按钮名「设置」让位给统一的「⚙ 设置」窗口(common.js,
|
||||
授权管理入口),本按钮改回原名「数据源」——功能一点没动。
|
||||
margin-bottom:6px —— 让它比标签条矮半截,免得看起来像第四个标签。 -->
|
||||
<button class="btn" id="btnDict" style="margin-left:auto;height:28px;padding:0 12px;display:inline-flex;align-items:center;justify-content:center;line-height:1" onclick="openDict()"
|
||||
title="字典设置:地区 / 发布单位 / 建设单位 下拉选项 + 上传大小上限">⚙ 字典</button>
|
||||
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>
|
||||
<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 主人定):从标题行右上角搬到标签栏,排在「设置」右边。
|
||||
2026-10-19 主人定:去掉 ▶ 图标,蓝底让位,尺寸样式对齐工作台顶栏按钮
|
||||
(28px 高 / 左右 12px / 12.5px 字号白底,与工作台「打开项目」同款)。 -->
|
||||
(28px 高 / 左右 12px / 12.5px 字号白底,与工作台「打开项目」同款)。
|
||||
2026-11-02 主人定:距蓝线 5px,与「⚙ 字典」同款。 -->
|
||||
<!-- 时间戳参数:老 WebView2 对 no-store 不完全遵守,跨页跳转带新 URL 强制绕缓存(2026-10-12) -->
|
||||
<button class="btn" style="height:28px;padding:0 12px;display:inline-flex;align-items:center;justify-content:center;line-height:1"
|
||||
<button class="btn pri" style="margin-bottom:5px;height:28px;padding:0 12px;display:inline-flex;align-items:center;justify-content:center;line-height:1"
|
||||
onclick="location.href='/workbench.html?v='+Date.now()"
|
||||
title="打开工作台:导入工程、做历史比对与审核">工作台</button>
|
||||
</div>
|
||||
@@ -342,17 +351,12 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
<input id="ftotal_min" type="text" inputmode="decimal" placeholder="总价≥" title="总价(元)下限">
|
||||
<input id="ftotal_max" type="text" inputmode="decimal" placeholder="总价≤" title="总价(元)上限">
|
||||
<select id="fpub" style="display:none" title="按发布单位筛选"><option value="">全部发布单位</option></select>
|
||||
<button class="btn pri" onclick="load(1)">查询</button>
|
||||
<button class="btn" onclick="load(1)">查询</button>
|
||||
<button class="btn" onclick="resetF()">重置</button>
|
||||
<!-- 标准模板下载:只在「市场价 / 信息价」标签下出现(工程导入用不上),
|
||||
位置固定在「导入」左边 —— 先拿模板再填再导入,是这个按钮的顺序含义 -->
|
||||
<button class="btn" id="btnTpl" style="display:none" onclick="dlTpl()"
|
||||
title="另存为 Excel 标准模板(自己选保存位置),按模板填好后回来导入">标准模板</button>
|
||||
<button class="btn pri" id="btnImp" onclick="openImp()">导入</button>
|
||||
<!-- 清空模拟数据:测试数据隔离/一键回收。danger 样式 + 二次确认,避免误触真删。 -->
|
||||
<button class="btn danger" id="btnClearMock" style="margin-left:auto" onclick="clearMock()"
|
||||
title="清空全部「模拟」测试数据(is_mock=1 的批次及其价格/附件,真删除、不可恢复)">清空模拟数据</button>
|
||||
<span class="tip" id="cnt"></span>
|
||||
<!-- 「清空模拟数据」按钮已于 2026-11-02 按主人要求去掉(clearMock 函数一并撤除;
|
||||
后端端点保留,需要时可在接口层调用)。「共 N 个」计数顶替原推右位。 -->
|
||||
<span class="tip" id="cnt" style="margin-left:auto"></span>
|
||||
<!-- 下载结果提示条(2026-10-06):替代 alert,保存成功/失败在这里说,3 秒后淡出 -->
|
||||
<span class="dlmsg" id="dlmsg"></span>
|
||||
<!-- 决策 229(2026-10-27 主人定):本页搜索(共享层)——当前页内黄底 + 上一个/下一个;
|
||||
@@ -493,12 +497,12 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
<div class="bar" id="ibody" style="flex-direction:row;align-items:stretch;gap:16px;overflow:hidden">
|
||||
<div id="ileft" style="min-width:0;display:flex;flex-direction:column;gap:10px">
|
||||
<div id="irowFile" style="display:flex;gap:8px;align-items:center">
|
||||
<span style="width:88px">全国电子标书</span>
|
||||
<span style="width:88px">导入</span>
|
||||
<input type="file" id="ifile" style="flex:1" onchange="pickFile(this)">
|
||||
</div>
|
||||
<div id="ifileInfo" class="tip" style="padding:0 0 0 82px"></div>
|
||||
<div style="display:flex;gap:8px;align-items:center">
|
||||
<span style="width:88px">工程名称 *</span>
|
||||
<span style="width:88px">名称 *</span>
|
||||
<input id="iname" style="flex:1" placeholder="选文件后自动带出文件名,可改">
|
||||
</div>
|
||||
<div id="irowPer" style="display:flex;gap:8px;align-items:center">
|
||||
@@ -520,7 +524,7 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
<select id="ifk" style="flex:1"></select>
|
||||
</div>
|
||||
<div id="irowPub" style="display:flex;gap:8px;align-items:center">
|
||||
<span style="width:88px">发布单位 *</span>
|
||||
<span style="width:88px" id="ipubLbl">发布单位 *</span>
|
||||
<select id="ipub" style="flex:1"></select>
|
||||
</div>
|
||||
<div id="irowPdf" style="display:flex;gap:8px;align-items:center">
|
||||
@@ -543,6 +547,8 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
<div style="display:flex;gap:10px;align-items:center;padding:10px 16px;border-top:1px solid #e3eaf2;background:#fafcff">
|
||||
<span class="tip" id="imRemind" style="flex:1;min-width:0;color:#b03a2e;line-height:1.45">提醒:建议在打开或导入项目时,先把工程独有的增加费(暗室、超高降效、预算包干、垂直运输等)取消后再入库或工作台的审核对比,否则容易造成数据失真!</span>
|
||||
<span class="tip" id="imsg"></span>
|
||||
<button class="btn" id="btnTpl" style="display:none;margin-left:auto" onclick="dlTpl()"
|
||||
title="另存为 Excel 标准模板(自己选保存位置),按模板填好后回来导入">标准模板</button>
|
||||
<button class="btn" onclick="closeImp()">取消</button>
|
||||
<button class="btn" id="impBtnX" onclick="aimpToggle()" title="右边展开目录树:按单位工程导入 Excel 建工程(与工作台同一套模板)">导入Excel</button>
|
||||
<input type="file" id="iprojfile" accept=".xlsx" style="display:none" onchange="aimpProjFile()">
|
||||
@@ -577,7 +583,7 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
<span style="width:74px">名称 *</span><input id="ename" style="flex:1">
|
||||
</div>
|
||||
<div id="irowEpub" style="display:flex;gap:8px;align-items:center">
|
||||
<span style="width:74px">发布单位 *</span><select id="epub" style="flex:1"></select>
|
||||
<span style="width:74px" id="epubLbl">发布单位 *</span><select id="epub" style="flex:1"></select>
|
||||
</div>
|
||||
<div id="irowEbuid" style="display:flex;gap:8px;align-items:center">
|
||||
<span style="width:74px">建设单位 *</span><select id="ebuid" style="flex:1"></select>
|
||||
@@ -617,6 +623,7 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
<div style="padding:14px 16px;display:flex;flex-direction:column;gap:10px">
|
||||
<div style="display:flex;gap:4px;border-bottom:2px solid var(--c1)">
|
||||
<div class="dtab on" id="dtab-region" onclick="dictTab('region')">地区</div>
|
||||
<div class="dtab" id="dtab-inquirer" onclick="dictTab('inquirer')">询价单位</div>
|
||||
<div class="dtab" id="dtab-publisher" onclick="dictTab('publisher')">发布单位</div>
|
||||
<div class="dtab" id="dtab-builder" onclick="dictTab('builder')">建设单位</div>
|
||||
<div class="dtab" id="dtab-upload" onclick="dictTab('upload')">上传设置</div>
|
||||
@@ -663,10 +670,34 @@ td.pcell input{width:100%;padding:3px 7px;font-size:12.5px;border:1px solid #9fb
|
||||
</div>
|
||||
<input type="file" id="afile" style="display:none">
|
||||
|
||||
<!-- ================= 导出设置(导出文件数据结构库)=================
|
||||
2026-11-02 主人定:弹框开即列表(序号|后缀|上传日期|导出文件数据结构,同后缀聚簇、
|
||||
组间明显横线、组首行标件数);右上「添加」=选文件即入库(.cos/.cos4 原件或骨架包),
|
||||
同名结构入库前确认升级替换;每文件带 下载 / 删(删=二次确认,该后缀最后一件加警示不阻止)。
|
||||
阶段二(上市版)切「骨架包升级分发」时本弹框撤添加钮、客户端静默接收(决策台账 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>
|
||||
<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 class="tip" id="fmsg" style="padding:0;min-height:18px"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ===== 询价附件(2026-10-21 决策 152 主人定:左=附件目录树(根目录「附件目录」,上传/删除挂根行右侧);
|
||||
右=项目工料机/类似清单 双页签 + 行最右搜索框;两类都可绑附件,工作台对比框可下载) ===== -->
|
||||
|
||||
<script src="common.js?v=20261021e"></script>
|
||||
<script src="common.js?v=20261101a"></script>
|
||||
<script src="period.js"></script>
|
||||
<script>
|
||||
const $=id=>document.getElementById(id);
|
||||
@@ -749,21 +780,8 @@ function fitFlexByContent(cols){
|
||||
|
||||
async function J(u,o){const r=await fetch(u,o);return r.json()}
|
||||
// 清空模拟测试数据:整批删除 is_mock=1 的批次(及其价格/附件),并顺手扫掉孤儿附件文件。
|
||||
async function clearMock(){
|
||||
if(!confirm("确认清空全部模拟测试数据?\n将真删除所有 is_mock=1 的批次、价格与附件(不可恢复)。")) return;
|
||||
try{
|
||||
const r = await J('/api/admin/clear_mock',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({})});
|
||||
if(r && r.ok){
|
||||
let s = "已清空模拟数据:批次 "+r.n_batch+" 份、价格 "+r.n_price+" 条";
|
||||
if(r.n_attach_file) s += "、附件文件 "+r.n_attach_file+" 个";
|
||||
if(r.n_orphan_file) s += "、孤儿附件 "+r.n_orphan_file+" 个";
|
||||
dlmsg(s);
|
||||
load(1);
|
||||
} else {
|
||||
dlmsg("清空失败:" + ((r && r.msg) || "未知错误"), "err");
|
||||
}
|
||||
}catch(e){ dlmsg("清空请求异常:" + e, "err"); }
|
||||
}
|
||||
/* 「清空模拟数据」入口已于 2026-11-02 按主人要求撤除(按钮+本函数);
|
||||
后端 /api/admin/clear_mock 端点保留,需要时可在接口层调用。 */
|
||||
function ym(s){const m=/^(\d{4})-(\d{2})$/.exec((s||'').trim());return m?(+m[1])*12+(+m[2]):null}
|
||||
// esc / num / fmtAttr 由 common.js 提供(前后台唯一来源)。
|
||||
// ⚠️ 原先后台用 toLocaleString(undefined) 且无最小小数位,工作台用 zh-CN —— 同一数字两侧显示不一样,
|
||||
@@ -809,8 +827,10 @@ async function loadFilters(){
|
||||
fkind.innerHTML = '<option value="">全部单价类型</option>' + kindOptions(f.file_kind, null);
|
||||
fbu.innerHTML = '<option value="">全部建设单位</option>'
|
||||
+ (f.bu_rows||[]).map(u=>`<option value="${esc(u)}">${esc(u)}</option>`).join('');
|
||||
fpub.innerHTML = '<option value="">全部发布单位</option>'
|
||||
// 2026-11-02 主人定:市场价页签过滤文案=询价单位;选项=库内实际值(两字典∪不受影响)
|
||||
fpub.innerHTML = `<option value="">${KIND==='market' ? '全部询价单位' : '全部发布单位'}</option>`
|
||||
+ (f.pub_rows||[]).map(u=>`<option value="${esc(u)}">${esc(u)}</option>`).join('');
|
||||
fpub.title = KIND==='market' ? '按询价单位筛选' : '按发布单位筛选';
|
||||
// 可搜索下拉(2026-10-07 主人定):地区三级 + 建设单位 + 发布单位,输入过滤、点选精确值
|
||||
['fp','fc','fd','fbu','fpub'].forEach(id=>comboAttach($(id))); // 单价类型只有 4 个枚举值,保持普通下拉
|
||||
comboSyncAll();
|
||||
@@ -1574,8 +1594,11 @@ async function openImp(){
|
||||
document.getElementById('irowFk').style.display = isPrice?'none':'flex';
|
||||
document.getElementById('irowNote').style.display = isPrice?'flex':'none';
|
||||
document.getElementById('irowPub').style.display = isPrice?'flex':'none';
|
||||
// 2026-11-02 主人定:市场价(市场询价)用「询价单位」字典,信息价保持「发布单位」——两类主体独立
|
||||
document.getElementById('ipubLbl').textContent = (isPrice && KIND==='market') ? '询价单位 *' : '发布单位 *';
|
||||
document.getElementById('irowPdf').style.display = isPrice?'flex':'none';
|
||||
document.getElementById('impBtnX').style.display = isPrice?'none':'inline-block';
|
||||
document.getElementById('btnTpl').style.display = isPrice?'':'none'; // 标准模板只对信息价/市场价有意义
|
||||
document.getElementById('ibtnGo').textContent = isPrice ? '开始导入' : '打开';
|
||||
document.getElementById('imRemind').style.display = isPrice?'none':'block';
|
||||
if(AIOPEN) aimpToggle(); // 每次打开先收回树区(与工作台 openDlg 同款)
|
||||
@@ -1596,11 +1619,9 @@ async function openImp(){
|
||||
ifile.accept = isPrice ? '.xlsx' : '.cos4,.cos,.swt,.swz';
|
||||
document.getElementById('ifileInfo').textContent='';
|
||||
document.getElementById('ifileInfo').style.display = isPrice?'block':'none';
|
||||
document.getElementById('irowTip').textContent = isPrice
|
||||
? '信息价/市场价:只收「标准模板」Excel(.xlsx,每次一个)+ 附件原件(任意格式,选填)。'
|
||||
+ '名称留空或点文件后自动带出文件名(可改);期次留空时自动从文件名里认(如「珠海信息价_2026年7月」→ 2026-07)。'
|
||||
: '';
|
||||
document.getElementById('irowTip').textContent = '';
|
||||
imsg.textContent='';
|
||||
dupCheckSha(ifile, '', 'admin', 'ibtnGo', 'imsg'); // 决策 243 补记五:弹框每开必清预检状态——上一文件的命中结论绝不带给新文件
|
||||
await loadImpFilters();
|
||||
// 单价类型默认「预算综合单价」(与工作台打开项目弹框同一默认)
|
||||
try{ if(ifk.options.length) ifk.value='1'; }catch(e){}
|
||||
@@ -1611,8 +1632,11 @@ async function pickFile(inp){
|
||||
const info=document.getElementById('ifileInfo');
|
||||
info.textContent='正在上传到软件目录…';
|
||||
const r = await uploadFile('/api/admin/upload', f);
|
||||
if(!r.ok){ info.textContent='× '+r.msg; UPF=null; return; }
|
||||
if(!r.ok){ info.textContent='× '+r.msg; UPF=null;
|
||||
dupCheckSha(inp, '', 'admin', 'ibtnGo', 'imsg'); // 上传失败:清预检状态不残留(决策 243 补记五)
|
||||
return; }
|
||||
UPF=r;
|
||||
dupCheckSha(inp, r.sha256, 'admin', 'ibtnGo', 'imsg'); // 决策 243 补记五:选完文件即预检(命中提醒+打开钮禁用)
|
||||
// 2026-10-12 重设计:价格类只认标准模板 Excel;工程类认 .cos4/.cos;
|
||||
// 2026-10-19 加 .swt(深圳数据交换标准,classify 返回 "swt")
|
||||
const ok = (KIND!=='project') ? (r.state==='price_xlsx')
|
||||
@@ -1728,7 +1752,7 @@ async function aimpProjFile(){
|
||||
}
|
||||
function aimpCommon(){
|
||||
const name=$('iname').value.trim(), pv=PVAL($('iper'));
|
||||
if(!name){ $('aimsg').textContent='工程名称必填(左边共用字段)'; return null; }
|
||||
if(!name){ $('aimsg').textContent='名称必填(左边共用字段)'; return null; }
|
||||
if(pv.f==null||pv.t==null){ $('aimsg').textContent='基准期次必填:点开选起~止(同月就选同一个)'; return null; }
|
||||
if(!iprov.value||!icity.value||!idist.value){ $('aimsg').textContent='请填写:地区(省/市/区)'; return null; }
|
||||
if(!ibuid.value.trim()){ $('aimsg').textContent='请填写:建设单位'; return null; }
|
||||
@@ -1767,7 +1791,9 @@ async function loadImpFilters(){
|
||||
.sort((x,y)=>x.localeCompare(y,'zh'));
|
||||
window.__BU_OPTS = buOpts;
|
||||
comboFree($('ibuid'), () => window.__BU_OPTS);
|
||||
dictFillSel(ipub, dictOrgs('publisher'), '', 'publisher');
|
||||
// 2026-11-02 主人定:市场价下拉=询价单位字典(+新增也归询价单位);信息价保持发布单位
|
||||
const pubCat = (KIND==='market') ? 'inquirer' : 'publisher';
|
||||
dictFillSel(ipub, dictOrgs(pubCat), '', pubCat);
|
||||
// 单价类型:排除 0「未标注」(与工作台同口径)。历史批次本身就是 0 的,编辑时要把它带回来,
|
||||
// 否则下拉里没有对应项 → 值对不上 → 看着像"没选",一保存就把状态改没了。
|
||||
ifk.innerHTML = kindOptions(f.file_kind, null);
|
||||
@@ -1787,7 +1813,7 @@ async function doImport(){
|
||||
// 决策 245:工程类校验文案与工作台「打开项目」逐字同款(两侧同规则)
|
||||
if(!isPrice){
|
||||
if(!UPF){ imsg.textContent='请选择文件'; return; }
|
||||
if(!iname.value.trim()){ imsg.textContent='请填写:工程名称'; return; }
|
||||
if(!iname.value.trim()){ imsg.textContent='请填写:名称'; return; }
|
||||
const pv0=PVAL($('iper'));
|
||||
if(pv0.f==null||pv0.t==null){ imsg.textContent='基准期次必填:点开选起~止(同一个月就选同一个)'; return; }
|
||||
if(!iprov.value||!icity.value||!idist.value){ imsg.textContent='请填写:地区(省/市/区)'; return; }
|
||||
@@ -1796,7 +1822,7 @@ async function doImport(){
|
||||
}
|
||||
const miss=[];
|
||||
if(isPrice && !UPF) miss.push('标准模板 Excel 文件(每次只能一个)');
|
||||
if(!iname.value.trim()) miss.push('工程名称');
|
||||
if(!iname.value.trim()) miss.push('名称');
|
||||
const pv=PVAL($('iper'));
|
||||
const p1=pv.f, p2=pv.t;
|
||||
if(isPrice && (p1==null||p2==null)) miss.push('基准期次(点开选起~止,同一个月就选同一个)');
|
||||
@@ -1895,6 +1921,8 @@ async function edit(id){
|
||||
const r=d.rows.find(x=>x.id===id); if(!r){ alert('找不到这一条'); return; }
|
||||
const isP=(KIND!=='project');
|
||||
document.getElementById('irowEpub').style.display = isP?'flex':'none';
|
||||
// 2026-11-02 主人定:市场价编辑=「询价单位」,信息价=「发布单位」(随页签 KIND)
|
||||
document.getElementById('epubLbl').textContent = (isP && KIND==='market') ? '询价单位 *' : '发布单位 *';
|
||||
document.getElementById('irowEbuid').style.display = isP?'none':'flex';
|
||||
document.getElementById('irowEfk').style.display = isP?'none':'flex';
|
||||
ename.value=r.name||''; enote.value=r.note||'';
|
||||
@@ -1902,7 +1930,8 @@ async function edit(id){
|
||||
await dictLoad();
|
||||
// 地区三联动 + 单位下拉:都取自数据源字典;老数据里字典没有的值会自动补进选项,不会丢
|
||||
dictFillRegion([eprov,ecity,edist],[r.province||'',r.city||'',r.district||'']);
|
||||
dictFillSel(epub, dictOrgs('publisher'), r.publisher||'', 'publisher');
|
||||
const epubCat = (KIND==='market') ? 'inquirer' : 'publisher'; // 2026-11-02:市场价编辑用询价单位字典
|
||||
dictFillSel(epub, dictOrgs(epubCat), r.publisher||'', epubCat);
|
||||
dictFillSel(ebuid, dictOrgs('builder'), r.bulid_unit||'', 'builder');
|
||||
if(!isP){
|
||||
efk.innerHTML = kindOptions(f.file_kind, r.file_kind);
|
||||
@@ -1953,7 +1982,7 @@ document.querySelectorAll('.tab[data-kind]').forEach(t=>t.onclick=()=>{
|
||||
t.classList.add('on'); KIND=t.dataset.kind; SORT={key:'',dir:'DESC'}; syncBtns();
|
||||
XLAST=KIND;
|
||||
if(XACT>=0){ XACT=-1; renderXTabs(); showDetail(false); xsave(); } // 从明细标签切回列表区(动态标签保留)
|
||||
ldWrap('','正在加载列表…',()=>load(1)); // 列表取数期间挂进度条(快则不闪)
|
||||
ldWrap('','正在加载列表…',()=>{ load(1); loadFilters(); }); // 列表取数期间挂进度条(快则不闪);loadFilters=过滤文案随页签刷新(2026-11-02 询价单位/发布单位)
|
||||
});
|
||||
// 2026-10-13 主人定:切标签没出全数据前要有进度条 —— 走共享层 ldWrap(det() 进来的路径
|
||||
// 已有即时遮罩,ldWrap 检测到就只报阶段不接管;这里兜住「直接点标签」的路径)
|
||||
@@ -2057,8 +2086,6 @@ function inqCell(r){
|
||||
}
|
||||
|
||||
function syncBtns(){
|
||||
// 标准模板只对信息价/市场价有意义,工程标签下隐藏(显示了点了也没用)
|
||||
$('btnTpl').style.display = (KIND==='project') ? 'none' : '';
|
||||
// 新增筛选随标签显隐(2026-10-07):历史项目=单价类型/建设单位/总价区间;价格标签=发布单位
|
||||
const isP = (KIND==='project');
|
||||
// ⚠️ _combo 是组合框对象(无 .style),要切的是它的 wrap 外层;_cin 本身就是包装层
|
||||
@@ -2437,11 +2464,15 @@ async function qUnbind(){
|
||||
ids.forEach(id=>{ const ck=document.querySelector('input.qbindck[data-id="'+id+'"], #qtbl input[data-id="'+id+'"]'); if(ck) ck.checked=false; });
|
||||
}
|
||||
|
||||
/* 决策 213 补记七:组表「单位工程名称」点击 → 追踪定位到本批次明细原数据树的那条清单。 */
|
||||
window.locBill = async function(bid, uwid){
|
||||
/* 决策 213 补记七:组表「单位工程名称」点击 → 追踪定位到本批次明细原数据树的那条清单。
|
||||
决策 243 补记(2026-11-01):工料机「源」浮层行点击(from='src')从明细页发起,
|
||||
当前批次=DID;此前一律 det(QBID) —— 明细直开时 QBID=0/旧批次,定位必失败还会把 DID 拽走(主人实测报障)。 */
|
||||
window.locBill = async function(bid, uwid, from){
|
||||
const bid_batch = from === 'src' ? DID : QBID;
|
||||
showPage('detail');
|
||||
await det(QBID, QBNAME || ('批次 #' + QBID), 'project');
|
||||
onWBTab('p3');
|
||||
const _t = XTABS.find(x => x.id === bid_batch && x.kind !== 'inq');
|
||||
await det(bid_batch, (bid_batch === QBID && QBNAME) || (_t && _t.name) || ('批次 #' + bid_batch), 'project');
|
||||
await onWBTab('p3'); // loadTab 是异步,不 await 会与 rawPick 抢渲染
|
||||
await rawPick('uw', uwid, null);
|
||||
const find = () => document.querySelector('#drawbody tr.brow[data-bid="' + bid + '"]');
|
||||
let tr = find();
|
||||
@@ -2475,10 +2506,94 @@ async function qDelFile(fid){
|
||||
}
|
||||
|
||||
|
||||
/* ============ 导出设置(导出文件数据结构库)====================
|
||||
2026-11-02 主人定:四列列表(同后缀聚簇、组间明显横线、组首行标件数)、
|
||||
右上「添加」选文件即入库(同名升级替换前确认)、每文件 下载/删
|
||||
(删=二次确认,该后缀最后一件加警示不阻止)。口径详见弹框 DOM 注释。 */
|
||||
let FRAMES = [];
|
||||
|
||||
async function openFrames(){
|
||||
$('fmask').classList.add('on');
|
||||
$('fmsg').textContent='';
|
||||
await framesLoad();
|
||||
}
|
||||
function closeFrames(){ $('fmask').classList.remove('on'); }
|
||||
fmask.onclick = e => { if(e.target===fmask) closeFrames() };
|
||||
|
||||
async function framesLoad(){
|
||||
try{
|
||||
const r = await (await fetch('/api/admin/frames')).json();
|
||||
FRAMES = r.rows || [];
|
||||
}catch(e){ FRAMES = []; $('fmsg').textContent='列表读取失败:'+e; }
|
||||
framesRender();
|
||||
}
|
||||
|
||||
function framesRender(){
|
||||
const rows = FRAMES; // 后端已排:后缀聚簇(cos4 在前)、组内入库时间倒序
|
||||
const cnt = {};
|
||||
rows.forEach(r => cnt[r.suffix] = (cnt[r.suffix]||0)+1);
|
||||
let html='', last=null, no=0;
|
||||
for(const r of rows){
|
||||
no++;
|
||||
const first = r.suffix!==last;
|
||||
const sep = (first && last!==null)
|
||||
? ' style="border-top:3px double #7d92ad"' : ''; // 组间明显横线(双线)
|
||||
html += `<tr${sep}>`
|
||||
+ `<td class="c">${no}</td>`
|
||||
+ `<td>${first ? r.suffix+'('+cnt[r.suffix]+'件)' : ''}</td>`
|
||||
+ `<td>${(r.extracted_at||'').slice(0,10)}</td>`
|
||||
+ `<td>${r.original_name||''}`
|
||||
+ ` <a href="/api/admin/frames/file/${r.sig}" style="color:#26405e">下载</a>`
|
||||
+ ` <a href="javascript:framesDel('${r.sig}')" style="color:#c0392b">删</a></td>`
|
||||
+ `</tr>`;
|
||||
last = r.suffix;
|
||||
}
|
||||
$('frameBody').innerHTML = html
|
||||
|| '<tr><td colspan="4" class="c" style="color:#888">还没有导出文件数据结构,点右上「添加」导入</td></tr>';
|
||||
}
|
||||
|
||||
function framesAdd(){ $('ffile').value=''; $('ffile').click(); }
|
||||
|
||||
async function framesSeed(inp){
|
||||
const f = inp.files && inp.files[0];
|
||||
if(!f) return;
|
||||
const stem = f.name.replace(/\.[^.]*$/,'');
|
||||
if(FRAMES.some(r => r.original_name===stem)
|
||||
&& !confirm(`已存在同名结构《${stem}》,将升级替换(旧内容被覆盖)。\n继续?`)){ inp.value=''; return; }
|
||||
try{
|
||||
const res = await fetch('/api/admin/frames/seed', {method:'POST',
|
||||
headers:{'Content-Type':'application/octet-stream',
|
||||
'X-File-Name':encodeURIComponent(f.name)},
|
||||
body:f});
|
||||
const r = await res.json();
|
||||
if(!r.ok){ $('fmsg').textContent = r.msg || '入库失败'; return; }
|
||||
$('fmsg').textContent = r.kind==='pack'
|
||||
? `骨架包已安装 ${r.installed.length} 件` : `已入库《${r.name}》`;
|
||||
await framesLoad();
|
||||
}catch(e){ $('fmsg').textContent='入库请求失败:'+e; }
|
||||
finally{ inp.value=''; }
|
||||
}
|
||||
|
||||
async function framesDel(sig){
|
||||
const r = FRAMES.find(x=>x.sig===sig);
|
||||
if(!r) return;
|
||||
const isLast = FRAMES.filter(x=>x.suffix===r.suffix).length===1;
|
||||
const warn = isLast
|
||||
? `\n\n⚠ 这是 .${r.suffix} 最后一件:删除后手工导出该格式将不可用。` : '';
|
||||
if(!confirm(`确定删除《${r.original_name}》?${warn}\n\n删除后可用同名文件重新「添加」恢复。`)) return;
|
||||
try{
|
||||
const res = await fetch('/api/admin/frames/delete', {method:'POST',
|
||||
headers:{'Content-Type':'application/json'}, body: JSON.stringify({sig})});
|
||||
const j = await res.json();
|
||||
if(!j.ok){ $('fmsg').textContent = j.msg || '删除失败'; return; }
|
||||
await framesLoad();
|
||||
}catch(e){ $('fmsg').textContent='删除请求失败:'+e; }
|
||||
}
|
||||
|
||||
/* ============ 数据源面板(地区 / 发布单位 / 建设单位)====================
|
||||
这里的选项就是各页录入下拉的唯一来源。改完不需要重启,下次打开弹窗即生效。 */
|
||||
let DCUR = 'region'; // region | publisher | builder
|
||||
const DORG_TITLE = {publisher:'发布单位', builder:'建设单位'};
|
||||
let DCUR = 'region'; // region | inquirer | publisher | builder
|
||||
const DORG_TITLE = {publisher:'发布单位', inquirer:'询价单位', builder:'建设单位'}; // 2026-11-02 主人定:加询价单位(市场价专用)
|
||||
|
||||
function openDict(){ dmask.classList.add('on'); dmsg.textContent=''; dictTab(DCUR); }
|
||||
/* 关闭前补一次保存:上传设置是「即改即存」,而 onchange 要等失焦才触发 ——
|
||||
@@ -2498,14 +2613,14 @@ async function closeDict(){
|
||||
|
||||
function dictTab(cat){
|
||||
DCUR = cat;
|
||||
['region','publisher','builder','upload'].forEach(c=>{
|
||||
['region','inquirer','publisher','builder','upload'].forEach(c=>{
|
||||
const t=document.getElementById('dtab-'+c);
|
||||
if(t) t.classList.toggle('on', c===cat);
|
||||
});
|
||||
document.getElementById('dpane-region').style.display = (cat==='region')?'':'none';
|
||||
// ⚠️ org 面板只有「发布单位 / 建设单位」两个标签用;写成 cat!=='region' 会让 upload 也带上它,
|
||||
// ⚠️ org 面板只有「询价单位 / 发布单位 / 建设单位」三个标签用;写成 cat!=='region' 会让 upload 也带上它,
|
||||
// 于是上传设置里凭空多出一张表和一个「新增」按钮(2026-10-06 修)
|
||||
document.getElementById('dpane-org').style.display = (cat==='publisher'||cat==='builder')?'':'none';
|
||||
document.getElementById('dpane-org').style.display = (cat==='publisher'||cat==='inquirer'||cat==='builder')?'':'none';
|
||||
// 「上传设置」不是字典,切过去时不渲染字典表(dictRender 会读 /api/dict,白跑一次)
|
||||
document.getElementById('dpane-upload').style.display = (cat==='upload')?'':'none';
|
||||
const bAdd = document.getElementById('btnDictAdd');
|
||||
@@ -2597,7 +2712,8 @@ async function dictRender(){
|
||||
}).join('');
|
||||
rg.innerHTML = (DICT_ADD === 'region' ? dictAddRowRegion() : '') + rows;
|
||||
} else {
|
||||
const list = (DCUR === 'publisher' ? DICT.publishers : DICT.builders) || [];
|
||||
const list = (DCUR === 'publisher' ? DICT.publishers
|
||||
: DCUR === 'inquirer' ? DICT.inquirers : DICT.builders) || [];
|
||||
DICT_ROWS = dictSort(list);
|
||||
const rows = DICT_ROWS.map((o, i) => {
|
||||
if (DICT_EDIT && DICT_EDIT.id === o.id) return dictEditRowOrg(o);
|
||||
|
||||
Reference in New Issue
Block a user