feat(全链): 落实决策322-333——采纳落价Σ合价÷量、编制价三件套归一、块进块出、导出通用化只改导入、母随子动回算、台账分层留存
This commit is contained in:
@@ -624,6 +624,19 @@ body.histdrag{user-select:none}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 2026-11-14 主人定:缺源导出被拦=弹框提示(拒绝导出,补全后重新导出)。
|
||||
注意:本弹框必须在 #expmask **外面**——.mask{display:none} 会把嵌套子弹框一起藏掉。 -->
|
||||
<div class="mask" id="chainmask">
|
||||
<div class="dlg" style="width:520px;max-width:92vw">
|
||||
<h4>导出被拦</h4>
|
||||
<div class="mbody">
|
||||
<div id="chainmsg" style="font-weight:600;color:#243b53;word-break:break-all;line-height:1.6;max-height:50vh;overflow:auto"></div>
|
||||
</div>
|
||||
<div class="mfoot" style="display:flex;justify-content:flex-end">
|
||||
<button class="btn" onclick="chainModalClose()">知道了</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 导出选项弹框(2026-11-03 主人定):四复选框限勾一个(导出excel/导出html/导出yhy/导出原格式),
|
||||
「导出」→ 决策 92 同款另存为+进度流程;「取消」关闭不导出。
|
||||
@@ -988,6 +1001,16 @@ window.rawLmePick = function(type, id, tr){ // 决策 147:renderLme 统一
|
||||
生成,大工程不再干等)→②弹进度模态(生成逐条目% + 写盘字节%),期间软件不可操作 →③模态上
|
||||
「后台导出」是唯一出口=收起回软件继续干活,后台完成后右下角提醒。普通浏览器仍走 FSA 另存为。 */
|
||||
let EXP_BG = false; // 是否已「后台导出」(后台完成只提醒,不弹回界面)
|
||||
/* ---------- 2026-11-14 主人定:缺源导出被拦=弹框提示(拒绝导出,补全后重新导出) ---------- */
|
||||
function isChainMsg(m){ return (m || '').indexOf('数据链不完整') === 0; }
|
||||
function chainModalShow(msg){
|
||||
const el = document.getElementById('chainmsg');
|
||||
if (el) el.textContent = msg || '';
|
||||
const st = document.getElementById('msg'); // 别让状态栏还挂着“正在导出…”
|
||||
if (st) st.textContent = '导出被拦:数据链不完整';
|
||||
document.getElementById('chainmask').classList.add('on');
|
||||
}
|
||||
function chainModalClose(){ document.getElementById('chainmask').classList.remove('on'); }
|
||||
function exportModalShow(name){
|
||||
EXP_BG = false;
|
||||
$('expname').textContent = name || '';
|
||||
@@ -1066,7 +1089,7 @@ async function exportSession(fmt){
|
||||
if (hasBridge && typeof window.pywebview.api.export_save_as === 'function'){
|
||||
const r = await window.pywebview.api.export_save_as(SID, '', fmt);
|
||||
if (r && r.cancel){ $('msg').textContent = '已取消导出'; return; }
|
||||
if (r && r.msg){ $('msg').textContent = '导出失败:' + r.msg; return; }
|
||||
if (r && r.msg){ if (isChainMsg(r.msg) || r.chain_incomplete){ chainModalShow(r.msg); } else { $('msg').textContent = '导出失败:' + r.msg; } return; }
|
||||
if (r && r.started){ exportModalShow(r.name); return; }
|
||||
/* 老壳没有这个方法 → 落到下面的旧桥/浏览器分支 */
|
||||
}
|
||||
@@ -1075,10 +1098,18 @@ async function exportSession(fmt){
|
||||
const r = await window.pywebview.api.download_save_as('/api/session/export?session_id=' + SID + (fmt?('&fmt='+encodeURIComponent(fmt)):''), '');
|
||||
if (r && r.ok){ $('msg').textContent = '已导出:' + (r.name || ''); dlMsg('已另存为:' + r.path, 'ok'); return; }
|
||||
if (r && r.cancel){ $('msg').textContent = '已取消导出'; return; }
|
||||
if (r && r.msg){ $('msg').textContent = '导出失败:' + r.msg; return; }
|
||||
if (r && r.msg){ if (isChainMsg(r.msg) || r.chain_incomplete){ chainModalShow(r.msg); } else { $('msg').textContent = '导出失败:' + r.msg; } return; }
|
||||
}
|
||||
const resp = await fetch('/api/session/export?session_id=' + SID + (fmt?('&fmt='+encodeURIComponent(fmt)):''));
|
||||
if(!resp.ok){ const j = await resp.json().catch(()=>null); throw new Error((j && j.msg) || ('HTTP ' + resp.status)); }
|
||||
// 2026-11-14 主人定「缺源导出弹框」:闸门拒绝是 200+JSON(不是 HTTP 错误),
|
||||
// 浏览器路径必须按 Content-Type 认出来弹框,否则会把 JSON 当文件存下去。
|
||||
const _ct = (resp.headers.get('Content-Type') || '').toLowerCase();
|
||||
if (_ct.indexOf('application/json') >= 0){
|
||||
const j = await resp.json().catch(()=>null);
|
||||
if (j && (isChainMsg(j.msg) || j.chain_incomplete)){ chainModalShow(j.msg); return; }
|
||||
throw new Error((j && j.msg) || '导出失败');
|
||||
}
|
||||
if(!resp.ok){ const j = await resp.json().catch(()=>null); if (j && (isChainMsg(j.msg) || j.chain_incomplete)){ chainModalShow(j.msg); return; } throw new Error((j && j.msg) || ('HTTP ' + resp.status)); }
|
||||
const cd = resp.headers.get('Content-Disposition') || '';
|
||||
// 服务端同时发 filename="export.zip"(ASCII 兜底)和 filename*=UTF-8''真名(原工程名-审核版.原后缀)。
|
||||
// 必须**优先吃 filename***——旧正则 filename\*? 先命中兜底名,另存为永远建议 export.zip,
|
||||
|
||||
Reference in New Issue
Block a user