feat(platform): add map monitoring task strip
This commit is contained in:
@@ -730,6 +730,69 @@ export function Realtime({
|
||||
{ label: '有效定位', value: locatedCount.toLocaleString(), color: locatedCount > 0 ? 'green' as const : 'orange' as const, helper: `定位率 ${formatPercent(locatedRate)}` },
|
||||
{ label: '需关注', value: mapAttentionRows.length.toLocaleString(), color: mapAttentionRows.length > 0 ? 'orange' as const : 'green' as const, helper: `${staleCount.toLocaleString()} 辆更新超时` }
|
||||
];
|
||||
const selectedVehicleProtocol = selectedMapRow ? filters.protocol || selectedMapRow.primaryProtocol || '' : '';
|
||||
const openSelectedVehicleRaw = () => {
|
||||
if (!selectedMapRow || !canOpenVehicle(selectedMapRow.vin)) {
|
||||
Toast.warning('请先选择可查询的车辆');
|
||||
return;
|
||||
}
|
||||
window.location.hash = buildAppHash({
|
||||
page: 'history-query',
|
||||
keyword: selectedMapRow.vin,
|
||||
protocol: selectedVehicleProtocol,
|
||||
filters: { tab: 'raw', includeFields: 'true' }
|
||||
});
|
||||
};
|
||||
const mapCustomerTasks = [
|
||||
{
|
||||
title: '实时盯车',
|
||||
value: `${onlineCount.toLocaleString()} 在线`,
|
||||
detail: '先看在线车辆和有效定位,确认客户当前能看到车在哪里。',
|
||||
color: 'green' as const,
|
||||
primaryAction: '只看在线',
|
||||
secondaryAction: '刷新地图',
|
||||
onPrimary: () => applyFilters({ ...filters, online: 'online' }),
|
||||
onSecondary: () => load(filters, pagination.currentPage, pagination.pageSize),
|
||||
disabled: false,
|
||||
secondaryDisabled: false
|
||||
},
|
||||
{
|
||||
title: '异常优先',
|
||||
value: `${mapAttentionRows.length.toLocaleString()} 辆关注`,
|
||||
detail: mapAttentionRows[0] ? `${mapAttentionRows[0].plate || mapAttentionRows[0].vin}:${realtimeIssueLabels(mapAttentionRows[0]).join(';')}` : '当前筛选下暂无需要关注的车辆。',
|
||||
color: mapAttentionRows.length > 0 ? 'orange' as const : 'green' as const,
|
||||
primaryAction: '关注车辆',
|
||||
secondaryAction: '告警事件',
|
||||
onPrimary: () => applyFilters({ ...filters, serviceStatus: 'degraded' }),
|
||||
onSecondary: () => onOpenQuality?.({ serviceStatus: 'degraded' }),
|
||||
disabled: !onOpenQuality && mapAttentionRows.length === 0,
|
||||
secondaryDisabled: !onOpenQuality
|
||||
},
|
||||
{
|
||||
title: '轨迹复盘',
|
||||
value: selectedMapRow?.plate || selectedMapRow?.vin || '未选车辆',
|
||||
detail: selectedMapRow ? `围绕 ${selectedMapRow.plate || selectedMapRow.vin} 回放位置、速度和里程变化。` : '从地图或车辆队列选择一辆车后回放轨迹。',
|
||||
color: selectedMapRow ? 'blue' as const : 'grey' as const,
|
||||
primaryAction: '轨迹回放',
|
||||
secondaryAction: '车辆档案',
|
||||
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
|
||||
onPrimary: () => selectedMapRow && onOpenHistory?.(selectedMapRow.vin, selectedVehicleProtocol),
|
||||
onSecondary: () => selectedMapRow && onOpenVehicle(selectedMapRow.vin, selectedVehicleProtocol),
|
||||
secondaryDisabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin)
|
||||
},
|
||||
{
|
||||
title: '数据交付',
|
||||
value: `${rows.length.toLocaleString()} 辆当前页`,
|
||||
detail: '导出当前车辆清单,或进入选中车辆的原始记录证据。',
|
||||
color: 'blue' as const,
|
||||
primaryAction: '导出当前页',
|
||||
secondaryAction: '原始记录',
|
||||
onPrimary: exportRealtime,
|
||||
onSecondary: openSelectedVehicleRaw,
|
||||
disabled: false,
|
||||
secondaryDisabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin)
|
||||
}
|
||||
];
|
||||
|
||||
if (mode === 'map') {
|
||||
return (
|
||||
@@ -780,6 +843,40 @@ export function Realtime({
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="vp-map-task-strip">
|
||||
{mapCustomerTasks.map((item) => (
|
||||
<div key={item.title} className="vp-map-task-item">
|
||||
<div className="vp-map-task-head">
|
||||
<Tag color={item.color}>{item.title}</Tag>
|
||||
<strong>{item.value}</strong>
|
||||
</div>
|
||||
<Typography.Text type="secondary">{item.detail}</Typography.Text>
|
||||
<Space wrap>
|
||||
<Button
|
||||
size="small"
|
||||
theme="solid"
|
||||
type="primary"
|
||||
disabled={item.disabled}
|
||||
aria-label={`地图监控任务 ${item.title} ${item.primaryAction}`}
|
||||
onClick={item.onPrimary}
|
||||
>
|
||||
{item.primaryAction}
|
||||
</Button>
|
||||
<Button
|
||||
size="small"
|
||||
theme="light"
|
||||
type="primary"
|
||||
disabled={item.disabled || item.secondaryDisabled}
|
||||
aria-label={`地图监控任务 ${item.title} ${item.secondaryAction}`}
|
||||
onClick={item.onSecondary}
|
||||
>
|
||||
{item.secondaryAction}
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="vp-map-workspace">
|
||||
<section className="vp-map-canvas-panel">
|
||||
<div className="vp-map-canvas-toolbar">
|
||||
|
||||
Reference in New Issue
Block a user