feat(platform): copy alert priority digest
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user