| | |
| | | loadSemanticArtifacts, |
| | | loadMeasurementArtifacts, |
| | | loadTrajectoryArtifacts, |
| | | loadAnomalyArtifacts, |
| | | type DetectionCase, |
| | | type ChangeCase, |
| | | type SemanticCase, |
| | | type MeasurementCase, |
| | | type TrajectoryCase |
| | | type TrajectoryCase, |
| | | type AnomalyCase |
| | | } from "@/api/artifacts"; |
| | | |
| | | interface ArtifactState { |
| | |
| | | semanticCases: Record<string, SemanticCase>; |
| | | measurementCases: Record<string, MeasurementCase>; |
| | | changeCases: Record<string, ChangeCase>; |
| | | anomalyCases: Record<string, AnomalyCase>; |
| | | loading: boolean; |
| | | error: string | null; |
| | | } |
| | |
| | | detectionRun: (state) => Object.values(state.detectionCases)[0]?.run ?? null, |
| | | detectionImages: (state) => Object.values(state.detectionCases)[0]?.images ?? [] |
| | | }, |
| | | state: (): ArtifactState => ({ detectionCases: {}, trajectoryCases: {}, semanticCases: {}, measurementCases: {}, changeCases: {}, loading: false, error: null }), |
| | | state: (): ArtifactState => ({ detectionCases: {}, trajectoryCases: {}, semanticCases: {}, measurementCases: {}, changeCases: {}, anomalyCases: {}, loading: false, error: null }), |
| | | actions: { |
| | | async loadChange(force = false) { |
| | | if (!force && Object.keys(this.changeCases).length) return; |
| | |
| | | try { this.measurementCases = await loadMeasurementArtifacts(); } |
| | | catch (error) { this.error = error instanceof Error ? error.message : "空间测量结果读取失败"; } |
| | | finally { this.loading = false; } |
| | | }, |
| | | async loadAnomaly(force = false) { |
| | | if (!force && Object.keys(this.anomalyCases).length) return; |
| | | this.loading = true; this.error = null; |
| | | try { this.anomalyCases = await loadAnomalyArtifacts(); } |
| | | catch (error) { this.error = error instanceof Error ? error.message : "异常检测结果读取失败"; } |
| | | finally { this.loading = false; } |
| | | } |
| | | } |
| | | }); |