feat(platform): add customer alert closure board

This commit is contained in:
lingniu
2026-07-05 04:42:20 +08:00
parent 36dbc26ea7
commit bb6f577141
3 changed files with 177 additions and 1 deletions

View File

@@ -551,6 +551,53 @@ export function NotificationRules() {
const ownerRows = coverageOwnerRows(rules, policies);
const totalActiveHits = ownerRows.reduce((total, row) => total + row.hitCount, 0);
const unhealthyLinkCount = (health?.linkHealth ?? []).filter((item) => item.status !== 'ok').length;
const notificationCustomerSteps = [
{
step: '01',
title: '发现问题',
value: `${priorityIssues.length.toLocaleString()} 待通知`,
detail: '断链、无来源、VIN缺失、字段缺失等问题先进入车辆服务告警队列。',
action: '告警队列',
color: priorityIssues.length > 0 ? 'orange' as const : 'green' as const,
onClick: () => navigateHash('#/alert-events')
},
{
step: '02',
title: '补齐证据',
value: `${evidenceCompleteCount}/${priorityIssues.length || 0} 完整`,
detail: '通知前必须带上车辆服务、实时监控、轨迹回放和RAW证据链接。',
action: '证据矩阵',
color: evidenceCompleteCount === priorityIssues.length ? 'green' as const : 'orange' as const,
onClick: () => nextPriorityIssue?.rawHash ? navigateHash(nextPriorityIssue.rawHash) : undefined
},
{
step: '03',
title: '通知责任人',
value: `${ownerRows.length.toLocaleString()} 责任方`,
detail: '规则命中后按责任团队、目标人群和通知渠道形成可复制通知。',
action: '复制通知',
color: ownerRows.length > 0 ? 'blue' as const : 'orange' as const,
onClick: () => copyText(priorityIssueDigest(plan, release), '待通知告警')
},
{
step: '04',
title: '超时升级',
value: `${overdueCount}/${dueSoonCount}`,
detail: '按P0/P1策略监控已超时和即将升级的告警避免断链无人跟进。',
action: 'SLA报告',
color: overdueCount > 0 ? 'red' as const : dueSoonCount > 0 ? 'orange' as const : 'green' as const,
onClick: () => copyText(slaEscalationReport(slaRows, release), 'SLA升级报告')
},
{
step: '05',
title: '验收恢复',
value: release || '-',
detail: '恢复后按验收口径复核,不再命中规则后关闭本次告警闭环。',
action: '运行手册',
color: 'blue' as const,
onClick: () => copyText(notificationRulesRunbook(plan, release), '通知规则Runbook')
}
];
const exportNotificationRules = () => {
const rows = notificationExportRows(plan, release);
if (rows.length === 0) {
@@ -564,6 +611,44 @@ export function NotificationRules() {
return (
<div className="vp-page">
<PageHeader title="通知规则" description="集中管理告警触发条件、通知对象、升级时间和验收标准,让断链与数据质量问题可追踪、可通知、可闭环" />
<Card bordered loading={loading} className="vp-notification-customer-board" bodyStyle={{ padding: 0 }}>
<div className="vp-notification-customer-summary">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={p0IssueCount > 0 ? 'red' : priorityIssues.length > 0 ? 'orange' : 'green'}>
{p0IssueCount > 0 ? `P0 ${p0IssueCount.toLocaleString()}` : priorityIssues.length > 0 ? `${priorityIssues.length.toLocaleString()} 待通知` : '暂无待通知'}
</Tag>
<Tag color={overdueCount > 0 ? 'red' : dueSoonCount > 0 ? 'orange' : 'green'}>{overdueCount.toLocaleString()} / {dueSoonCount.toLocaleString()} </Tag>
</Space>
<Typography.Title heading={5} style={{ margin: 0 }}></Typography.Title>
<Typography.Text type="secondary">
</Typography.Text>
<Space wrap>
<Button size="small" theme="solid" type="primary" onClick={() => navigateHash('#/alert-events')}></Button>
<Button size="small" theme="light" type="primary" disabled={!nextPriorityIssue?.vehicleHash} onClick={() => nextPriorityIssue?.vehicleHash && navigateHash(nextPriorityIssue.vehicleHash)}></Button>
<Button size="small" theme="light" type="warning" onClick={() => copyText(alertEscalationChecklist(plan, release), '升级值班清单')}></Button>
<Button size="small" theme="light" onClick={() => copyText(notificationCoverageReport({ plan, release, ownerRows, overdueCount, dueSoonCount, health }), '通知覆盖报告')}></Button>
</Space>
</div>
<div className="vp-notification-customer-steps">
{notificationCustomerSteps.map((item) => (
<button
key={item.step}
type="button"
className="vp-notification-customer-step"
onClick={item.onClick}
aria-label={`客户告警闭环 ${item.title} ${item.action}`}
>
<span>{item.step}</span>
<Tag color={item.color}>{item.title}</Tag>
<strong>{item.value}</strong>
<small>{item.detail}</small>
<em>{item.action}</em>
</button>
))}
</div>
</Card>
<div className="vp-kpi-grid">
<Card bordered loading={loading}>
<div className="vp-kpi-value">{activeRuleCount.toLocaleString()}</div>