feat(platform): copy priority alert notification
This commit is contained in:
@@ -8,6 +8,7 @@ import { SourceStatusTags } from '../components/SourceStatusTags';
|
||||
import { StatusTag } from '../components/StatusTag';
|
||||
import { VehicleMap, type VehicleMapPoint } from '../components/VehicleMap';
|
||||
import { isAMapConfigured } from '../config/appConfig';
|
||||
import { buildAppHash } from '../domain/appRoute';
|
||||
import { qualityIssueLabel, qualityProtocolLabel } from '../domain/qualityIssue';
|
||||
import { qualityIssueVehicleLookup } from '../domain/vehicleLookup';
|
||||
|
||||
@@ -114,6 +115,39 @@ function priorityIssueEvidenceFilters(row: QualityIssueRow) {
|
||||
};
|
||||
}
|
||||
|
||||
function appURL(hash: string) {
|
||||
return `${window.location.origin}${window.location.pathname}${hash}`;
|
||||
}
|
||||
|
||||
async function copyText(value: string, label: string) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(value);
|
||||
Toast.success(`已复制${label}`);
|
||||
} catch {
|
||||
Toast.error(`复制${label}失败`);
|
||||
}
|
||||
}
|
||||
|
||||
function priorityIssueNotificationText(row: QualityIssueRow) {
|
||||
const lookup = qualityIssueVehicleLookup(row);
|
||||
const filters = priorityIssueEvidenceFilters(row);
|
||||
const rawFilters = { ...filters, tab: 'raw', includeFields: 'true' };
|
||||
const priority = row.severity === 'error' ? 'P0' : 'P1';
|
||||
return [
|
||||
`【${priority} 告警通知】${qualityIssueLabel(row.issueType)}`,
|
||||
`车辆:${priorityIssueVehicleLabel(row)}`,
|
||||
`数据来源:${qualityProtocolLabel(row.protocol)}`,
|
||||
`问题:${qualityIssueLabel(row.issueType)}`,
|
||||
`最后时间:${row.lastSeen || '-'}`,
|
||||
`详情:${row.detail || '-'}`,
|
||||
`实时定位:${appURL(buildAppHash({ page: 'realtime', keyword: lookup.key, protocol: row.protocol }))}`,
|
||||
`轨迹证据:${appURL(buildAppHash({ page: 'history', keyword: filters.keyword, protocol: filters.protocol, filters }))}`,
|
||||
`RAW证据:${appURL(buildAppHash({ page: 'history', keyword: rawFilters.keyword, protocol: rawFilters.protocol, filters: rawFilters }))}`,
|
||||
`车辆服务:${appURL(buildAppHash({ page: 'detail', keyword: lookup.key, protocol: row.protocol }))}`,
|
||||
`告警筛选:${appURL(buildAppHash({ page: 'quality', protocol: row.protocol, filters: { issueType: row.issueType } }))}`
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
function sourceConsistencyAction(row: VehicleCoverageRow, onFilter: (filters: Record<string, string>) => void) {
|
||||
const consistency = row.sourceConsistency;
|
||||
if (!consistency) {
|
||||
@@ -463,6 +497,14 @@ export function Dashboard({
|
||||
>
|
||||
RAW证据
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
theme="light"
|
||||
aria-label="首页复制告警通知"
|
||||
onClick={() => copyText(priorityIssueNotificationText(highPriorityIssue), '告警通知')}
|
||||
>
|
||||
复制通知
|
||||
</Button>
|
||||
<Button size="small" theme="light" type="warning" onClick={() => onOpenQuality({ issueType: highPriorityIssue.issueType })}>
|
||||
告警队列
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user