修复售后成本冲回的对账校验并统一库存经办人姓名

This commit is contained in:
summer committed 2026-11-10 22:29:17 +08:00
1 parent dab735423e
commit ecb8d6dec0
6 files changed
+120 -25

No files matched your search

+9 -1
View File
@@ -149,10 +149,18 @@ test('日期与账号时序守卫拒收旧响应,失败不清除当前日期
test('读取失败保留尚未保存的项目、金额与日期,并锁定提交直到重新读取',async()=>{
const h=harness();await h.load();await h.action('reimbursement-new');h.item(0,'尚未提交的进货工费','80.00');h.fill('date',D,'reimbursement-form');h.fill('amount','321.00');
const original=h.context.__api;h.context.__api=async()=>{throw new Error('合成断线');};await h.load();assert.equal(h.nodes.get('#reimbursement-form').rows[0].querySelector('[name="itemName"]').value,'尚未提交的进货工费');assert.equal(h.nodes.get('#daily-outlay-form').fields.amount.value,'321.00');assert.equal(h.nodes.get('#reimbursement-form').fields.date.value,D);assert.equal(h.nodes.get('#reimbursement-form').fields.date.disabled,true);assert.match(h.html(),/合成断线/);
const original=h.context.__api;h.context.__api=async()=>{throw new Error('合成断线');};await h.load();assert.equal(h.nodes.get('#reimbursement-form').rows[0].querySelector('[name="itemName"]').value,'尚未提交的进货工费');assert.equal(h.nodes.get('#daily-outlay-form').fields.amount.value,'321.00');assert.equal(h.nodes.get('#reimbursement-form').fields.date.value,D);assert.equal(h.nodes.get('#reimbursement-form').fields.date.disabled,true);assert.match(h.nodes.get('#report-content').innerHTML,/合成断线/);assert.doesNotMatch(h.html(),/合成断线/);assert.equal(h.run('currentReport'),null);assert.equal(h.run('dailyFundsEntry.data'),null);assert.throws(()=>h.run('requireDailyFunds()'),/请先重新读取/);
h.context.__api=original;await h.load();assert.equal(h.nodes.get('#reimbursement-form').rows[0].querySelector('[name="itemAmount"]').value,'80.00');assert.equal(h.posts().length,0);
});
test('同一日报校验失败只显示一个错误,资金与报销资料同时失效且重读成功后恢复',async()=>{
const h=harness(data({ready:true}));await h.load();const original=h.context.__api;
h.context.__api=async(...args)=>{const response=await original(...args);response.ownershipBusiness.owner.knownTotalCost++;return response;};await h.load();
const message='所属订单成本、利润或待转资料未完整返回',html=h.nodes.get('#report-content').innerHTML+h.html();assert.equal((html.match(new RegExp(message,'g'))||[]).length,1);
assert.equal(h.run('currentReport'),null);assert.equal(h.run('dailyFundsEntry.data'),null);assert.equal(h.run('dailyFundsLoading'),false);assert.throws(()=>h.run('requireCurrentReport()'),/正在读取或已失效/);assert.throws(()=>h.run('requireDailyFunds()'),/请先重新读取/);assert.doesNotMatch(h.html(),/class="daily-transfer-result"|data-action="reimbursement-new"/);
h.context.__api=original;await h.load();assert.ok(h.run('currentReport'));assert.ok(h.run('dailyFundsEntry.data'));assert.match(h.html(),/class="daily-transfer-result"/);assert.equal(h.posts().length,0);
});
test('全日期待复核独立分页,打开跨日申请回原报销日,不在月汇总直接写入',async()=>{
const older='2026-10-20',row=claim({date:older}),h=harness(data({pendingCount:1}));h.responses.set(older,data({date:older,reimbursements:[row],pendingCount:1}));const original=h.context.__api;
h.context.__api=async(url,payload,key)=>url.startsWith('/api/reimbursements?')?{requests:[row],counts:{pending:1,approved:0,rejected:0},total:1,offset:0,limit:50,hasMore:false}:original(url,payload,key);