From d669a7b28e36b88838d955286bab1d990bc7d603 Mon Sep 17 00:00:00 2001 From: abaishu0730 Date: Wed, 21 Oct 2026 15:56:50 +0800 Subject: [PATCH] fix: retain execution failure causes beside notification results --- tests/order-rules/huizhou-ui.test.cjs | 13 +++++++++++++ web/modules/order-notifications/records.js | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/order-rules/huizhou-ui.test.cjs b/tests/order-rules/huizhou-ui.test.cjs index df24bc3..099806c 100644 --- a/tests/order-rules/huizhou-ui.test.cjs +++ b/tests/order-rules/huizhou-ui.test.cjs @@ -80,3 +80,16 @@ test('record lists and details show independent results and batch modes without await page.getByRole('button',{name:'关闭详情',exact:true}).click();await page.goto(f.base+'/#notification-batches?scope=all');const batch=page.locator('tr').filter({has:page.getByText('hui-batch',{exact:true})});await batch.waitFor();assert.match(await batch.innerText(),/惠州通知/);await batch.getByRole('button',{name:'查看详情',exact:true}).click();await dialog.getByRole('heading',{name:'保存核验结论',exact:true}).waitFor();assert.match(await dialog.textContent(),/通知模式惠州通知/);assert.equal(await dialog.getByRole('button',{name:'人工补发原冻结批次',exact:true}).count(),0); await page.setViewportSize({width:390,height:844});assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth),true); }); + +test('order list retains execution failure and conflict causes beside independent notification results',{timeout:90000},async t=>{ + const f=await fixture(t),{runtime,page}=f; + const cases=[{id:'execution-failed',status:'failed',error:'归档读取校验失败,通知尚待处理'},{id:'execution-conflict',status:'blocked',error:'新来源修订与已归档版本冲突,请核对',conflict:true}]; + for(const item of cases){ + runtime.orderRules.put('orders',{id:item.id,status:'sent',error:'普通路已有结果说明',event:{connectionId:'c',orderNo:item.id,receivedAt:'2026-10-21T01:00:00Z'},notifications:{huizhou:{status:'pending',batchId:null,error:'惠州路独立等待原因',orderNos:['H-200'],issues:[]}}}); + runtime.orderRules.put('execution-tasks',{id:'task-'+item.id,orderId:item.id,connectionId:'c',version:1,status:item.status,error:item.error,conflict:item.conflict||false,row:{orderNo:item.id}}); + } + runtime.orderRules.put('execution-tasks',{id:'bare-execution',connectionId:'c',version:1,status:'failed',error:'尚未生成订单的采集失败',row:{orderNo:'bare-execution'}}); + await f.open('#notification-orders'); + for(const item of cases){const row=page.locator('tr').filter({has:page.getByText(item.id,{exact:true})});await row.waitFor();const text=await row.innerText();assert.ok(text.includes(item.error),text);assert.match(text,/普通通知.*已提交邮件服务器/s);assert.match(text,/惠州通知.*等待汇总/s);assert.match(text,/普通路已有结果说明/);assert.match(text,/惠州路独立等待原因/);} + const bare=page.locator('tr').filter({has:page.getByText('bare-execution',{exact:true})});assert.match(await bare.innerText(),/尚未生成订单的采集失败/);assert.doesNotMatch(await bare.innerText(),/普通通知|惠州通知/); +}); diff --git a/web/modules/order-notifications/records.js b/web/modules/order-notifications/records.js index 906eaeb..cb12581 100644 --- a/web/modules/order-notifications/records.js +++ b/web/modules/order-notifications/records.js @@ -9,7 +9,7 @@ window.BusinessRecordViews=(()=>{ const input=(name,label,type='text')=>``; container.innerHTML=`

${kind==='orders'?'订单中心':'邮件批次'}

${input('q','搜索订单 / 标识 / 主题')}
${select('categoryId','类别')}
${select('connectionId','来源连接')}
${kind==='batches'?`
`:''}
${input('from',kind==='batches'?'窗口截止日期从(北京时间)':'接收日期从(北京时间)','date')}
${input('to',kind==='batches'?'窗口截止日期至':'接收日期至','date')}
${window.RecordUi.footer}
${kind==='orders'&&user.role!=='viewer'?'

扫描并处理订单

读取授权待办、采集真实字段、生成 PDF 并归档;BPM 节点由人工办理。邮件按独立开关和批次调度发送。

':''}`; let table;const detail=window.BusinessRecordDetail.mount(container,{...options,onChanged:()=>{const error=container.querySelector('[data-record-error]');error.hidden=false;error.textContent='业务状态已变化,请刷新记录核对。';}}); - function draw(data){const host=container.querySelector('[data-arrival-list]');host.innerHTML=`
${data.items.map((row,index)=>``).join('')||''}
${kind==='orders'?'订单 / 类别':'主题 / 类别'}状态与原因接收 / 创建时间详情
${esc(row.orderNo||row.subject||row.id)}
${esc(catalogs.categories.get(row.categoryId)||row.categoryId||'未分类')}
${kind==='batches'?''+(row.notificationMode==='huizhou'?'惠州通知':'普通通知')+'':''}
${esc(labels[row.status]||row.status)}${kind==='orders'&&row.notifications?['normal','huizhou'].map(mode=>{const notice=row.notifications[mode];return notice?'
'+(mode==='huizhou'?'惠州通知':'普通通知')+':'+esc(labels[notice.status]||notice.status)+'
'+esc(notice.error||'')+'
'+(notice.issues?.length?'
'+notice.issues.map(esc).join(';')+'
':'')+'
':'';}).join(''):''}
${esc(row.reason||(!row.notifications?row.error:'')||'')}
${esc(formatDate(row.receivedAt||row.createdAt))}
暂无匹配记录
`;host.querySelectorAll('[data-business-detail]').forEach(button=>button.onclick=()=>detail.open(kind,data.items[Number(button.dataset.businessDetail)].id,button));} + function draw(data){const host=container.querySelector('[data-arrival-list]');host.innerHTML=`
${data.items.map((row,index)=>``).join('')||''}
${kind==='orders'?'订单 / 类别':'主题 / 类别'}状态与原因接收 / 创建时间详情
${esc(row.orderNo||row.subject||row.id)}
${esc(catalogs.categories.get(row.categoryId)||row.categoryId||'未分类')}
${kind==='batches'?''+(row.notificationMode==='huizhou'?'惠州通知':'普通通知')+'':''}
${esc(labels[row.status]||row.status)}${kind==='orders'&&row.notifications?['normal','huizhou'].map(mode=>{const notice=row.notifications[mode];return notice?'
'+(mode==='huizhou'?'惠州通知':'普通通知')+':'+esc(labels[notice.status]||notice.status)+'
'+esc(notice.error||'')+'
'+(notice.issues?.length?'
'+notice.issues.map(esc).join(';')+'
':'')+'
':'';}).join(''):''}
${esc(row.error||row.reason||'')}
${esc(formatDate(row.receivedAt||row.createdAt))}
暂无匹配记录
`;host.querySelectorAll('[data-business-detail]').forEach(button=>button.onclick=()=>detail.open(kind,data.items[Number(button.dataset.businessDetail)].id,button));} const names=Object.keys(filters).filter(k=>!['page','pageSize'].includes(k)); table=window.RecordTable.mount({view,container,isActive,api,endpoint:'/order-rules/'+kind,render:draw,readDraft:()=>Object.fromEntries(names.map(k=>[k,container.querySelector('[name="'+k+'"]').value.trim()])),writeDraft(next){for(const k of names)container.querySelector('[name="'+k+'"]').value=next[k];}}); const workspaceRead=api('/workspace');