feat(operations): add source diagnosis workspace

This commit is contained in:
lingniu
2026-07-16 17:35:10 +08:00
parent df7d9799b3
commit 96cad7eef7
18 changed files with 881 additions and 10 deletions

View File

@@ -56,7 +56,9 @@ import type {
VehicleIdentityResolution,
VehicleServiceOverview,
VehicleServiceSummary,
VehicleSourceDiagnostic,
VehicleSourceEvidence,
VehicleSourcePolicyUpdate,
VehicleRow
} from './types';
import { getAccessToken, notifyUnauthorizedSession } from '../v2/auth/session';
@@ -273,6 +275,23 @@ export const api = {
const suffix = params.toString() ? `?${params.toString()}` : '';
return request<VehicleSourceEvidence>(`/api/v2/vehicles/${encodeURIComponent(vin)}/source-evidence${suffix}`, withSignal(undefined, signal));
},
vehicleSourceDiagnostic: (vin: string, signal?: AbortSignal) => request<VehicleSourceDiagnostic>(
`/api/v2/operations/vehicles/${encodeURIComponent(vin)}/sources`,
withSignal(undefined, signal)
),
updateVehicleSourcePolicy: (vin: string, update: VehicleSourcePolicyUpdate) => request<VehicleSourceDiagnostic>(
`/api/v2/operations/vehicles/${encodeURIComponent(vin)}/sources/${encodeURIComponent(update.sourceRef)}`,
{
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
version: update.version,
enabled: update.enabled,
priority: update.priority,
remark: update.remark
})
}
),
updateVehicleProfile: (vin: string, input: VehicleProfileInput) => request<VehicleProfile>(`/api/v2/vehicles/${encodeURIComponent(vin)}/profile`, {
method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(input)
}),

View File

@@ -521,6 +521,7 @@ export interface VehicleLocationSourceEvidence {
sourceLabel: string;
terminalLabel: string;
sourceKind: string;
sourceRef?: string;
selectedWithinProtocol: boolean;
recommended: boolean;
enabled: boolean;
@@ -535,6 +536,10 @@ export interface VehicleLocationSourceEvidence {
socPercent?: number;
eventTime: string;
receivedAt: string;
firstSeenAt?: string;
reportIntervalSec?: number;
reportSampleCount?: number;
selectionReason?: string;
}
export interface VehicleMileageSourceEvidence {
@@ -563,6 +568,40 @@ export interface VehicleSourceEvidenceComparison {
reportTimeDeltaSeconds: number;
}
export interface VehicleSourcePolicyAudit {
version: number;
protocol: string;
sourceRef: string;
sourceLabel: string;
actor: string;
changedAt: string;
summary: string;
}
export interface VehicleSourcePolicyConfig {
vin: string;
version: number;
updatedBy: string;
updatedAt: string;
audit: VehicleSourcePolicyAudit[];
}
export interface VehicleSourceDiagnostic {
evidence: VehicleSourceEvidence;
access?: AccessVehicleRow;
policy: VehicleSourcePolicyConfig;
recommendationReason: string;
refreshHint: string;
}
export interface VehicleSourcePolicyUpdate {
version: number;
sourceRef: string;
enabled: boolean;
priority: number;
remark: string;
}
export interface VehicleServiceOverview {
vin: string;
plate: string;