feat: 剧本创作页面展示持久化后台状态

This commit is contained in:
GouJ committed 2026-09-26 20:11:09 +08:00
1 parent 2304c65013
commit 03b0a48028
1 file changed
+19
+19
View File
@@ -6,6 +6,8 @@ import { EmptyState } from '../../components/ui'
import { projectContextKey, useProjectData } from './context'
import { getOperation } from '../workflows/operations'
import { isProjectComplete, projectAccessKey, type ProjectAccess } from './access'
import { useWorkflowExecution } from '../workflows/execution'
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
/** 项目标题只保留名称;下游工作区在剧本完成前不挂载,直接链接也无法越过限制。 */
const route = useRoute()
@@ -19,6 +21,13 @@ const isGallery = computed(() => {
const context = useProjectData(id)
provide(projectContextKey, context)
const operation = computed(() => getOperation(id.value))
const createDramaExecution = useWorkflowExecution(id, 'create-drama')
watchEffect(() => {
const status = createDramaExecution.query.data.value?.status
if ((status === 'completed' || status === 'failed') && context.project.value?.status === 'generating') {
void context.refresh()
}
})
const complete = computed(() => isProjectComplete(context.project.value, id.value))
const isCreation = computed(() => route.path.replace(/\/+$/, '').endsWith('/create-drama'))
type OperationGuide = {
@@ -134,6 +143,16 @@ onScopeDispose(() => {
</NAlert>
<NAlert v-if="operation.notice" :show-icon="false" role="status">{{ operation.notice }}</NAlert>
</NScrollbar>
<WorkflowExecutionPanel
v-if="isCreation && createDramaExecution.executionId.value"
class="project-workflow-status"
title="剧本创作后台任务"
:execution="createDramaExecution.query.data.value"
:loading="createDramaExecution.query.loading.value"
:error="createDramaExecution.query.error.value"
@refresh="createDramaExecution.query.refresh"
@dismiss="createDramaExecution.dismiss"
/>
<div class="project-view">
<RouterView v-if="context.project.value?.id === id && (isCreation || complete)" :key="id" />
<EmptyState