feat(platform): copy alert priority digest

This commit is contained in:
lingniu
2026-07-04 13:15:57 +08:00
parent 47dfd18462
commit bcc9355400
2 changed files with 135 additions and 1 deletions

View File

@@ -266,6 +266,26 @@ function priorityIssueNotificationText(row: PriorityIssueRow) {
].join('\n');
}
function priorityIssueDigestText(rows: PriorityIssueRow[], summary: QualitySummary) {
const p0Count = rows.filter((row) => row.priority === 'P0').length;
const p1Count = rows.filter((row) => row.priority === 'P1').length;
const lines = rows.map((row, index) => [
`${index + 1}. [${row.priority}] ${row.vehicleLabel}`,
` 来源:${qualityProtocolLabel(row.protocol)} / 问题:${qualityIssueLabel(row.issueType)}`,
` 建议动作:${row.actionLabel} / SLA${row.sla}`,
` 最后时间:${row.lastSeen || '-'} / 详情:${row.detail || '-'}`
].join('\n'));
return [
'【告警优先队列汇总】',
`问题车辆:${summary.issueVehicleCount.toLocaleString()},问题记录:${summary.issueRecordCount.toLocaleString()}`,
`P0${p0Count.toLocaleString()}P1${p1Count.toLocaleString()}`,
'',
...lines,
'',
`告警筛选:${qualityShareURL()}`
].join('\n');
}
function ruleStatusColor(count: number, level: string): 'green' | 'orange' | 'red' | 'grey' {
if (count <= 0) return 'green';
if (level === 'P0') return 'red';
@@ -429,6 +449,13 @@ export function Quality({
...(dateTo ? { dateTo } : {})
});
};
const copyPriorityDigest = () => {
if (priorityRows.length === 0) {
Toast.warning('当前没有可复制的优先告警');
return;
}
copyText(priorityIssueDigestText(priorityRows, summary), '优先队列通知汇总');
};
return (
<div className="vp-page">
@@ -491,7 +518,16 @@ export function Quality({
))}
</div>
</Card>
<Card bordered title="处置优先队列" style={{ marginTop: 16 }}>
<Card
bordered
title={(
<Space>
<span></span>
<Button size="small" disabled={priorityRows.length === 0} onClick={copyPriorityDigest}></Button>
</Space>
)}
style={{ marginTop: 16 }}
>
<Table<PriorityIssueRow>
loading={loadingIssues}
pagination={false}