feat: 集中管理项目制作阶段准入

This commit is contained in:
GouJ committed 2026-09-26 21:02:40 +08:00
1 parent 76e586a5cd
commit 5c8107ecf9
1 file changed
+71
@@ -0,0 +1,71 @@
import { computed, type Ref } from 'vue'
import { breakdownSnapshot } from '../workflows/selectors'
import type { ProjectSection, ProjectAccess } from './access'
import type { ProjectDetail } from './types'
import type { Checkpoint } from '../workflows/types'
/**
* 主流程准入只使用已经持久化且当前项目可读取的数据。
* 更细的身份、图片和分镜 readiness 由对应页面与 Production Plan 继续校验,
* 避免前端复制服务端业务规则。
*/
export function useProjectStageAccess(
projectId: Ref<string>,
project: Ref<ProjectDetail | null>,
checkpoints: Ref<Checkpoint[]>
) {
const scriptReady = computed(() => project.value?.id === projectId.value && project.value.status === 'completed')
const breakdownReady = computed(() => {
if (!scriptReady.value) return false
const snapshot = breakdownSnapshot(checkpoints.value)
const result = snapshot?.breakdownResult ?? snapshot
return Boolean(
result?.subjectCandidates?.length &&
result?.subjectForms?.length &&
result?.storyboardEpisodeShots?.length &&
result?.storyboardShotValidation?.valid
)
})
const sections = computed<Record<ProjectSection, ProjectAccess['sections'][ProjectSection]>>(() => ({
'create-drama': { enabled: true, reason: '' },
breakdown: {
enabled: scriptReady.value,
reason: '请先完成剧本创作',
nextPath: 'create-drama',
nextLabel: '前往剧本创作'
},
'visual-style': {
enabled: breakdownReady.value,
reason: '请先完成剧本拆解,准备好人物、场景、道具和镜头',
nextPath: 'breakdown',
nextLabel: '前往剧本拆解'
},
'subject-identity': {
enabled: breakdownReady.value,
reason: '请先完成剧本拆解,准备好需要制作的主体',
nextPath: 'breakdown',
nextLabel: '前往剧本拆解'
},
'subject-images': {
enabled: breakdownReady.value,
reason: '请先完成剧本拆解和主体准备',
nextPath: 'subject-identity',
nextLabel: '前往主体身份'
},
storyboard: {
enabled: breakdownReady.value,
reason: '请先完成剧本拆解,生成正式镜头后再进行分镜设计',
nextPath: 'breakdown',
nextLabel: '前往剧本拆解'
},
production: {
enabled: breakdownReady.value,
reason: '请先完成剧本拆解。进入镜头生产后还会检查主体素材和分镜设计是否齐全',
nextPath: 'breakdown',
nextLabel: '前往剧本拆解'
}
}))
return { scriptReady, breakdownReady, sections }
}