feat(platform): add vehicle asset task rail

This commit is contained in:
lingniu
2026-07-05 16:26:31 +08:00
parent 403a52ce29
commit 3d2d065246
4 changed files with 155 additions and 0 deletions

View File

@@ -714,6 +714,40 @@ export function Vehicles({
}
], [exportVehicles, filters.keyword, onOpenHistory, onOpenMap, onOpenMileage, onOpenRealtime, rows.length, serviceScopeFilters, summary?.onlineVehicles]);
const primaryAction = actionQueue[0];
const vehicleAssetTasks = [
{
title: '最近上报',
value: `${(summary?.onlineVehicles ?? 0).toLocaleString()} 在线`,
detail: '按最近仍在上报的车辆进入实时监控和地图态势。',
action: '只看在线',
color: 'green' as const,
onClick: () => applyFilters({ ...filters, online: 'online' })
},
{
title: '待关注车辆',
value: `${((summary?.noDataVehicles ?? 0) + (summary?.unboundVehicles ?? 0)).toLocaleString()} 待处理`,
detail: '无来源、未绑定或来源缺失的车辆先进入处置队列。',
action: '查看异常',
color: ((summary?.noDataVehicles ?? 0) + (summary?.unboundVehicles ?? 0)) > 0 ? 'orange' as const : 'green' as const,
onClick: () => applyFilters(primaryAction ? { ...filters, ...primaryAction.filters } : { ...filters, serviceStatus: 'degraded' })
},
{
title: '身份待维护',
value: `${(summary?.unboundVehicles ?? 0).toLocaleString()} 未绑定`,
detail: '复制当前页身份维护清单用于补齐车牌、手机号、VIN 和 OEM。',
action: '维护清单',
color: (summary?.unboundVehicles ?? 0) > 0 || (summary?.archiveIncompleteVehicles ?? 0) > 0 ? 'orange' as const : 'green' as const,
onClick: copyIdentityMaintenanceList
},
{
title: '报表导出',
value: `${rows.length.toLocaleString()} 当前页`,
detail: '导出车辆资产清单,后续按车辆进入轨迹、统计和历史证据。',
action: '导出车辆',
color: rows.length > 0 ? 'blue' as const : 'grey' as const,
onClick: exportVehicles
}
];
const vehicleDecisionItems = [
{
title: '在线车辆',
@@ -1016,6 +1050,34 @@ export function Vehicles({
</div>
</div>
</Card>
<Card bordered title="车辆资产作业栏" style={{ marginTop: 16 }}>
<div className="vp-vehicle-asset-board">
<div className="vp-vehicle-asset-summary">
<Space wrap>
<Tag color="blue"></Tag>
<Tag color={filters.keyword?.trim() ? 'green' : 'grey'}>{filters.keyword?.trim() ? '单车' : '车辆池'}</Tag>
</Space>
<strong></strong>
<span></span>
</div>
<div className="vp-vehicle-asset-grid">
{vehicleAssetTasks.map((item) => (
<button
key={item.title}
type="button"
className="vp-vehicle-asset-item"
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>
</Card>
<Card bordered title="车辆客户常问" style={{ marginTop: 16 }}>
<div className="vp-vehicle-question-board">
<div className="vp-vehicle-question-summary">

View File

@@ -2230,6 +2230,88 @@ button.vp-realtime-command-item:focus-visible {
line-height: 20px;
}
.vp-vehicle-asset-board {
display: grid;
grid-template-columns: minmax(280px, 0.62fr) minmax(0, 1.38fr);
gap: 16px;
}
.vp-vehicle-asset-summary {
min-height: 156px;
padding: 14px;
border: 1px solid rgba(22, 100, 255, 0.22);
border-radius: var(--vp-radius);
background: #f6f9ff;
display: grid;
gap: 10px;
align-content: start;
}
.vp-vehicle-asset-summary strong {
color: var(--vp-text);
font-size: 18px;
line-height: 25px;
font-weight: 700;
}
.vp-vehicle-asset-summary span {
color: var(--vp-text-muted);
font-size: 13px;
line-height: 20px;
}
.vp-vehicle-asset-grid {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 12px;
}
.vp-vehicle-asset-item {
min-height: 156px;
padding: 12px;
border: 1px solid var(--vp-border);
border-radius: 8px;
background: #fbfcff;
color: inherit;
cursor: pointer;
font: inherit;
text-align: left;
display: grid;
gap: 9px;
align-content: start;
}
.vp-vehicle-asset-item:hover,
.vp-vehicle-asset-item:focus-visible {
border-color: rgba(22, 100, 255, 0.45);
background: #f5f9ff;
box-shadow: var(--vp-shadow-sm);
outline: none;
}
.vp-vehicle-asset-item strong {
color: var(--vp-text);
font-size: 18px;
line-height: 24px;
font-weight: 700;
word-break: break-word;
}
.vp-vehicle-asset-item span {
color: var(--vp-text-muted);
font-size: 12px;
line-height: 18px;
}
.vp-vehicle-asset-item em {
color: var(--vp-primary);
font-size: 12px;
font-style: normal;
font-weight: 700;
line-height: 18px;
align-self: end;
}
.vp-vehicle-question-board {
display: grid;
grid-template-columns: minmax(280px, 0.62fr) minmax(0, 1.38fr);
@@ -6931,6 +7013,8 @@ button.vp-realtime-command-item:focus-visible {
.vp-vehicle-service-grid,
.vp-vehicle-lookup-head,
.vp-vehicle-lookup-grid,
.vp-vehicle-asset-board,
.vp-vehicle-asset-grid,
.vp-vehicle-question-board,
.vp-vehicle-question-grid,
.vp-vehicle-decision-grid,

View File

@@ -2073,6 +2073,12 @@ test('shows vehicle service result summary on vehicle list filters', async () =>
expect(screen.getByText('轨迹与位置')).toBeInTheDocument();
expect(screen.getAllByText('数据交付').length).toBeGreaterThanOrEqual(1);
expect(screen.getByRole('button', { name: /复制客户查车路径/ })).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.getByRole('button', { name: '车辆客户常问 客户要找某辆车怎么办? 聚焦找车' })).toBeInTheDocument();