diff --git a/docs/HANDOFF.md b/docs/HANDOFF.md
index 94308a1..90ceb07 100644
--- a/docs/HANDOFF.md
+++ b/docs/HANDOFF.md
@@ -1,5 +1,12 @@
# 开发交接(2026-10-23)
+## 2026-10-27 业务首页轻量看板
+
+- 用户确认蓝白卡片、流程小场景和少量动效。新增首页独立模块及样式,突出下一计划发送时点、到达截止、时间进度、收集中批次及顺延数量;运行条件和异常独立展示,保留现有业务操作边界。
+- Tabler Icons使用MIT授权静态SVG,许可证位于licenses/Tabler-Icons-MIT.txt;未使用需购买授权的Tabler插画。现有Tabler状态点与骨架组件无需升级依赖。动画仅作状态/交互提示,扫描流动仅在实际scanning状态出现;减少动态效果时禁用动画。
+- summary追加home字段复用当前已授权收集批次,普通/惠州订单去重,预览最多4组,不返回邮件正文或收件人。倒计时到期只提示刷新确认,不能推断发送成功;暂停、加载失败及内部刷新失败均有明确状态。
+- 首页与汇总/查询/批次专项31项通过,桌面1440、窄屏674和手机390截图核验,无横向溢出;内部刷新失败保留旧数据并可重试,离页销毁倒计时与请求。仅展示改版,不更改匹配、归档、发信计划或测试期限。
+
## 2026-10-27 未发送订单顺延下一批
- 用户明确要求确认未发的订单恢复待汇总,下一时段重新合并;有证明的失败冻结批次保留历史后取消,新批次使用正常模板/新窗口草稿。已发送、sending/unknown、部分接受和无证明旧failed不自动重发。
diff --git a/licenses/Tabler-Icons-MIT.txt b/licenses/Tabler-Icons-MIT.txt
new file mode 100644
index 0000000..3e82379
--- /dev/null
+++ b/licenses/Tabler-Icons-MIT.txt
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2020-2026 Paweł Kuna
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/package.json b/package.json
index 7001099..20892e4 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,7 @@
"service:stop": "node scripts/service.cjs stop",
"service:restart": "node scripts/service.cjs restart",
"test": "npm run test:business",
- "test:business": "node --test --test-concurrency=1 tests/order-rules/carry-forward-core.test.cjs tests/order-rules/carry-forward-integration.test.cjs tests/order-rules/dispatch-unsent-proof.test.cjs tests/order-rules/dismiss-task.test.cjs tests/app/carry-dismiss-ui.test.cjs tests/workspace/business-issues.test.cjs tests/mail/unified-account.test.cjs tests/mail/unified-account-ui.test.cjs tests/assistant/assistant.test.cjs tests/assistant/assistant-http-ui.test.cjs tests/assistant/controlled-operations.test.cjs tests/assistant/dsh-runtime.test.cjs tests/assistant/dsh-runtime-installer.test.cjs tests/assistant/repair-runner.test.cjs tests/app/automatic-pdf-ledger.test.cjs tests/app/job-records.test.cjs tests/order-rules/version-compatibility.test.cjs tests/bpm-display-policy.test.cjs tests/bpm-dynamicarea.test.cjs tests/bpm-readonly-form.test.cjs tests/bpm-form-contracts.test.cjs tests/bpm-obsolete-display-fields.test.cjs tests/order-rules/snapshot-read-context.test.cjs tests/order-rules/summary.test.cjs tests/order-rules/execution-single-flight.test.cjs tests/order-rules/execution-responsiveness.test.cjs tests/order-rules/readiness-pending-ui.test.cjs tests/dependency-compatibility.test.cjs tests/order-rules/slow-cutoff.test.cjs tests/order-rules/removed-discovery-barrier.test.cjs tests/mail/sample-send.test.cjs tests/mail/template-editing.test.cjs tests/mail/template-editor-ui.test.cjs tests/order-rules/scope-catalog.test.cjs tests/order-rules/field-mapping-ui.test.cjs tests/order-rules/scope-search-ui.test.cjs tests/order-rules/excel-import-contract.test.cjs tests/order-rules/excel-execution-bridge.test.cjs tests/order-rules/excel-import-flow-ui.test.cjs tests/order-rules/collecting-batches.test.cjs tests/order-rules/collecting-batches-ui.test.cjs tests/order-rules/query.test.cjs tests/order-rules/scheduled-mail-policy.test.cjs",
+ "test:business": "node --test --test-concurrency=1 tests/app/business-home-ui.test.cjs tests/order-rules/home-summary.test.cjs tests/order-rules/carry-forward-core.test.cjs tests/order-rules/carry-forward-integration.test.cjs tests/order-rules/dispatch-unsent-proof.test.cjs tests/order-rules/dismiss-task.test.cjs tests/app/carry-dismiss-ui.test.cjs tests/workspace/business-issues.test.cjs tests/mail/unified-account.test.cjs tests/mail/unified-account-ui.test.cjs tests/assistant/assistant.test.cjs tests/assistant/assistant-http-ui.test.cjs tests/assistant/controlled-operations.test.cjs tests/assistant/dsh-runtime.test.cjs tests/assistant/dsh-runtime-installer.test.cjs tests/assistant/repair-runner.test.cjs tests/app/automatic-pdf-ledger.test.cjs tests/app/job-records.test.cjs tests/order-rules/version-compatibility.test.cjs tests/bpm-display-policy.test.cjs tests/bpm-dynamicarea.test.cjs tests/bpm-readonly-form.test.cjs tests/bpm-form-contracts.test.cjs tests/bpm-obsolete-display-fields.test.cjs tests/order-rules/snapshot-read-context.test.cjs tests/order-rules/summary.test.cjs tests/order-rules/execution-single-flight.test.cjs tests/order-rules/execution-responsiveness.test.cjs tests/order-rules/readiness-pending-ui.test.cjs tests/dependency-compatibility.test.cjs tests/order-rules/slow-cutoff.test.cjs tests/order-rules/removed-discovery-barrier.test.cjs tests/mail/sample-send.test.cjs tests/mail/template-editing.test.cjs tests/mail/template-editor-ui.test.cjs tests/order-rules/scope-catalog.test.cjs tests/order-rules/field-mapping-ui.test.cjs tests/order-rules/scope-search-ui.test.cjs tests/order-rules/excel-import-contract.test.cjs tests/order-rules/excel-execution-bridge.test.cjs tests/order-rules/excel-import-flow-ui.test.cjs tests/order-rules/collecting-batches.test.cjs tests/order-rules/collecting-batches-ui.test.cjs tests/order-rules/query.test.cjs tests/order-rules/scheduled-mail-policy.test.cjs",
"test:full": "node --test --test-concurrency=2 \"tests/**/*.test.cjs\""
},
"engines": {
diff --git a/src/app/assets.cjs b/src/app/assets.cjs
index a13661c..dc82854 100644
--- a/src/app/assets.cjs
+++ b/src/app/assets.cjs
@@ -42,6 +42,8 @@ function createAssets(){
'/modules/order-notifications/detail.js':{path:path.join(webRoot,'modules/order-notifications/detail.js'),type:'text/javascript'},
'/modules/order-notifications/batch-editor.js':{path:path.join(webRoot,'modules/order-notifications/batch-editor.js'),type:'text/javascript'},
'/modules/order-notifications/records.js':{path:path.join(webRoot,'modules/order-notifications/records.js'),type:'text/javascript'},
+ '/business-home.js':{path:path.join(webRoot,'modules/order-notifications/home.js'),type:'text/javascript'},
+ '/business-home.css':{path:path.join(webRoot,'modules/order-notifications/home.css'),type:'text/css'},
'/order-notifications.js':{path:path.join(webRoot,'modules/order-notifications/view.js'),type:'text/javascript'},
'/order-rules.js':{path:path.join(webRoot,'modules/order-rules/view.js'),type:'text/javascript'},
'/notifications.js':{path:path.join(webRoot,'modules/notifications/view.js'),type:'text/javascript'},
diff --git a/src/modules/order-rules/query.cjs b/src/modules/order-rules/query.cjs
index 3ad08de..f61208a 100644
--- a/src/modules/order-rules/query.cjs
+++ b/src/modules/order-rules/query.cjs
@@ -132,6 +132,14 @@ function summary(context,user){
const count=(items,status)=>items.filter(i=>status.includes(i.status)).length;
result.scans=context.orderRules.all('execution-scans').filter(s=>canReadConnection(context.workspace,user,s.connectionId||s.id)).map(s=>pick(s,['id','connectionId','status','startedAt','finishedAt','rowCount','targetCount','error']));
result.counts={orders:rows.length,blocked:rows.filter(row=>['blocked','failed'].includes(row.status)||row.notifications?.huizhou?.status==='blocked').length,unknown:count(batches,['unknown']),activeBatches:count(batches,['collecting','prepared','sending','unknown','failed'])};
+ const authorized=new Set(batches),current=collecting.filter(batch=>authorized.has(batch));
+ result.home={
+ pendingOrders:new Set(current.flatMap(batch=>batch.orderIds||[])).size,
+ collectingBatches:current.length,
+ carriedOrders:new Set(current.flatMap(batch=>batch.carriedOrderIds||[])).size,
+ batches:current.slice(0,4).map(batch=>({id:batch.id,categoryId:batch.categoryId,categoryName:batch.ruleSnapshot?.name||batch.categoryId,notificationMode:modeOf(batch),orderCount:batch.orderIds?.length||0,carryCount:batch.carriedOrderIds?.length||0,cutoff:batch.cutoff,error:batch.error||null})),
+ lastScanAt:result.scans.filter(scan=>scan.status==='complete'&&Number.isFinite(Date.parse(scan.finishedAt))).sort((a,b)=>Date.parse(b.finishedAt)-Date.parse(a.finishedAt))[0]?.finishedAt||null
+ };
result.issues=data.issues.filter(issue=>!['resolved','retired'].includes(issue.status)).filter(issue=>user.role==='admin'||((issue.orderIds?.length||issue.taskIds?.length)&& (issue.orderIds||[]).every(id=>canReadOrder(context.workspace,user,context.orderRules.get('orders',id)))&&(issue.taskIds||[]).every(id=>canReadConnection(context.workspace,user,context.orderRules.get('execution-tasks',id)?.connectionId)))).slice(-50).map(i=>{const linked=context.workspace?.businessIssue?.(i.id);return pick(linked?{...i,status:linked.status,owner:linked.owner,exceptionId:linked.id}:i,['id','status','type','message','error','component','notificationMode','owner','owners','exceptionId','createdAt','batchId','orderIds','taskIds']);}).filter(i=>!['resolved','retired'].includes(i.status));
result.templateUsage=context.orderRules.all('rules').map(r=>({categoryId:r.published?.categoryId||r.draft?.categoryId,name:r.draft?.name,templateId:r.published?.bodyTemplateId||'',huizhouEnabled:r.published?.huizhouEnabled===true,huizhouTemplateId:r.published?.huizhouTemplateId||'',legacyBinding:!!r.published&&r.published.bodyTemplateId===undefined,publishedVersion:r.published?.version||null,status:r.published?.status||'draft'}));
result.revision=crypto.createHash('sha256').update(publicRevision(context,user)+JSON.stringify([result.window,result.issues])).digest('hex').slice(0,24);
diff --git a/tests/app/business-home-ui.test.cjs b/tests/app/business-home-ui.test.cjs
new file mode 100644
index 0000000..74e3744
--- /dev/null
+++ b/tests/app/business-home-ui.test.cjs
@@ -0,0 +1,8 @@
+'use strict';
+const test=require('node:test'),assert=require('node:assert/strict');const {orderDrivenUI}=require('../fixtures/order-driven-ui.cjs');
+function summary(){return {settings:{enabled:true,processingEnabled:true},counts:{orders:11,blocked:0,unknown:0,activeBatches:2},window:{start:'2026-10-27T03:00:00Z',end:'2026-10-27T09:00:00Z',collectionStart:'2026-10-27T02:55:00Z',collectionEnd:'2026-10-27T08:55:00Z'},capabilities:{liveTodo:true,pdfExport:true,automaticArchive:true},scans:[{status:'complete',finishedAt:'2026-10-27T03:59:00Z'}],issues:[],home:{pendingOrders:7,collectingBatches:2,carriedOrders:6,lastScanAt:'2026-10-27T03:59:00Z',batches:[{id:'collecting-test',categoryId:'overseas-change',categoryName:'海外订单更改通知书',notificationMode:'normal',orderCount:6,carryCount:6,cutoff:'2026-10-27T09:00:00Z',error:null},{id:'collecting-other',categoryName:'海外订单通知书',notificationMode:'normal',orderCount:1,carryCount:0,cutoff:'2026-10-27T09:00:00Z',error:null}]}};}
+async function setup(t){const f=await orderDrivenUI(t,'#overview'),data=summary();await f.page.clock.install({time:new Date('2026-10-27T04:00:00Z')});await f.page.route('**/api/order-rules?view=summary',r=>r.fulfill({json:data}));await f.page.reload();return {...f,data};}
+test('business home presents actual next window and deduplicated work, keeps mobile layout and reduced motion',{timeout:60000},async t=>{const {page}=await setup(t);await page.locator('[data-business-home]').waitFor();assert.equal(await page.locator('[data-home-metric="pending"]').innerText(),'7');assert.equal(await page.locator('[data-home-next-send]').innerText(),'17:00');assert.match(await page.locator('[data-home-cutoff]').innerText(),/16:55/);assert.equal(await page.locator('[data-home-batch]').count(),2);assert.match(await page.locator('[data-home-batch]').first().innerText(),/6.*顺延/s);assert.equal(await page.getByRole('link',{name:'查看全部批次',exact:true}).getAttribute('href'),'#notification-batches');await require('node:fs/promises').mkdir('output/business-flow-test/home-visual',{recursive:true});await page.screenshot({path:'output/business-flow-test/home-visual/desktop.png',fullPage:true});await page.setViewportSize({width:674,height:1000});await page.screenshot({path:'output/business-flow-test/home-visual/compact.png',fullPage:true});await page.emulateMedia({reducedMotion:'reduce'});assert.equal(await page.locator('.home-live .status-dot').evaluate(e=>getComputedStyle(e,'::before').animationName),'none');await page.setViewportSize({width:390,height:844});assert.equal(await page.evaluate(()=>document.documentElement.scrollWidth<=innerWidth),true);await page.screenshot({path:'output/business-flow-test/home-visual/mobile.png',fullPage:true});});
+test('paused and blocked states remain honest and the clock never claims delivery at the deadline',{timeout:60000},async t=>{const {page,data}=await setup(t);await page.locator('[data-business-home]').waitFor();await page.clock.fastForward(5*3600000+1000);assert.match(await page.locator('[data-home-countdown]').innerText(),/刷新.*发送结果/);data.settings.enabled=false;data.capabilities.liveTodo=false;data.issues=[{id:'i',error:' ',status:'open'}];await page.reload();await page.getByText('自动邮件已暂停',{exact:true}).waitFor();assert.equal(await page.locator('.home-live .status-dot-animated').count(),0);assert.equal(await page.locator('.home-issues img').count(),0);assert.match(await page.locator('.home-issues').innerText(),/img src/);});
+test('failed summary loading never displays invented zero counts or healthy state',{timeout:60000},async t=>{const {page}=await setup(t);await page.unroute('**/api/order-rules?view=summary');await page.route('**/api/order-rules?view=summary',r=>r.fulfill({status:503,json:{error:'首页数据暂不可用'}}));await page.reload();await page.getByText('首页数据暂不可用',{exact:false}).first().waitFor();assert.equal(await page.locator('[data-business-home]').count(),0);});
+test('failed internal refresh retains the last home and offers a working retry',{timeout:60000},async t=>{const {page,data}=await setup(t);await page.locator('[data-business-home]').waitFor();await page.unroute('**/api/order-rules?view=summary');let fail=true;await page.route('**/api/order-rules?view=summary',r=>fail?r.fulfill({status:503,json:{error:'暂时不可用'}}):r.fulfill({json:data}));await page.clock.fastForward(15001);await page.locator('[data-business-updates]').waitFor();await page.getByRole('button',{name:'刷新业务首页',exact:true}).click();await page.getByText('刷新失败:暂时不可用',{exact:false}).waitFor();assert.equal(await page.locator('[data-home-metric="pending"]').innerText(),'7');fail=false;await page.getByRole('button',{name:'刷新业务首页',exact:true}).click();await page.locator('[data-business-updates]').waitFor({state:'hidden'});assert.equal(await page.locator('[data-home-metric="pending"]').innerText(),'7');});
diff --git a/tests/order-rules/home-summary.test.cjs b/tests/order-rules/home-summary.test.cjs
new file mode 100644
index 0000000..18f3bec
--- /dev/null
+++ b/tests/order-rules/home-summary.test.cjs
@@ -0,0 +1,67 @@
+'use strict';
+const test=require('node:test'),assert=require('node:assert/strict');
+const {summary}=require('../../src/modules/order-rules/query.cjs');
+const {windowForCutoff}=require('../../src/modules/order-rules/window.cjs');
+const alice={username:'alice',role:'operator'},admin={username:'admin',role:'admin'};
+function fixture(){
+ const data={},schedule={times:['11:00','17:00'],weekends:false};
+ const store={all:k=>data[k]||[],get:(k,id)=>(data[k]||[]).find(r=>r.id===id),snapshot:()=>({}),clock:()=>new Date('2026-10-26T01:00:00Z'),schedule:()=>schedule,calendar:()=>[],settings:()=>({}),intakeWindow:()=>null};
+ const add=(id,categoryId='a',connectionId='alice-source',extra={})=>{
+ const event={source:'todo',connectionId,taskId:id,instanceId:id,processName:'process',nodeName:'node',receivedAt:'2026-10-26T00:30:00Z',fields:{private:'RAW-SECRET'}};
+ const rule={id:categoryId,categoryId,name:'Category '+categoryId,version:1,scopes:[{processName:'process',nodeName:'node'}],huizhouEnabled:true,to:['SECRET@example.com'],cc:['CC@example.com'],intro:'BODY-SECRET'};
+ const order={id,categoryId,status:'pending',sample:event,event,ruleSnapshot:rule,notifications:{huizhou:{status:'pending',orderNos:['H-'+id],issues:[]}},...extra};
+ (data.orders||=[]).push(order);return order;
+ };
+ return {data,store,add,context:{orderRules:store,workspace:{recordSources:()=>[{id:'alice-source',owner:'alice'},{id:'bob-source',owner:'bob'}]}}};
+}
+
+test('home counts physical orders once across normal and Hui current collection and omits historical/removed orders',()=>{
+ const f=fixture();f.add('one');f.add('two');f.add('removed','removed','alice-source',{removedAt:'2026-10-26T00:40:00Z'});
+ const old=f.add('old','old');old.event.receivedAt='2026-10-20T00:00:00Z';
+ f.data.batches=[{id:'prepared-old',categoryId:'old',status:'prepared',orderIds:['old']},{id:'unknown-old',status:'unknown',orderIds:['old']}];
+ const result=summary(f.context,alice);
+ assert.equal(result.home?.pendingOrders,2);assert.equal(result.home.collectingBatches,2);assert.equal(result.home.carriedOrders,0);
+ assert.deepEqual(result.counts,{orders:3,blocked:0,unknown:1,activeBatches:4});
+ assert.deepEqual(result.home.batches.map(b=>[b.categoryName,b.notificationMode,b.orderCount,b.carryCount,b.cutoff]),[
+ ['Category a','normal',2,0,'2026-10-26T03:00:00.000Z'],['Category a','huizhou',2,0,'2026-10-26T03:00:00.000Z']]);
+ for(const row of result.home.batches){assert.deepEqual(Object.keys(row).sort(),['id','categoryId','categoryName','notificationMode','orderCount','carryCount','cutoff','error'].sort());assert.equal(typeof row.error,'string');}
+ assert.doesNotMatch(JSON.stringify(result.home),/SECRET|orderIds|ruleSnapshot|subject|text|html/);
+});
+
+test('home respects entire-batch ownership for operators and viewers, and rechecks ownership each request',()=>{
+ const f=fixture();f.add('own','own');f.add('mixed-own','mixed');f.add('mixed-private','mixed','bob-source');f.add('private','private','bob-source');
+ for(const role of ['operator','viewer']){const home=summary(f.context,{...alice,role}).home;assert.equal(home?.pendingOrders,1);assert.equal(home.collectingBatches,2);assert(home.batches.every(b=>b.categoryId==='own'));}
+ assert.equal(summary(f.context,admin).home.pendingOrders,4);assert.equal(summary(f.context,admin).home.collectingBatches,6);
+ f.context.workspace.recordSources=()=>[{id:'alice-source',owner:'bob'},{id:'bob-source',owner:'bob'}];
+ assert.deepEqual(summary(f.context,alice).home,{pendingOrders:0,collectingBatches:0,carriedOrders:0,batches:[],lastScanAt:null});
+});
+
+test('home previews at most four groups without truncating aggregate counts',()=>{
+ const f=fixture();for(const id of ['a','b','c'])f.add(id,id);
+ const home=summary(f.context,admin).home;
+ assert.equal(home?.batches.length,4);assert.equal(home.collectingBatches,6);assert.equal(home.pendingOrders,3);
+});
+
+test('home deduplicates carried physical orders across notification modes without mutating durable records',()=>{
+ const f=fixture(),order=f.add('carried');
+ order.archive={archivedAt:'2026-10-23T02:00:00Z',files:[{name:'x.pdf',path:'C:\\x.pdf',sha256:'a'.repeat(64),size:1,kind:'pdf'}]};
+ order.event.receivedAt='2026-10-23T01:00:00Z';
+ f.data['execution-tasks']=[{id:'task',orderId:order.id,connectionId:'alice-source',row:order.sample,sampleId:'capture',status:'pending',step:'complete'}];
+ f.data['capture-samples']=[{id:'capture',taskId:'task',provenance:'server-provider',sample:order.sample,snapshot:{html:'
capture
'}}];
+ f.store.intakeWindow=()=>windowForCutoff('2026-10-23T03:00:00.000Z',f.store.schedule());
+ const basisHash=require('../../src/modules/order-rules/task-identity.cjs').digest([order.sourceHash,order.sample,order.ruleSnapshot,order.archiveGeneration,order.archive]);
+ order.carryForward={normal:{basisHash,targetCutoff:'2026-10-26T03:00:00.000Z'},huizhou:{basisHash,targetCutoff:'2026-10-26T03:00:00.000Z'}};
+ const before=structuredClone(f.data),home=summary(f.context,alice).home;
+ assert.equal(home?.carriedOrders,1);assert.equal(home.pendingOrders,1);assert.deepEqual(home.batches.map(b=>b.carryCount),[1,1]);assert.deepEqual(f.data,before);
+});
+
+test('home last scan selects latest valid successful authorized completion and supports empty state',()=>{
+ const f=fixture();assert.deepEqual(summary(f.context,alice).home,{pendingOrders:0,collectingBatches:0,carriedOrders:0,batches:[],lastScanAt:null});
+ f.data['execution-scans']=[
+ {id:'older',connectionId:'alice-source',status:'complete',finishedAt:'2026-10-26T00:00:00Z'},
+ {id:'latest',connectionId:'alice-source',status:'complete',finishedAt:'2026-10-26T00:30:00Z'},
+ {id:'failed',connectionId:'alice-source',status:'failed',finishedAt:'2026-10-26T00:50:00Z'},
+ {id:'invalid',connectionId:'alice-source',status:'complete',finishedAt:'bad-date'},
+ {id:'private',connectionId:'bob-source',status:'complete',finishedAt:'2026-10-26T00:55:00Z'}];
+ assert.equal(summary(f.context,alice).home.lastScanAt,'2026-10-26T00:30:00Z');assert.equal(summary(f.context,admin).home.lastScanAt,'2026-10-26T00:55:00Z');
+});
diff --git a/web/index.html b/web/index.html
index 0c89c07..71c0580 100644
--- a/web/index.html
+++ b/web/index.html
@@ -1,3 +1,3 @@
-订单通知中心
-
+订单通知中心
+
diff --git a/web/modules/order-notifications/home.css b/web/modules/order-notifications/home.css
new file mode 100644
index 0000000..64a5a33
--- /dev/null
+++ b/web/modules/order-notifications/home.css
@@ -0,0 +1,14 @@
+.business-home{--home-blue:#206bc4;--home-ink:#183153;--home-muted:#62748b;--home-border:#e2e9f2;display:grid;gap:20px;color:var(--home-ink)}
+.business-home .home-icon{width:22px;height:22px;flex:0 0 auto;vertical-align:middle}.business-home .card{border-color:var(--home-border);border-radius:14px;box-shadow:0 3px 16px rgba(30,60,100,.025)}
+.home-hero{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(260px,.9fr);overflow:hidden;background:linear-gradient(112deg,#fff 25%,#f0f7ff 100%)}.home-hero-content{padding:30px 32px 28px;position:relative;z-index:1}.home-eyebrow{display:flex;align-items:center;gap:9px;font-size:14px;color:#4b6c92;font-weight:600}.home-eyebrow .home-icon{width:19px;height:19px}.home-send-time{display:flex;align-items:baseline;gap:16px;margin:9px 0 8px;flex-wrap:wrap}.home-send-time>strong{font-size:64px;line-height:1.08;letter-spacing:-3px;font-weight:650;font-variant-numeric:tabular-nums;color:#173e70}.home-send-time>span{font-size:14px;color:var(--home-muted)}.home-window-state{display:flex;gap:9px;flex-wrap:wrap;font-size:14px;line-height:1.6}.home-window-state>[data-home-phase]{font-weight:600}.home-separator{color:#93a9c2}.home-cutoff{margin:9px 0 20px;font-size:13px;color:var(--home-muted)}.home-cutoff span{margin-left:8px;font-size:11px;color:#788aa0}.home-hero-actions{display:flex;align-items:center;gap:22px;flex-wrap:wrap}.home-hero-actions .btn{padding:10px 16px;border-radius:8px;box-shadow:0 4px 12px #206bc420}.home-hero-actions .btn .home-icon{width:18px;height:18px;margin-right:7px}.home-text-link{font-size:12px;color:#386898;text-decoration:none;display:inline-flex;align-items:center;gap:4px;white-space:nowrap}.home-text-link .home-icon{width:15px;height:15px}.home-text-link:hover{color:#1458a7;text-decoration:underline}
+.home-hero-footer{grid-column:1/-1;display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;padding:13px 32px;border-top:1px solid #dde8f4;background:#ffffffa6;font-size:12px;color:var(--home-muted)}.home-live{display:inline-flex;align-items:center;gap:8px;color:#88712e}.home-live.is-live{color:#207e61}.home-switches{display:flex;gap:20px;flex-wrap:wrap}.home-switches b{font-weight:500;margin-left:5px;color:#425c7b}.home-stale .home-live{color:#88712e}.home-update{margin:0;display:flex;justify-content:space-between;align-items:center;gap:12px}
+.home-scene{position:relative;width:360px;height:230px;max-width:100%;align-self:center;justify-self:center;color:#6395ce;background-image:radial-gradient(#a8c4e24d 1px,transparent 1px);background-size:18px 18px;margin:10px 20px}.home-scene-orbit{position:absolute;width:210px;height:210px;left:80px;top:0;border:1px solid #bfd4ee75;border-radius:50%;background:radial-gradient(circle,#dfedff8c,transparent 68%)}.home-scene-orbit:after{content:'';position:absolute;inset:20px;border:1px solid #c2d7f24d;border-radius:50%}.home-scene-path{position:absolute;inset:0;width:100%;height:100%;color:#93b6df}.home-scene-source,.home-scene-mail{position:absolute;z-index:2;display:flex;align-items:center;background:#fff;border:1px solid #dbe6f3;border-radius:11px;box-shadow:0 9px 22px #315b9210}.home-scene-source{left:2px;top:142px;padding:12px 13px;gap:8px;font-size:11px;color:#4e709a}.home-scene-source .home-icon{width:19px;height:19px}.home-scene-source i{width:5px;height:5px;background:#99b7d9;border-radius:50%;margin-left:5px}.home-scene-sheet{position:absolute;top:23px;left:124px;width:127px;height:151px;background:white;border:1px solid #cddff3;border-radius:11px;padding:17px;transform:rotate(-6deg);box-shadow:6px 10px 0 -2px #e2edfa,6px 10px 0 -1px #c6daef,0 14px 30px #315b9210;transition:transform .2s ease}.home-hero:hover .home-scene-sheet{transform:translateY(-3px) rotate(-4deg)}.home-paper-icon{display:flex;align-items:center;justify-content:center;width:35px;height:35px;background:#eaf3ff;border-radius:9px;color:#377ac6;margin-bottom:10px}.home-paper-icon .home-icon{width:23px;height:23px}.home-scene-sheet>b{font-size:11px;color:#365b89;display:block}.home-paper-line{display:block;height:4px;margin-top:7px;border-radius:3px;background:#e5edf7;width:100%}.home-paper-line.short{width:65%}.home-paper-bottom{display:flex;align-items:center;gap:5px;font-size:9px;color:#7890ac;margin-top:10px}.home-paper-bottom .home-icon{width:12px;height:12px}.home-scene-mail{right:0;top:164px;gap:10px;padding:12px 15px;min-width:145px}.home-scene-mail>.home-icon{width:28px;height:28px;color:#377ac6}.home-scene-mail b{font-size:12px;color:#365b89;display:block}.home-scene-mail small{display:block;font-size:10px;margin-top:2px;color:#8395ad}.is-scanning .home-scene-path path{animation:home-flow 18s linear infinite}@keyframes home-flow{to{stroke-dashoffset:-100}}
+.home-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}.home-kpi{padding:20px 21px;color:inherit;text-decoration:none;min-width:0;transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease}.home-kpi:hover{color:inherit;border-color:#bed2eb!important;transform:translateY(-3px);box-shadow:0 8px 24px #315b9212!important}.home-kpi:focus-visible,.home-batch:focus-visible{outline:3px solid #91b8ed;outline-offset:3px}.home-kpi-top{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:12px;color:var(--home-muted)}.home-symbol{display:inline-flex;align-items:center;justify-content:center;width:37px;height:37px;border-radius:10px;flex:0 0 auto}.home-symbol-blue{background:#edf4fe;color:#3475c4}.home-symbol-cyan{background:#eaf8fb;color:#288b9f}.home-symbol-amber{background:#fff5e6;color:#b47b24}.home-symbol-violet{background:#f1edfc;color:#8065b3}.home-symbol .home-icon{width:21px;height:21px}.home-kpi-value{display:flex;align-items:baseline;gap:8px;margin:8px 0 14px}.home-kpi-value strong{font-size:34px;line-height:1.2;font-weight:650;letter-spacing:-.7px;font-variant-numeric:tabular-nums}.home-kpi-value span{font-size:11px;color:#8391a4}.home-kpi-note{display:flex;justify-content:space-between;align-items:center;border-top:1px solid #edf1f6;padding-top:11px;font-size:11px;color:#7b8ca2}.home-kpi-note .home-icon{width:14px;height:14px}
+.home-main-grid{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(260px,1fr);gap:20px}.home-card{overflow:hidden;min-width:0}.home-card-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:22px 24px 18px}.home-card-heading h2{display:flex;align-items:center;gap:8px;font-size:15px;font-weight:650;margin:0}.home-card-heading h2>.home-icon{width:19px;height:19px;color:#6c88ab}.home-card-heading p{font-size:11px;color:#8190a3;margin:6px 0 0}.home-window-track{margin:0 24px 14px;padding:14px 16px;background:#f6f9fd;border:1px solid #edf2f8;border-radius:9px}.home-window-labels{display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap;color:#627991;font-size:11px;margin-bottom:10px}.home-window-track .progress{height:5px;background:#e3ecf7}.home-window-track .progress-bar{background:#659bda;transition:width .4s ease}.home-window-help{display:flex;justify-content:space-between;gap:6px;flex-wrap:wrap;margin-top:9px;font-size:10px;color:#8191a6}.home-window-help>span{color:#5a7da6}.home-batch-list{padding:0 24px 10px}.home-batch{display:flex;align-items:center;gap:12px;padding:17px 0;border-bottom:1px solid #edf1f6;text-decoration:none;color:inherit}.home-batch:last-child{border-bottom:0}.home-batch:hover{color:inherit}.home-batch:hover .home-batch-copy strong{color:#206bc4}.home-batch-copy{flex:1;min-width:0}.home-batch-copy strong{display:block;font-size:12px;font-weight:600;overflow-wrap:anywhere}.home-batch-copy small{display:block;font-size:10px;color:#8291a4;margin-top:5px;overflow-wrap:anywhere}.home-batch-count{font-size:23px;color:#274e7d;font-variant-numeric:tabular-nums;white-space:nowrap}.home-batch-count small{font-size:10px;margin-left:4px;color:#8c9aab}.home-batch>.home-icon{width:15px;height:15px;color:#9badc1}.home-mini-empty{padding:23px 12px 30px;text-align:center;color:#8aa0ba}.home-mini-empty>.home-icon{width:34px;height:34px;margin:0 0 10px}.home-mini-empty p{font-size:13px;margin:0 0 6px;color:#566f8b}.home-mini-empty span{font-size:11px}.home-conditions{padding:0 24px}.home-condition{display:flex;align-items:center;gap:10px;padding:13px 0;color:inherit;text-decoration:none;font-size:12px;border-bottom:1px solid #edf1f6}.home-condition:last-child{border-bottom:0}.home-condition-icon{display:flex;color:#7591b3}.home-condition-icon .home-icon{width:18px;height:18px}.home-condition .badge{margin-left:auto;font-size:10px;font-weight:500}.home-scan-note{background:#f8fafc;border-radius:8px;padding:12px 14px;margin:13px 24px;font-size:10px;line-height:1.8;color:#8593a5}.home-scan-note strong{font-size:11px;font-weight:500;color:#5c718b}.home-condition-foot{margin:0 24px 20px;color:#8b98aa;font-size:10px;line-height:1.9}.home-condition-foot .home-icon{width:12px;height:12px}
+.home-issue-count{display:inline-flex;align-items:center;justify-content:center;min-width:21px;height:21px;border-radius:6px;background:#f0f4f9;font-size:11px;color:#7188a4;margin-left:2px}.home-clear-state{display:flex;align-items:center;gap:18px;padding:7px 26px 28px}.home-clear-symbol{display:flex;align-items:center;justify-content:center;width:62px;height:62px;flex-shrink:0;border-radius:18px;background:linear-gradient(135deg,#f2f7ff,#eaf2fd);color:#6396d2;box-shadow:inset 0 0 0 1px #dfeafa}.home-clear-symbol .home-icon{width:32px;height:32px}.home-clear-state h3{font-size:14px;margin:0 0 6px}.home-clear-state p{color:#8190a4;font-size:11px;margin:0}.home-clear-state .btn{margin-left:auto;font-size:12px;border-color:#c9d9ec;color:#527aa9;flex-shrink:0}.home-issue-list{padding:0 24px 12px}.home-issue-list article{display:flex;align-items:flex-start;gap:13px;padding:15px 0;border-top:1px solid #edf1f6;overflow-wrap:anywhere}.home-issue-list strong{font-size:13px}.home-issue-list p,.home-issue-list a{font-size:11px}.home-issue-list p{margin:6px 0;color:var(--home-muted)}
+.home-stale *, .home-stale *::before,.home-stale *::after{animation-play-state:paused!important}
+@media(min-width:1400px){.home-hero-content{padding-left:36px}.home-scene{margin-right:50px}.home-kpi{padding:22px 24px}}
+@media(max-width:991px){.home-main-grid{grid-template-columns:minmax(0,1fr)}.home-hero{grid-template-columns:minmax(0,1fr) minmax(210px,.8fr)}.home-scene{width:280px;transform:scale(.84);transform-origin:center}.home-hero-content{padding:26px 24px}.home-hero-footer{padding:13px 24px}.home-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.home-clear-state{flex-wrap:wrap}.home-clear-state .btn{margin-left:80px}}
+@media(max-width:575px){.business-home{gap:14px}.home-hero{grid-template-columns:minmax(0,1fr)}.home-hero-content{padding:24px 22px 19px}.home-send-time>strong{font-size:56px}.home-send-time{gap:12px}.home-scene{display:none}.home-window-state{font-size:12px;gap:6px}.home-hero-footer{padding:12px 22px;gap:8px}.home-switches{gap:12px;font-size:10px}.home-kpis{gap:10px}.home-kpi{padding:15px 14px}.home-kpi-top{font-size:11px;gap:5px;align-items:flex-start}.home-kpi-top .home-symbol{width:28px;height:28px;border-radius:8px}.home-kpi-top .home-icon{width:17px;height:17px}.home-kpi-value strong{font-size:29px}.home-kpi-note{font-size:10px}.home-card-heading{padding:18px 18px 14px}.home-window-track{margin:0 18px 9px;padding:12px}.home-batch-list,.home-conditions,.home-issue-list{padding-left:18px;padding-right:18px}.home-batch{gap:9px}.home-batch-copy strong{font-size:11px}.home-batch-copy small{font-size:10px}.home-batch .home-symbol{width:30px;height:30px}.home-batch>.home-icon{display:none}.home-batch-count{font-size:20px}.home-scan-note{margin:12px 18px}.home-condition-foot{margin:0 18px 18px}.home-clear-state{padding:4px 18px 22px;gap:12px}.home-clear-symbol{width:45px;height:45px;border-radius:12px}.home-clear-symbol .home-icon{width:25px;height:25px}.home-clear-state>div{flex:1;min-width:170px}.home-clear-state h3{font-size:12px}.home-clear-state .btn{margin-left:57px}.home-update{align-items:flex-start;font-size:12px}.home-hero-actions{gap:14px}}
+@media(prefers-reduced-motion:reduce){.business-home *, .business-home *::before,.business-home *::after,.home-loading *, .home-loading *::before,.home-loading *::after{animation:none!important;transition:none!important}.home-kpi:hover,.home-hero:hover .home-scene-sheet{transform:none}}
+.business-home .home-hero-actions .btn-primary{background:#206bc4;border-color:#206bc4;color:#fff}.business-home .home-hero-actions .btn-primary:hover{background:#185ba9;border-color:#185ba9}.home-live .status-dot{background:currentColor}.home-live.is-live .status-dot-animated::before{animation-duration:2.4s}
diff --git a/web/modules/order-notifications/home.js b/web/modules/order-notifications/home.js
new file mode 100644
index 0000000..24d834f
--- /dev/null
+++ b/web/modules/order-notifications/home.js
@@ -0,0 +1,27 @@
+'use strict';
+window.BusinessHome=(()=>{
+ // Tabler Icons (MIT), copyright Paweł Kuna. See licenses/Tabler-Icons-MIT.txt.
+ const icons={"alert-circle":" \n \n ","arrow-right":" \n \n ","check":" ","clock-hour-4":" \n \n ","database":" \n \n ","file-type-pdf":" \n \n \n \n \n ","mail-forward":" \n \n \n ","route":" \n \n ","shield-check":" \n "};
+ const icon=name=>''+(icons[name]||icons['route'])+' ';
+ const number=value=>Number.isSafeInteger(value)&&value>=0?String(value):'—';
+ const valid=value=>typeof value==='string'&&Number.isFinite(Date.parse(value));
+ const time=value=>valid(value)?new Intl.DateTimeFormat('zh-CN',{timeZone:'Asia/Shanghai',hour:'2-digit',minute:'2-digit',hour12:false}).format(new Date(value)):'—';
+ const day=value=>new Intl.DateTimeFormat('en-CA',{timeZone:'Asia/Shanghai',year:'numeric',month:'2-digit',day:'2-digit'}).format(new Date(value));
+ const short=value=>valid(value)?new Intl.DateTimeFormat('zh-CN',{timeZone:'Asia/Shanghai',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',hour12:false}).format(new Date(value)):'未提供';
+ const on=value=>value===true?'已启用':value===false?'已暂停':'未取得';
+ function loading(){return '
'+Array.from({length:4},()=>'
').join('')+'
';}
+ function mount(container,data,{esc,formatDate,isActive}){
+ const c=data.counts||{},h=data.home||{},w=data.window,s=data.settings||{},caps=data.capabilities||{},issues=(data.issues||[]).filter(i=>!['resolved','retired'].includes(i.status));
+ const ready=['liveTodo','pdfExport','automaticArchive'].every(k=>caps[k]===true),live=s.enabled===true&&s.processingEnabled===true&&ready&&!issues.length&&!c.blocked&&!c.unknown;
+ const state=typeof s.enabled!=='boolean'?'设置状态未取得':!s.enabled?'自动邮件已暂停':!s.processingEnabled?'自动处理已暂停':!ready?'运行条件待验证':issues.length||c.blocked||c.unknown?'有事项待处理':'自动通知已启用';
+ const collectingLink='#notification-batches?scope=active&status=collecting';
+ const metric=(key,title,value,symbol,tone,href,note)=>''+title+' '+icon(symbol)+'
'+number(value)+' 项
'+note+icon('arrow-right')+'
';
+ const scene='
'+icon('route')+'BPM 通知
'+icon('file-type-pdf')+' 订单通知书 '+icon('database')+' PDF 归档
'+icon('mail-forward')+'
分类汇总 按计划发送
';
+ container.innerHTML=''+icon('clock-hour-4')+' 下一批通知
'+time(w?.end)+'
·
到达截止 '+time(w?.collectionEnd||w?.end)+' 北京时间
'+scene+'业务状态有更新。 刷新业务首页
'+metric('pending','本轮待汇总订单',h.pendingOrders,'file-type-pdf','blue',collectingLink,'查看本轮订单')+metric('batches','收集中批次',h.collectingBatches,'mail-forward','cyan',collectingLink,'按分类汇总')+metric('blocked','受阻 / 失败订单',c.blocked,'alert-circle','amber','#notification-orders','查看处理状态')+metric('unknown','结果待核实批次',c.unknown,'shield-check','violet','#notification-batches?scope=active&status=unknown','核对发送结果')+'
'+short(w?.collectionStart||w?.start)+' '+short(w?.collectionEnd||w?.end)+' 截止
发送前 5 分钟截止到达收集'+(h.carriedOrders?'含 '+number(h.carriedOrders)+' 单顺延,原到达时间保留 ':'')+'
'+icon('shield-check')+'运行条件 依据最近一次实际检查
详情 '+[['liveTodo','BPM 待办读取','route','#bpm'],['pdfExport','通知书 PDF 生成','file-type-pdf','#rule-fields'],['automaticArchive','文件自动归档','database','#storage']].map(([key,label,symbol,href])=>'
'+icon(symbol)+' '+label+' '+(caps[key]===true?'已就绪':'待验证')+' ').join('')+'
最近成功扫描'+esc(h.lastScanAt?formatDate(h.lastScanAt):'尚无成功扫描记录')+'
'+(issues.length?''+issues.map(i=>'
'+icon('alert-circle')+' '+esc(i.error||i.message||i.type||'业务受阻')+' '+esc(({open:'待处理',unassigned:'待分配',awaiting_verification:'待人工核验',in_progress:'处理中',verifying:'待核验'})[i.status]||'待处理')+' · 负责人:'+esc(i.owner||(i.owners||[]).join('、')||'未分配')+'
处理 / 核验异常 '+(i.batchId?' ·
查看原批次 ':'')+'
').join('')+'
':''+icon(ready?'shield-check':'clock-hour-4')+' 暂无待处理的业务异常 订单持续按分类积累,运行能力以检查结果为准。
查看订单中心 ')+' ';
+ const root=container.querySelector('[data-business-home]');let disposed=false,timer;
+ function tick(){if(disposed||!isActive()||!root.isConnected)return;const now=Date.now(),end=valid(w?.end)?Date.parse(w.end):NaN,start=Date.parse(w?.collectionStart||w?.start),cut=Date.parse(w?.collectionEnd||w?.end);const next=root.querySelector('[data-home-send-day]');next.textContent=Number.isFinite(end)?(day(end)===day(now)?'今天':new Intl.DateTimeFormat('zh-CN',{timeZone:'Asia/Shanghai',month:'numeric',day:'numeric'}).format(new Date(end)))+'计划发送':'暂无可用时点';let phase='等待发送窗口',countdown='请检查发送计划';if(Number.isFinite(end)){phase=now>=end?'已到计划发送时间':now>=cut?'本轮到达收集已截止':'本轮收集中';const minutes=Math.max(1,Math.ceil((end-now)/60000));countdown=now>=end?'请刷新确认发送结果':'距计划发送 '+(minutes>=60?Math.floor(minutes/60)+' 小时 ':'')+(minutes%60)+' 分钟';}if(s.enabled===false){phase='等待恢复';countdown='恢复后按已配置计划执行';}root.querySelector('[data-home-phase]').textContent=phase;root.querySelector('[data-home-countdown]').textContent=countdown;const progress=root.querySelector('[data-home-progress]'),ratio=Number.isFinite(start)&&Number.isFinite(cut)&&cut>start?Math.min(100,Math.max(0,(now-start)/(cut-start)*100)):0;progress.setAttribute('aria-valuenow',String(Math.round(ratio)));progress.querySelector('.progress-bar').style.width=ratio+'%';timer=setTimeout(tick,30000);}
+ root.classList.toggle('is-scanning',s.processingEnabled===true&&(data.scans||[]).some(scan=>scan.status==='scanning'));tick();
+ return {setStale(stale,failed=false){root.classList.toggle('home-stale',stale);root.querySelector('[data-home-live-label]').textContent=stale?(failed?'状态读取失败,显示上次结果':'有新状态待刷新'):state;},dispose(){disposed=true;clearTimeout(timer);}};
+ }
+ return {mount,loading};
+})();
diff --git a/web/modules/order-notifications/view.js b/web/modules/order-notifications/view.js
index 1c53367..17bf5ba 100644
--- a/web/modules/order-notifications/view.js
+++ b/web/modules/order-notifications/view.js
@@ -1,18 +1,18 @@
'use strict';
window.OrderNotificationViews=(()=>{
let helpers,homeDispose;
- async function render(container,isActive=()=>true,section='workbench'){
+ async function render(container,isActive=()=>true,section='workbench',prepared=null){
homeDispose?.();homeDispose=null;
const {api,esc,formatDate,user}=helpers;
if(['execution','orders','pending','history'].includes(section))return window.BusinessRecordViews.render(container,{...helpers,isActive},['execution','orders'].includes(section)?'orders':'batches');
- const data=await api('/order-rules?view=summary');if(!isActive())return;
+ if(section!=='settings')container.innerHTML=window.BusinessHome.loading();
+ const data=prepared||await api('/order-rules?view=summary');if(!isActive())return;
if(section==='settings')return settings(container,data,isActive);
- const shared=window.OrderNotificationShared.create({esc}),w=data.window,c=data.counts||{};
- container.innerHTML=`自动处理:${data.settings.processingEnabled?'已启用':'已暂停'} · 自动邮件:${data.settings.enabled?'已启用':'已暂停'}。BPM 节点由人工办理。
业务状态有更新。刷新业务首页
${[['订单中心',c.orders,'notification-orders'],['受阻订单',c.blocked,'notification-orders?status=blocked'],['结果待核实',c.unknown,'notification-batches?status=unknown'],['未终结批次',c.activeBatches,'notification-batches']].map(([label,count,href])=>`
`).join('')}
连续业务窗口 ${w?esc(formatDate(w.collectionStart||w.start))+' 至 '+esc(formatDate(w.collectionEnd||w.end)): '当前发送窗口不可用'}
按到达时间连续积累,发送前五分钟截止,本时点前最后五分钟归下一批。已冻结批次跨窗口继续显示;历史受阻任务需要明确处理,不自动补发。
下个发送时点:${esc(formatDate(w?.end))}
发送计划 ·
业务日历 ·
处理与邮件设置 未配置项与运行条件 ${shared.capabilities(data.capabilities)}${shared.capabilityBlockers(data.capabilities)}
分类规则 ·
字段映射 ·
BPM 连接 ·
邮箱 ${(data.issues||[]).filter(i=>!['resolved','retired'].includes(i.status)).map(i=>`
${esc(i.error||i.message||i.type||'业务受阻')} ${esc(({open:'待处理',unassigned:'待分配',awaiting_verification:'待人工核验',in_progress:'处理中',verifying:'待核验'})[i.status]||i.status||'待处理')} · 负责人:${esc(i.owner||(i.owners||[]).join('、')||'未分配')}
处理 / 核验异常 ${i.batchId?` ·
查看原批次 `:''}
`).join('')||'
暂无已记录的业务阻塞。实际就绪仍以运行条件与订单状态为准。
'}
`;
- let disposed=false,timer,controller;const notice=container.querySelector('[data-business-updates]'),signature=JSON.stringify(data);
- notice.querySelector('button').onclick=()=>render(container,isActive,'workbench');
- async function poll(){if(disposed||!isActive())return;try{controller=new AbortController();const fresh=await api('/order-rules?view=summary',undefined,{signal:controller.signal});if(!disposed&&isActive())notice.hidden=JSON.stringify(fresh)===signature;}catch{}finally{if(!disposed&&isActive())timer=setTimeout(poll,15000);}}
- timer=setTimeout(poll,15000);homeDispose=()=>{disposed=true;clearTimeout(timer);controller?.abort();};window.PageLifecycle.onDispose(homeDispose);
+ const home=window.BusinessHome.mount(container,data,{esc,formatDate,isActive});
+ let disposed=false,timer,controller,refreshController;const notice=container.querySelector('[data-business-updates]'),signature=JSON.stringify(data);
+ notice.querySelector('button').onclick=async event=>{const button=event.currentTarget;if(button.disabled)return;button.disabled=true;refreshController=new AbortController();try{const fresh=await api('/order-rules?view=summary',undefined,{signal:refreshController.signal});if(!disposed&&isActive())await render(container,isActive,'workbench',fresh);}catch(error){if(!disposed&&isActive()){notice.hidden=false;notice.querySelector('[data-update-text]').textContent='刷新失败:'+error.message+';仍显示上次结果。';home.setStale(true,true);}}finally{if(button.isConnected)button.disabled=false;}};
+ async function poll(){if(disposed||!isActive())return;try{controller=new AbortController();const fresh=await api('/order-rules?view=summary',undefined,{signal:controller.signal});if(!disposed&&isActive()){const changed=JSON.stringify(fresh)!==signature;notice.hidden=!changed;notice.querySelector('[data-update-text]').textContent='业务状态有更新。';home.setStale(changed);}}catch{if(!disposed&&isActive()){notice.hidden=false;notice.querySelector('[data-update-text]').textContent='状态读取失败,仍显示上次结果。';home.setStale(true,true);}}finally{if(!disposed&&isActive())timer=setTimeout(poll,15000);}}
+ timer=setTimeout(poll,15000);homeDispose=()=>{disposed=true;clearTimeout(timer);controller?.abort();refreshController?.abort();home.dispose();};window.PageLifecycle.onDispose(homeDispose);
}
async function settings(container,data,isActive){
const {api,esc,user,formatDate}=helpers,config=data.settings,admin=user.role==='admin',mail=await api('/mail').catch(error=>({channels:[],error:error.message}));if(!isActive())return;