feat(platform): add map vehicle workbench
This commit is contained in:
@@ -731,6 +731,7 @@ export function Realtime({
|
||||
{ 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 selectedVehicleLabel = selectedMapRow?.plate || selectedMapRow?.vin || '未选择车辆';
|
||||
const openSelectedVehicleRaw = () => {
|
||||
if (!selectedMapRow || !canOpenVehicle(selectedMapRow.vin)) {
|
||||
Toast.warning('请先选择可查询的车辆');
|
||||
@@ -743,6 +744,54 @@ export function Realtime({
|
||||
filters: { tab: 'raw', includeFields: 'true' }
|
||||
});
|
||||
};
|
||||
const mapVehicleWorkItems = [
|
||||
{
|
||||
title: '车辆服务',
|
||||
value: selectedVehicleLabel,
|
||||
detail: selectedMapRow ? '查看车辆画像、来源状态和最新实时字段。' : '先从地图或车辆列表选择一辆车。',
|
||||
action: '车辆档案',
|
||||
color: selectedMapRow ? vehicleServiceStatus(selectedMapRow).color : 'grey' as const,
|
||||
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
|
||||
onClick: () => selectedMapRow && onOpenVehicle(selectedMapRow.vin, selectedVehicleProtocol)
|
||||
},
|
||||
{
|
||||
title: '轨迹复盘',
|
||||
value: selectedMapRow ? dataFreshness(selectedMapRow).detail : '等待选择',
|
||||
detail: '复核位置、速度、里程和断点,支撑客户问询。',
|
||||
action: '打开轨迹',
|
||||
color: selectedMapRow ? dataFreshness(selectedMapRow).color : 'grey' as const,
|
||||
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
|
||||
onClick: () => selectedMapRow && onOpenHistory?.(selectedMapRow.vin, selectedVehicleProtocol)
|
||||
},
|
||||
{
|
||||
title: '里程核对',
|
||||
value: selectedMapRow?.totalMileageKm != null ? `${selectedMapRow.totalMileageKm} km` : '无里程',
|
||||
detail: '进入单车里程统计,核对日里程和区间差值。',
|
||||
action: '查看里程',
|
||||
color: selectedMapRow?.totalMileageKm != null ? 'blue' as const : 'orange' as const,
|
||||
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin),
|
||||
onClick: () => {
|
||||
if (!selectedMapRow) return;
|
||||
window.location.hash = buildAppHash({
|
||||
page: 'mileage',
|
||||
keyword: selectedMapRow.vin,
|
||||
protocol: selectedVehicleProtocol
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '告警处置',
|
||||
value: selectedMapRow ? realtimeIssueLabels(selectedMapRow)[0] : '等待选择',
|
||||
detail: '围绕选中车辆查看断链、离线、定位异常等事件。',
|
||||
action: '查看告警',
|
||||
color: selectedMapRow && hasSourceIssue(selectedMapRow) ? 'orange' as const : selectedMapRow ? 'green' as const : 'grey' as const,
|
||||
disabled: !selectedMapRow || !canOpenVehicle(selectedMapRow.vin) || !onOpenQuality,
|
||||
onClick: () => selectedMapRow && onOpenQuality?.({
|
||||
keyword: selectedMapRow.vin,
|
||||
protocol: selectedVehicleProtocol
|
||||
})
|
||||
}
|
||||
];
|
||||
const mapCustomerTasks = [
|
||||
{
|
||||
title: '实时盯车',
|
||||
@@ -877,6 +926,47 @@ export function Realtime({
|
||||
))}
|
||||
</div>
|
||||
|
||||
<div className="vp-map-vehicle-workbench">
|
||||
<div className="vp-map-vehicle-workbench-head">
|
||||
<div>
|
||||
<Typography.Text strong>地图车辆作业台</Typography.Text>
|
||||
<Typography.Text type="tertiary" size="small">
|
||||
当前车辆:{selectedVehicleLabel}
|
||||
</Typography.Text>
|
||||
</div>
|
||||
<Space wrap>
|
||||
{selectedMapRow ? (
|
||||
<>
|
||||
<Tag color={vehicleServiceStatus(selectedMapRow).color}>{vehicleServiceStatus(selectedMapRow).label}</Tag>
|
||||
<Tag color={dataFreshness(selectedMapRow).color}>{dataFreshness(selectedMapRow).detail}</Tag>
|
||||
<Tag color="blue">{selectedVehicleProtocol || '未知来源'}</Tag>
|
||||
</>
|
||||
) : (
|
||||
<Tag color="grey">先选车辆</Tag>
|
||||
)}
|
||||
</Space>
|
||||
</div>
|
||||
<div className="vp-map-vehicle-work-grid">
|
||||
{mapVehicleWorkItems.map((item) => (
|
||||
<button
|
||||
key={item.title}
|
||||
type="button"
|
||||
className="vp-map-vehicle-work-item"
|
||||
disabled={item.disabled}
|
||||
aria-label={`地图车辆作业 ${item.title} ${item.action}`}
|
||||
onClick={item.onClick}
|
||||
>
|
||||
<span className="vp-map-vehicle-work-title">
|
||||
<Tag color={item.color}>{item.title}</Tag>
|
||||
<strong>{item.value}</strong>
|
||||
</span>
|
||||
<span>{item.detail}</span>
|
||||
<em>{item.action}</em>
|
||||
</button>
|
||||
))}
|
||||
</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