feat(platform): add map field command actions
This commit is contained in:
@@ -1070,6 +1070,46 @@ export function Realtime({
|
||||
secondaryDisabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin)
|
||||
}
|
||||
];
|
||||
const mapFieldCommandItems = [
|
||||
{
|
||||
title: '全域定位',
|
||||
value: `${locatedCount.toLocaleString()} 辆有坐标`,
|
||||
detail: amapConfigured ? '用高德地图查看车辆分布、在线状态和最近上报位置。' : '高德不可用时先用坐标预览确认车辆分布。',
|
||||
color: locatedCount > 0 ? 'blue' as const : 'orange' as const,
|
||||
action: '刷新地图',
|
||||
disabled: false,
|
||||
onClick: () => load(filters, pagination.currentPage, pagination.pageSize)
|
||||
},
|
||||
{
|
||||
title: '关注车辆',
|
||||
value: mapAttentionRows.length > 0 ? `${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,
|
||||
action: '定位关注车',
|
||||
disabled: mapAttentionRows.length === 0,
|
||||
onClick: () => mapAttentionRows[0] && selectRealtimeRow(mapAttentionRows[0])
|
||||
},
|
||||
{
|
||||
title: '轨迹复盘',
|
||||
value: selectedVehicleLabel,
|
||||
detail: selectedMapRow ? '打开选中车辆轨迹,核对路径、速度、里程和停留。' : '先选择车辆,再进入轨迹回放和时间窗复盘。',
|
||||
color: selectedMapRow ? 'blue' as const : 'grey' as const,
|
||||
action: '打开轨迹',
|
||||
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
|
||||
onClick: () => selectedMapRow && onOpenHistory?.(selectedMapRow.vin, selectedVehicleProtocol)
|
||||
},
|
||||
{
|
||||
title: '通知证据',
|
||||
value: mapAttentionRows.length > 0 ? '需通知' : '可交付',
|
||||
detail: mapAttentionRows.length > 0 ? '复制地图监控包后进入告警事件,形成通知和处置闭环。' : '地图态势稳定时,可直接复制地图监控包用于交接。',
|
||||
color: mapAttentionRows.length > 0 ? 'orange' as const : 'green' as const,
|
||||
action: mapAttentionRows.length > 0 ? '告警事件' : '复制监控包',
|
||||
disabled: false,
|
||||
onClick: () => mapAttentionRows.length > 0 && onOpenQuality ? onOpenQuality({ serviceStatus: 'degraded' }) : copyMapCustomerPackage()
|
||||
}
|
||||
];
|
||||
const mapCustomerDecisionItems = [
|
||||
{
|
||||
label: '先看在线',
|
||||
@@ -1346,7 +1386,7 @@ export function Realtime({
|
||||
<Button size="small" theme="light" onClick={() => setAutoRefresh((value) => !value)}>{autoRefresh ? '暂停刷新' : '开启刷新'}</Button>
|
||||
</Space>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="vp-map-decision-board">
|
||||
<div className="vp-map-decision-summary">
|
||||
<Space wrap>
|
||||
@@ -1381,7 +1421,40 @@ export function Realtime({
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="vp-map-field-command">
|
||||
<div className="vp-map-field-command-summary">
|
||||
<Space wrap>
|
||||
<Tag color="blue">现场指挥建议</Tag>
|
||||
<Tag color={amapConfigured ? 'green' : 'orange'}>{amapConfigured ? '地图可用' : '坐标预览'}</Tag>
|
||||
<Tag color={mapAttentionRows.length > 0 ? 'orange' : 'green'}>
|
||||
{mapAttentionRows.length > 0 ? '先处置关注车辆' : '态势稳定'}
|
||||
</Tag>
|
||||
</Space>
|
||||
<Typography.Title heading={5} style={{ margin: 0 }}>先看车在哪里,再决定回放、告警和导出</Typography.Title>
|
||||
<Typography.Text type="secondary">
|
||||
现场调度按实时地图、关注车辆、轨迹复盘、通知证据四步工作;围栏和告警后续也应从这里进入。
|
||||
</Typography.Text>
|
||||
</div>
|
||||
<div className="vp-map-field-command-grid">
|
||||
{mapFieldCommandItems.map((item) => (
|
||||
<button
|
||||
key={item.title}
|
||||
type="button"
|
||||
className="vp-map-field-command-item"
|
||||
disabled={item.disabled}
|
||||
onClick={item.onClick}
|
||||
aria-label={`地图现场指挥 ${item.title} ${item.action}`}
|
||||
>
|
||||
<Tag color={item.color}>{item.title}</Tag>
|
||||
<strong>{item.value}</strong>
|
||||
<span>{item.detail}</span>
|
||||
<em>{item.action}</em>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="vp-map-kpi-strip">
|
||||
{mapFleetKpis.map((item) => (
|
||||
<button
|
||||
|
||||
@@ -2372,6 +2372,76 @@ button.vp-realtime-command-item:focus-visible {
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.vp-map-field-command {
|
||||
padding: 14px;
|
||||
border: 1px solid rgba(22, 100, 255, 0.2);
|
||||
border-radius: var(--vp-radius);
|
||||
background: #f7faff;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(300px, 0.76fr) minmax(0, 1.24fr);
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.vp-map-field-command-summary {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
align-content: start;
|
||||
}
|
||||
|
||||
.vp-map-field-command-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.vp-map-field-command-item {
|
||||
min-height: 156px;
|
||||
padding: 12px;
|
||||
border: 1px solid var(--vp-border);
|
||||
border-radius: var(--vp-radius);
|
||||
background: #fbfcff;
|
||||
color: inherit;
|
||||
text-align: left;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
align-content: start;
|
||||
}
|
||||
|
||||
.vp-map-field-command-item:hover,
|
||||
.vp-map-field-command-item:focus-visible {
|
||||
border-color: rgba(22, 100, 255, 0.42);
|
||||
box-shadow: 0 10px 24px rgba(24, 39, 75, 0.08);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.vp-map-field-command-item:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.62;
|
||||
}
|
||||
|
||||
.vp-map-field-command-item strong {
|
||||
color: var(--vp-text);
|
||||
font-size: 18px;
|
||||
line-height: 24px;
|
||||
font-weight: 700;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.vp-map-field-command-item span {
|
||||
color: var(--vp-text-muted);
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.vp-map-field-command-item em {
|
||||
color: var(--vp-primary);
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.vp-map-customer-package {
|
||||
padding: 14px;
|
||||
border: 1px solid rgba(0, 164, 184, 0.24);
|
||||
@@ -6089,6 +6159,8 @@ button.vp-realtime-command-item:focus-visible {
|
||||
.vp-bi-publish-grid,
|
||||
.vp-stat-audit-board,
|
||||
.vp-stat-audit-grid,
|
||||
.vp-map-field-command,
|
||||
.vp-map-field-command-grid,
|
||||
.vp-trip-workbench .semi-card-body,
|
||||
.vp-trip-workbench-facts,
|
||||
.vp-trajectory-decision-board,
|
||||
|
||||
@@ -9326,6 +9326,13 @@ test('shows realtime freshness status for recently updated and stale vehicles',
|
||||
expect(screen.getByRole('button', { name: '地图客户决策 再看定位 地图态势' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '地图客户决策 优先异常 告警事件' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: /复制地图决策说明/ })).toBeInTheDocument();
|
||||
expect(screen.getByText('现场指挥建议')).toBeInTheDocument();
|
||||
expect(screen.getByText('先看车在哪里,再决定回放、告警和导出')).toBeInTheDocument();
|
||||
expect(screen.getByText('现场调度按实时地图、关注车辆、轨迹复盘、通知证据四步工作;围栏和告警后续也应从这里进入。')).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '地图现场指挥 全域定位 刷新地图' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '地图现场指挥 关注车辆 定位关注车' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '地图现场指挥 轨迹复盘 打开轨迹' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: '地图现场指挥 通知证据 告警事件' })).toBeInTheDocument();
|
||||
expect(screen.getByText('实时盯车')).toBeInTheDocument();
|
||||
expect(screen.getByText('异常优先')).toBeInTheDocument();
|
||||
expect(screen.getAllByText('轨迹复盘').length).toBeGreaterThanOrEqual(1);
|
||||
|
||||
Reference in New Issue
Block a user