feat: 项目上下文共享制作阶段状态

This commit is contained in:
GouJ committed 2026-09-26 21:15:05 +08:00
1 parent dd30d5abe7
commit 2a2a81772d
1 file changed
+6 -4
+6 -4
View File
@@ -8,15 +8,17 @@ import type { Ref } from 'vue'
/** 同一项目的各个 graph 共用一份查询,避免每个面板重复请求。 */ /** 同一项目的各个 graph 共用一份查询,避免每个面板重复请求。 */
export function useProjectData(id: Ref<string>) { export function useProjectData(id: Ref<string>) {
const query = useQuery(id, async (projectId, signal) => { const query = useQuery(id, async (projectId, signal) => {
const [project, checkpoints] = await Promise.all([ const [project, checkpoints, stageReadiness] = await Promise.all([
projectsApi.detail(projectId, signal), projectsApi.detail(projectId, signal),
projectsApi.checkpoints(projectId, signal) projectsApi.checkpoints(projectId, signal),
projectsApi.stageReadiness(projectId, signal)
]) ])
return { project, checkpoints } return { project, checkpoints, stageReadiness }
}) })
const project = computed<ProjectDetail | null>(() => query.data.value?.project ?? null) const project = computed<ProjectDetail | null>(() => query.data.value?.project ?? null)
const checkpoints = computed<Checkpoint[]>(() => query.data.value?.checkpoints ?? []) const checkpoints = computed<Checkpoint[]>(() => query.data.value?.checkpoints ?? [])
return { ...query, project, checkpoints } const stageReadiness = computed(() => query.data.value?.stageReadiness ?? null)
return { ...query, project, checkpoints, stageReadiness }
} }
/** 项目布局向子页面提供的类型安全上下文。 */ /** 项目布局向子页面提供的类型安全上下文。 */