From 2ae460fc4a4c2419cf44329783d49a739e2a04ea Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Wed, 19 Aug 2026 16:58:50 +0800
Subject: [PATCH] Merge branch 'master' of http://139.196.74.78:10010/r/geoai/geoai-workbench
---
apps/workbench-console/src/stores/artifacts.ts | 104 ++++++++++++++++++++++++++++++---------------------
1 files changed, 61 insertions(+), 43 deletions(-)
diff --git a/apps/workbench-console/src/stores/artifacts.ts b/apps/workbench-console/src/stores/artifacts.ts
index 879183a..7f7082d 100644
--- a/apps/workbench-console/src/stores/artifacts.ts
+++ b/apps/workbench-console/src/stores/artifacts.ts
@@ -2,60 +2,78 @@
import {
loadDetectionArtifacts,
+ loadChangeArtifacts,
+ loadSemanticArtifacts,
+ loadMeasurementArtifacts,
loadTrajectoryArtifacts,
- type DetectionImage,
- type DetectionRun,
- type TrajectoryRun,
- type TrajectorySummary,
- type TrajectoryEvent
+ loadAnomalyArtifacts,
+ type DetectionCase,
+ type ChangeCase,
+ type SemanticCase,
+ type MeasurementCase,
+ type TrajectoryCase,
+ type AnomalyCase
} from "@/api/artifacts";
interface ArtifactState {
- detectionRun: DetectionRun | null;
- detectionImages: DetectionImage[];
- trajectoryRun: TrajectoryRun | null;
- trajectoryCases: Record<string, { events: TrajectoryEvent[]; summary: TrajectorySummary[] }>;
+ detectionCases: Record<string, DetectionCase>;
+ trajectoryCases: Record<string, TrajectoryCase>;
+ semanticCases: Record<string, SemanticCase>;
+ measurementCases: Record<string, MeasurementCase>;
+ changeCases: Record<string, ChangeCase>;
+ anomalyCases: Record<string, AnomalyCase>;
loading: boolean;
error: string | null;
}
export const useArtifactStore = defineStore("artifacts", {
- state: (): ArtifactState => ({
- detectionRun: null,
- detectionImages: [],
- trajectoryRun: null,
- trajectoryCases: {},
- loading: false,
- error: null
- }),
+ getters: {
+ detectionRun: (state) => Object.values(state.detectionCases)[0]?.run ?? null,
+ detectionImages: (state) => Object.values(state.detectionCases)[0]?.images ?? []
+ },
+ state: (): ArtifactState => ({ detectionCases: {}, trajectoryCases: {}, semanticCases: {}, measurementCases: {}, changeCases: {}, anomalyCases: {}, loading: false, error: null }),
actions: {
- async loadDetection() {
- if (this.detectionRun) return;
- this.loading = true;
- this.error = null;
- try {
- const result = await loadDetectionArtifacts();
- this.detectionRun = result.run;
- this.detectionImages = result.images;
- } catch (error) {
- this.error = error instanceof Error ? error.message : "目标检测结果读取失败";
- } finally {
- this.loading = false;
- }
+ async loadChange(force = false) {
+ if (!force && Object.keys(this.changeCases).length) return;
+ this.loading = true; this.error = null;
+ try { this.changeCases = await loadChangeArtifacts(); }
+ catch (error) { this.error = error instanceof Error ? error.message : "变化检测结果读取失败"; }
+ finally { this.loading = false; }
},
- async loadTrajectory() {
- if (this.trajectoryRun) return;
- this.loading = true;
- this.error = null;
- try {
- const result = await loadTrajectoryArtifacts();
- this.trajectoryRun = result.run;
- this.trajectoryCases = result.cases;
- } catch (error) {
- this.error = error instanceof Error ? error.message : "轨迹分析结果读取失败";
- } finally {
- this.loading = false;
- }
+ async loadDetection(force = false) {
+ if (!force && Object.keys(this.detectionCases).length) return;
+ this.loading = true; this.error = null;
+ try { this.detectionCases = await loadDetectionArtifacts(); }
+ catch (error) { this.error = error instanceof Error ? error.message : "目标检测结果读取失败"; }
+ finally { this.loading = false; }
+ },
+ async loadTrajectory(force = false) {
+ if (!force && Object.keys(this.trajectoryCases).length) return;
+ this.loading = true; this.error = null;
+ try { this.trajectoryCases = await loadTrajectoryArtifacts(); }
+ catch (error) { this.error = error instanceof Error ? error.message : "轨迹分析结果读取失败"; }
+ finally { this.loading = false; }
+ },
+ async loadSemantic(force = false) {
+ if (!force && Object.keys(this.semanticCases).length) return;
+ this.loading = true; this.error = null;
+ try { this.semanticCases = await loadSemanticArtifacts(); }
+ catch (error) { this.error = error instanceof Error ? error.message : "语义分割结果读取失败"; }
+ finally { this.loading = false; }
+ },
+ async loadMeasurement(force = false) {
+ if (!force && Object.keys(this.measurementCases).length) return;
+ this.loading = true; this.error = null;
+ 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; }
}
}
});
--
Gitblit v1.9.3