feat: unify source diagnostics with semi ui

This commit is contained in:
lingniu
2026-07-19 12:07:12 +08:00
parent 031e22de79
commit 7df015b0f0
4 changed files with 84 additions and 19 deletions

View File

@@ -315,6 +315,36 @@ function SourceDiagnosticWorkspace() {
onSelect={choose}
footer={(candidates.data?.total ?? 0) > 20 ? <><span> {Math.floor(candidateOffset / 20) + 1} / {Math.ceil((candidates.data?.total ?? 0) / 20)} </span><div><Button theme="light" size="small" disabled={candidateOffset === 0} onClick={() => setCandidateOffset(Math.max(0, candidateOffset - 20))}></Button><Button theme="light" size="small" disabled={candidateOffset + 20 >= (candidates.data?.total ?? 0)} onClick={() => setCandidateOffset(candidateOffset + 20)}></Button></div></> : undefined}
/> : null;
const sourceSummaryItems: WorkspaceQueueMetricRailItem[] = data ? [
{
label: '来源状态',
value: `${data.evidence.locationSources.filter((item) => item.online).length} / ${data.evidence.locationSources.length}`,
note: data.evidence.locationConflict ? `位置冲突 ${number(data.evidence.conflictDistanceM)}m` : '未发现实时位置冲突',
tone: data.evidence.locationConflict ? 'warning' : 'success',
emphasis: 'primary'
},
{
label: '当前推荐',
value: data.evidence.recommendedLocationLabel || '暂无推荐',
note: data.evidence.recommendedLocationProtocol || '尚无推荐协议',
tone: 'primary',
emphasis: 'primary'
},
{
label: '车辆',
value: data.evidence.plate || selected?.plate || '未绑定车牌',
note: data.evidence.vin,
tone: 'neutral',
emphasis: 'secondary'
},
{
label: '策略版本',
value: `v${data.policy.version}`,
note: data.policy.updatedAt ? <>{data.policy.updatedBy} · <PlatformTime className="v2-ops-time" value={data.policy.updatedAt} sourceZone="utc" /></> : '尚无人工调整',
tone: 'neutral',
emphasis: 'secondary'
}
] : [];
return <>
{mobileLayout ? <div className="v2-source-mobile-discovery">
<MobileFilterToggle
@@ -379,12 +409,12 @@ function SourceDiagnosticWorkspace() {
{selected && diagnostic.isPending ? <div className="v2-source-loading" role="status"><Spin size="large" /><strong></strong><span></span></div> : null}
{data ? <>
<section className="v2-source-summary-region" role="group" aria-label="车辆来源诊断概览">
<CardGroup className="v2-source-summary" type="grid" spacing={10}>
<Card className="v2-source-summary-card is-vehicle"><small></small><strong>{data.evidence.plate || selected?.plate || '未绑定车牌'}</strong><span>{data.evidence.vin}</span></Card>
<Card className="v2-source-summary-card is-recommended"><small></small><strong>{data.evidence.recommendedLocationLabel || '暂无推荐'}</strong><Tag color="blue" type="light" size="small">{data.evidence.recommendedLocationProtocol || '—'}</Tag></Card>
<Card className={`v2-source-summary-card is-source-health${data.evidence.locationConflict ? ' is-warning' : ' is-ok'}`}><small></small><strong>{data.evidence.locationSources.filter((item) => item.online).length} / {data.evidence.locationSources.length} 线</strong><span>{data.evidence.locationConflict ? `位置冲突 ${number(data.evidence.conflictDistanceM)}m` : '未发现实时位置冲突'}</span></Card>
<Card className="v2-source-summary-card is-policy"><small></small><strong>v{data.policy.version}</strong><span>{data.policy.updatedAt ? <>{data.policy.updatedBy} · <PlatformTime className="v2-ops-time" value={data.policy.updatedAt} sourceZone="utc" /></> : '尚无人工调整'}</span></Card>
</CardGroup>
<WorkspaceMetricRail
variant="queue"
className="v2-source-summary-rail"
ariaLabel="车辆来源诊断概览"
items={sourceSummaryItems}
/>
</section>
<Card className="v2-source-recommendation"><header><Tag color="blue" type="light" size="small"></Tag><span>{data.refreshHint}</span></header><p>{data.recommendationReason}</p></Card>
{!editable ? <div className="v2-source-readonly"><Tag color="orange" type="light" size="small"></Tag><span></span></div> : null}