fix(adopt): 取消采纳改为物理删并修复源件锚与重定位
This commit is contained in:
@@ -2835,7 +2835,8 @@ async function adopt(i){
|
||||
if(x.bill_id){
|
||||
try{
|
||||
r0=await J('/api/session/bill/adopt',{method:'POST',headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify({session_id:SID,bill_id:CUR.id,src_bill_id:x.bill_id})});
|
||||
body:JSON.stringify({session_id:SID,bill_id:CUR.id,src_bill_id:x.bill_id,
|
||||
src_hash:x.bhash||'',src_batch:x.batch_id||0})}); // 279 延伸:id 失效(按需重导换 id)时服务端按 批次+内容哈希 重定位
|
||||
}catch(e){ r0=null; }
|
||||
if(!r0 || !r0.ok){ dlMsg('采纳失败:'+(r0&&r0.msg?r0.msg:'服务未响应'),'err'); return; }
|
||||
// 定额构成变了:撤原数据取数缓存(切页重拉即新状态,与 billCtxApply 同口径)
|
||||
@@ -2862,12 +2863,13 @@ async function adopt(i){
|
||||
CUR_ADOPT=txt; // 决策 250:判定源同步(已采纳标记立即点亮)
|
||||
// 决策 256(乙 后端溯源):来源行快照落库(跨重开定位)+ 会话内存缓存(当场插行零等待)
|
||||
try{
|
||||
const src=VISIBLE_ROWS[i] || {};
|
||||
const src=x || {}; // 决策 256 快照取点击时抓住的行——await 期间对比框可能被快照回调重排,重读 VISIBLE_ROWS[i] 会抓错行(2026-11-12 修「备注记A行、快照记B行」竞态)
|
||||
_ADOPT_SRC={key:CURTYPE+':'+CUR.id, row:src};
|
||||
J('/api/session/adopt/src',{method:'POST',headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify({act:'record',type:'bill',row_id:CUR.id,
|
||||
body:JSON.stringify({act:'record',type:'bill',row_id:CUR.id,session_id:SID,
|
||||
src:{src:src.src||'project', src_id:src.src_id||src.bill_id, name:src.name,
|
||||
attr:src.attr, unit:src.unit, price:src.price, proj:src.proj, period:src.period}})});
|
||||
attr:src.attr, unit:src.unit, price:src.price, proj:src.proj, period:src.period,
|
||||
bhash:src.bhash||'', batch_id:src.batch_id||0}})}); // 哈希+批次随快照存:快照行再采纳时 id 失效可重定位(session_id 原缺→服务端参数校验拒绝、清单页快照从未落库,2026-11-12 修)
|
||||
}catch(e){}
|
||||
// keepView:采纳后停在原组原行(规格 2026-10-16:点采纳跳至第一组 = bug,修复)
|
||||
const cur=document.querySelector('.tab.on');
|
||||
@@ -2882,7 +2884,7 @@ async function adopt(i){
|
||||
/* 清单取消采纳(2026-10-09 主人定):只清备注,不动「询价附件」目录(清单采纳本就不收附件)。
|
||||
2026-10-11:上方行数据/备注格同步清空,对比框灰「已采纳」复原为「采纳」(renderHist)。 */
|
||||
async function cancelBillAdopt(billId, el){
|
||||
if(!(await uiConfirm('取消采纳:撤销采纳的数据(追加定额撤下、原定额恢复、汇总追加行撤下、新增清单清回空行)并清空采纳备注。'))) return;
|
||||
if(!(await uiConfirm('取消采纳:删除采纳进来的数据(追加定额删除、块库收藏删除、无引用地的工料机删除、新增清单整行删除)并清空采纳备注;有引用地的引用源保留,源件导入的原清单保留并恢复导入原价(2026-11-12)。'))) return;
|
||||
// ① 数据反向(决策 68 批次B;仅有备注式采纳时服务端 noop,不报错)
|
||||
let r=null;
|
||||
try{
|
||||
@@ -3004,13 +3006,13 @@ async function adoptLme(i){
|
||||
CUR_ADOPT=txt; // 决策 250:判定源同步(已采纳标记立即点亮)
|
||||
// 决策 256(乙 后端溯源):来源行快照落库(跨重开定位)+ 会话内存缓存
|
||||
try{
|
||||
const src=VISIBLE_ROWS[i] || {};
|
||||
const src=x || {}; // 决策 256 快照取点击时抓住的行——await 期间对比框可能被快照回调重排,重读 VISIBLE_ROWS[i] 会抓错行(2026-11-12 修「备注记A行、快照记B行」竞态)
|
||||
_ADOPT_SRC={key:CURTYPE+':'+(_rid!=null?_rid:CUR.code), row:src};
|
||||
J('/api/session/adopt/src',{method:'POST',headers:{'Content-Type':'application/json'},
|
||||
body:JSON.stringify({act:'record',type:'lme',row_id:_rid,
|
||||
body:JSON.stringify({act:'record',type:'lme',row_id:_rid,session_id:SID,
|
||||
src:{src:src.src||'project', src_id:src.src_id, name:src.name, spec:src.spec||'',
|
||||
attr:src.attr||'', unit:src.unit, price:src.price, tax:src.tax,
|
||||
price_tax:src.price_tax, proj:src.proj, period:src.period}})});
|
||||
price_tax:src.price_tax, proj:src.proj, period:src.period}})}); // session_id 原缺→快照从未落库,2026-11-12 修(同清单链)
|
||||
}catch(e){}
|
||||
if(CUR.leaf){
|
||||
// 决策 302:叶子行——原位同步被点选的 lmesub 叶子行(重画兜底:RV_CACHE 已清;rid 供取消采纳定位)
|
||||
|
||||
Reference in New Issue
Block a user