feat(platform): add map layer control panel

This commit is contained in:
lingniu
2026-07-06 03:46:29 +08:00
parent 68fed933d9
commit ab8ae961e6
3 changed files with 226 additions and 0 deletions

View File

@@ -1717,6 +1717,67 @@ export function Realtime({
onClick: exportRealtime
}
];
const mapLayerControlItems = [
{
label: '在线车辆',
value: `${onlineCount.toLocaleString()} 在线`,
detail: '只看当前还能实时服务的车辆,适合客户查看在线态势。',
color: onlineCount > 0 ? 'green' as const : 'orange' as const,
onClick: () => applyFilters({ ...filters, online: 'online' })
},
{
label: '关注车辆',
value: `${mapAttentionRows.length.toLocaleString()} 关注`,
detail: mapAttentionRows[0] ? `优先车辆 ${mapAttentionRows[0].plate || mapAttentionRows[0].vin}` : '当前没有离线、超时或通道异常车辆。',
color: mapAttentionRows.length > 0 ? 'orange' as const : 'green' as const,
onClick: () => mapAttentionRows[0] ? selectRealtimeRow(mapAttentionRows[0]) : applyFilters({ ...filters, serviceStatus: 'degraded' })
},
{
label: '定位车辆',
value: `${locatedCount.toLocaleString()} 定位`,
detail: `有效定位率 ${formatPercent(locatedRate)},决定地图、轨迹和围栏是否可用。`,
color: locatedCount > 0 ? 'blue' as const : 'orange' as const,
onClick: () => load(filters, pagination.currentPage, pagination.pageSize)
},
{
label: '选中车辆',
value: selectedVehicleLabel,
detail: selectedMapRow ? '进入单车服务、轨迹、统计、历史和告警。' : '从地图或车辆列表选择一辆车。',
color: selectedMapRow ? vehicleServiceStatus(selectedMapRow).color : 'grey' as const,
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
onClick: () => selectedMapRow && onOpenVehicle(selectedMapRow.vin, selectedVehicleProtocol)
}
];
const mapLayerControlActions = [
{
label: '只看在线',
action: '在线层',
color: 'green' as const,
disabled: false,
onClick: () => applyFilters({ ...filters, online: 'online' })
},
{
label: '优先关注',
action: '关注层',
color: mapAttentionRows.length > 0 ? 'orange' as const : 'green' as const,
disabled: mapAttentionRows.length === 0,
onClick: () => mapAttentionRows[0] && selectRealtimeRow(mapAttentionRows[0])
},
{
label: '选车服务',
action: '服务层',
color: selectedMapRow ? 'blue' as const : 'grey' as const,
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
onClick: () => selectedMapRow && onOpenVehicle(selectedMapRow.vin, selectedVehicleProtocol)
},
{
label: '导出态势',
action: '交付层',
color: rows.length > 0 ? 'blue' as const : 'grey' as const,
disabled: rows.length === 0,
onClick: exportRealtime
}
];
const copyMapCustomerPackage = () => copyText(mapCustomerPackageText({
filters,
rows,
@@ -2341,6 +2402,55 @@ export function Realtime({
</div>
</section>
<section className="vp-map-layer-control" aria-label="地图图层控制台">
<div className="vp-map-layer-control-copy">
<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-layer-control-grid">
{mapLayerControlItems.map((item) => (
<button
key={item.label}
type="button"
className="vp-map-layer-control-item"
disabled={item.disabled}
onClick={item.onClick}
aria-label={`地图图层控制台 ${item.label} ${item.value}`}
>
<Tag color={item.color}>{item.label}</Tag>
<strong>{item.value}</strong>
<span>{item.detail}</span>
</button>
))}
</div>
<div className="vp-map-layer-control-actions">
{mapLayerControlActions.map((item) => (
<button
key={item.label}
type="button"
className="vp-map-layer-control-action"
disabled={item.disabled}
onClick={item.onClick}
aria-label={`地图图层动作 ${item.label} ${item.action}`}
>
<Tag color={item.color}>{item.label}</Tag>
<span>{item.action}</span>
</button>
))}
</div>
</section>
<section className="vp-map-single-service" aria-label="单车服务台">
<div className="vp-map-single-service-copy">
<Space wrap>