Files
short-drama-agent-front/src/features/production/ProductionPage.vue
T

1054 lines
58 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import AppForm from '../../components/ui/AppForm.vue'
import { NFormItem } from 'naive-ui'
import { integerRule, sizeRules } from '../../lib/form-rules'
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
import {
NScrollbar,
NAlert,
NButton,
NCheckbox,
NInputNumber,
NProgress,
NSelect
} from 'naive-ui'
import { computed, inject, ref, watch } from 'vue'
import { ArrowLeft, CheckCircle2, CircleAlert, Film, Image, MessageSquareText, RefreshCw } from '@lucide/vue'
import { EmptyState, StatusBadge } from '../../components/ui'
import BeatShotDirectory from '../storyboard/components/BeatShotDirectory.vue'
import ConfirmAction from '../workflows/ConfirmAction.vue'
import { productionStatusLabel } from './model'
import { useProduction } from './useProduction'
import ProductionReceipt from './components/ProductionReceipt.vue'
import ShotProductionAssets from './components/ShotProductionAssets.vue'
import AdvancedProduction from './components/AdvancedProduction.vue'
import StaleKeyframeNotice from './components/StaleKeyframeNotice.vue'
import { routeLocationKey } from 'vue-router'
import { queryText } from './asset-links'
import QualityDialog from './components/QualityDialog.vue'
import DetailDisclosure from '../../components/ui/DetailDisclosure.vue'
import CreativeProfileSettings from '../generation-config/components/CreativeProfileSettings.vue'
import EpisodeAssemblyPanel from './components/EpisodeAssemblyPanel.vue'
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
const qualityOpen = ref(false)
/** 镜头生产页将项目批处理与单镜头资产管理放在同一条可核验链路中。 */
const {
id,
selectedEpisode,
selectedShot,
episodeNo,
episodeOptions,
shots,
shot,
promptItem,
keyframeItem,
videoItem,
videoStatusItem,
query,
operation,
session,
concurrency,
force,
keyframeLimit,
keyframeWidth,
keyframeHeight,
promptLimit,
videoLimit,
videoRepairAttempts,
videoInputMode,
keyframeValid,
promptValid,
videoQualityValid,
batchValid,
blocked,
run,
promptExecution,
videoExecution
} = useProduction()
const route = inject(routeLocationKey, undefined)
/** 从素材页返回时恢复到指定剧集与正式镜头,不按重复的 Shot 编号定位。 */
watch(
() => [route?.query.episodeNo, route?.query.shotId],
() => {
const episode = Number(queryText(route?.query.episodeNo))
selectedEpisode.value = Number.isSafeInteger(episode) && episode > 0 ? episode : undefined
selectedShot.value = queryText(route?.query.shotId)
},
{ immediate: true }
)
const linkedShotMissing = computed(
() =>
queryText(route?.query.shotId) &&
query.data.value &&
!shots.value.some(item => item.shotId === selectedShot.value)
)
const openRequestedKeyframe = computed(
() => queryText(route?.query.action) === 'keyframe' && queryText(route?.query.shotId) === shot.value?.shotId
)
const staleVideos = computed(() => query.data.value?.videos.stalePrimaryVideo ?? 0)
const episodePromptReadiness = computed(() => {
const source = query.data.value?.prompts
if (!source) return undefined
const items = source.items.filter(item => item.episodeNo === episodeNo.value)
return {
...source,
items,
total: items.length,
ready: items.filter(item => item.status === 'ready').length,
skipped: items.filter(item => item.status === 'skipped').length,
blocked: items.filter(item => item.status === 'blocked').length
}
})
const episodeVideoReadiness = computed(() => {
const source = query.data.value?.videos
if (!source) return undefined
const items = source.items.filter(item => item.episodeNo === episodeNo.value)
return {
...source,
items,
total: items.length,
ready: items.filter(item => item.status === 'ready').length,
skipped: items.filter(item => item.status === 'skipped').length,
inProgress: items.filter(item => item.status === 'in_progress').length,
blocked: items.filter(item => item.status === 'blocked').length
}
})
const inputPlan = computed(() => query.data.value?.videoInputPlans)
const selectedPlanCount = computed(() => {
if (videoInputMode.value === 'first_frame') return inputPlan.value?.firstFrameCount ?? 0
if (videoInputMode.value === 'omni_reference') return inputPlan.value?.omniReferenceCount ?? 0
return inputPlan.value?.readyCount ?? episodeVideoReadiness.value?.ready ?? 0
})
const videoInputModeLabel = computed(() => {
if (videoInputMode.value === 'first_frame') return '首帧模式'
if (videoInputMode.value === 'omni_reference') return '全模态参考'
return '全部推荐模式'
})
const stages = computed(() => {
const data = query.data.value
return [
{
key: 'prompts' as const,
code: '01',
title: '视频提示词',
description: '检查镜头设计和主体参考图后,生成视频运动描述。',
icon: MessageSquareText,
data: episodePromptReadiness.value,
done: episodePromptReadiness.value?.skipped ?? 0,
action: force.value ? '重生成全部提示词' : '补齐视频提示词'
},
{
key: 'keyframes' as const,
code: '02',
title: '镜头首帧',
description: '合并视觉风格、镜头规格和主体参考图,调用图片模型生成。',
icon: Image,
data: data?.keyframes,
done: data?.keyframes.skipped ?? 0,
action: force.value ? '为全部镜头新增首帧' : '补齐 / 更新主首帧'
},
{
key: 'videos' as const,
code: '03',
title: '视频成片',
description: '生成质量候选,完成后自动校验;失败时有限修复,通过后才晋升主视频。',
icon: Film,
data: episodeVideoReadiness.value,
done: episodeVideoReadiness.value?.skipped ?? 0,
action: force.value
? '新增项目质量视频候选'
: staleVideos.value > 0
? `更新 ${staleVideos.value} 个过期主视频`
: '提交视频质量任务'
}
]
})
const selectedIssues = computed(() =>
[promptItem.value, keyframeItem.value, videoItem.value].flatMap(item => item?.issues ?? [])
)
const selectedKeyframeStale = computed(
() =>
!!keyframeItem.value?.primaryKeyframeStale ||
selectedIssues.value.some(issue => issue.code === 'stale_keyframe')
)
const videoRunning = computed(
() =>
(query.data.value?.videoStatus.pending ?? 0) +
(query.data.value?.videoStatus.queued ?? 0) +
(query.data.value?.videoStatus.running ?? 0)
)
const identityBlocked = computed(
() =>
(query.data.value?.keyframes.missingIdentity ?? 0) +
(query.data.value?.keyframes.missingIdentityAnchor ?? 0) +
(query.data.value?.keyframes.identityUnlocked ?? 0)
)
const staleKeyframes = computed(() => query.data.value?.keyframes.stalePrimaryKeyframe ?? 0)
const invalidGenerationSpecs = computed(
() =>
(query.data.value?.keyframes.invalidGenerationSpec ?? 0) +
(query.data.value?.prompts.invalidGenerationSpec ?? 0)
)
const preparationComplete = computed(() => {
const data = query.data.value
if (!data) return false
return (
data.keyframes.total > 0 &&
data.keyframes.skipped === data.keyframes.total &&
data.prompts.total > 0 &&
data.prompts.skipped === data.prompts.total &&
!identityBlocked.value &&
!invalidGenerationSpecs.value &&
!staleKeyframes.value
)
})
const finalVideosComplete = computed(() => {
const data = query.data.value
if (!data?.videos.total) return false
return data.videos.skipped === data.videos.total && !staleVideos.value && !videoRunning.value
})
/** 父页查询包含整个项目的就绪统计,单镜头变更后立即刷新。 */
function refreshProject() {
void query.refresh()
}
/** 从质量回执定位本集正式镜头,关闭弹窗不会触发任何生成请求。 */
function locateQualityShot(shotId: string) {
selectedShot.value = shotId
qualityOpen.value = false
}
/** 新回执自动展开,避免折叠区隐藏部分失败诊断。 */
const toolsOpen = ref(false)
watch(
() => session.value.receipt,
receipt => {
if (receipt) {
toolsOpen.value = true
}
}
)
watch(
() => session.value.pipelineReceipt,
receipt => {
if (receipt) toolsOpen.value = true
}
)
watch(
() => route?.query.configure,
value => {
if (value === 'profile') toolsOpen.value = true
},
{ immediate: true }
)
function profileSaved() {
operation.value.error = ''
}
const batchModel = computed(() => ({ concurrency: concurrency.value }))
const batchRules = { concurrency: integerRule('批量并发') }
const keyframeModel = computed(() => ({
keyframeLimit: keyframeLimit.value,
keyframeWidth: keyframeWidth.value,
keyframeHeight: keyframeHeight.value
}))
const promptModel = computed(() => ({ promptLimit: promptLimit.value }))
const dimensionRules = sizeRules(() => ({ width: keyframeWidth.value, height: keyframeHeight.value }))
const keyframeRules = {
keyframeLimit: integerRule('本批上限', 1, true),
keyframeWidth: dimensionRules.width,
keyframeHeight: dimensionRules.height
}
const promptRules = { promptLimit: integerRule('本批镜头上限') }
const videoModel = computed(() => ({
videoInputMode: videoInputMode.value,
videoLimit: videoLimit.value,
videoRepairAttempts: videoRepairAttempts.value
}))
const videoRules = { videoLimit: integerRule('本批镜头上限'), videoRepairAttempts: integerRule('每镜最多自动修复') }
</script>
<template>
<WorkspacePage split compact class="production-workspace-page"
><template #header
><div class="workspace-toolbar">
<div class="toolbar-episode">
<NSelect
:value="episodeNo"
aria-label="选择生产剧集"
@update:value="selectedEpisode = Number($event)"
:options="[
...(!episodeOptions.length ? [{ label: String('暂无剧集'), value: 0 }] : []),
...episodeOptions.map(episode => ({
label: String(' 第 ' + episode.episodeNo + ' 集 · ' + episode.title),
value: episode.episodeNo
}))
]"
class="select-control"
></NSelect>
</div>
<span class="toolbar-summary"
>本集 {{ shots.length }} 镜<span v-if="videoRunning">
· {{ videoRunning }} 个视频任务进行中</span
></span
>
<div class="toolbar-actions">
<NButton :disabled="blocked || !episodeNo" @click="qualityOpen = true">首帧质量生成</NButton>
<NButton
:disabled="query.loading.value"
@click="query.refresh"
quaternary
class="icon-button"
aria-label="刷新就绪状态"
title="刷新就绪状态"
><RefreshCw :size="16" :class="{ 'animate-spin': query.loading.value }" />
</NButton>
<WorkspaceTools
v-model:open="toolsOpen"
title="项目生产总览与批量操作"
label="批量生产"
:has-receipt="!!session.receipt || !!session.pipelineReceipt"
>
<div class="production-tools-intro">
<div>
<p class="eyebrow">PRODUCTION</p>
<h2 class="text-lg font-semibold">镜头生产</h2>
<p class="mt-2 text-sm text-muted">
从可生成的提示词和首帧,到异步视频任务与最终成片。
</p>
</div>
<RouterLink :to="`/projects/${id}/storyboard`" class="text-button">
<ArrowLeft :size="14" />回到分镜设计
</RouterLink>
</div>
<section class="production-batch-config" aria-label="项目生产配置">
<div class="production-section-heading">
<div>
<h3 class="text-sm font-semibold">批量执行设置</h3>
<p class="mt-1 text-xs text-muted">控制本次手动批处理的并发与覆盖方式。</p>
</div>
</div>
<AppForm
:model="batchModel"
:rules="batchRules"
:disabled="operation.pending"
validate-on-change
>
<div class="form-controls production-controls">
<NFormItem path="concurrency" label="批量并发">
<NInputNumber
:input-props="{ 'aria-label': '批量并发' }"
:disabled="operation.pending"
:value="typeof concurrency === 'number' ? concurrency : null"
@update:value="concurrency = $event ?? 0"
:min="1"
:step="1"
></NInputNumber>
</NFormItem>
<NCheckbox
v-model:checked="force"
:disabled="operation.pending"
class="control-row-checkbox text-xs"
>覆盖模式:重写提示词/新增图视频候选
</NCheckbox>
</div>
</AppForm>
</section>
<div class="production-tool-stack">
<CreativeProfileSettings :project-id="id" @saved="profileSaved" />
<DetailDisclosure title="处理范围与覆盖规则" class="production-tool-section"
><p class="text-xs leading-6 text-muted">
提示词与视频就绪检查面向全项目;视频实际提交受本批镜头上限控制,并使用严格质量流水线。首帧默认补当前剧集,存在过期主首帧时优先更新全项目过期项,覆盖模式处理全项目;过期首帧成功后会自动接替旧主图,其余新增候选。图片模型、视频模型与视觉校验均可能产生费用。
</p></DetailDisclosure
>
<div class="workspace-overview-panel production-tool-section">
<div class="overview-content">
<h3 class="text-sm font-semibold">项目生产总览与批量操作</h3>
<NAlert
v-if="videoRunning"
role="status"
type="info"
:show-icon="false"
class="mt-4"
>
当前有 {{ videoRunning }} 个视频任务等待或生成中。系统会持续更新任务状态,同一镜头不会重复提交。
</NAlert>
<NAlert v-if="identityBlocked" type="info" :show-icon="false" class="mt-4">
当前有 {{ identityBlocked }} 项角色身份尚未准备完成。请先确认角色母版并完成身份锁定,再生成镜头首帧。
<RouterLink
:to="`/projects/${id}/subject-identity`"
class="text-button ml-2"
>前往主体身份 →</RouterLink
></NAlert
>
<NAlert
v-if="invalidGenerationSpecs"
type="warning"
:show-icon="false"
class="mt-4"
>
当前有 {{ invalidGenerationSpecs }} 个镜头的设计信息还不完整。请先补齐镜头设计和即时视觉状态。
<RouterLink :to="`/projects/${id}/storyboard`" class="text-button ml-2">
前往分镜设计 →
</RouterLink>
</NAlert>
<NAlert
v-if="staleKeyframes"
role="status"
type="info"
:show-icon="false"
class="mt-4"
>
当前有
{{ staleKeyframes }}
个主首帧已过期。它们使用的主体参考资产已经变化,视频阶段会被阻止;可在下方逐镜重新生成,或使用“补齐
/ 更新主首帧”批量处理。
</NAlert>
<NAlert
v-if="staleVideos"
role="status"
type="info"
:show-icon="false"
class="mt-4"
>
当前有
{{ staleVideos }}
个主视频已过期。它们使用的主首帧或主体参考图已经变化;非覆盖模式批量生成时会只重建这些过期主视频。
</NAlert>
<ProductionReceipt v-if="session.receipt" :receipt="session.receipt" />
<WorkflowExecutionPanel
v-if="promptExecution.executionId.value"
title="视频提示词任务"
:execution="promptExecution.query.data.value"
:loading="promptExecution.query.loading.value"
:error="promptExecution.query.error.value"
@refresh="promptExecution.query.refresh"
@dismiss="promptExecution.dismiss"
/>
<WorkflowExecutionPanel
v-if="videoExecution.executionId.value"
title="视频质量任务"
:execution="videoExecution.query.data.value"
:loading="videoExecution.query.loading.value"
:error="videoExecution.query.error.value"
@refresh="videoExecution.query.refresh"
@dismiss="videoExecution.dismiss"
/>
<div v-if="query.data.value" class="production-pipeline mt-5">
<article
v-for="stage in stages"
:key="stage.key"
class="panel production-pipeline-card"
>
<div class="flex items-start justify-between gap-3">
<div class="flex items-start gap-3">
<span class="production-step"
><component :is="stage.icon" :size="17"
/></span>
<div>
<p class="eyebrow">STEP {{ stage.code }}</p>
<h3 class="mt-2 text-sm font-semibold">
{{ stage.title }}
</h3>
</div>
</div>
<span class="font-mono text-xs text-muted"
>{{ stage.done }} / {{ stage.data?.total ?? 0 }}</span
>
</div>
<p class="mt-4 min-h-10 text-xs leading-5 text-muted">
{{ stage.description }}
</p>
<NProgress
:aria-label="`${stage.title}完成数量`"
type="line"
:show-indicator="false"
:height="4"
:percentage="
Math.min(
100,
Math.max(
0,
(stage.done /
Math.max(
1,
Math.max(stage.data?.total ?? 0, 1)
)) *
100
)
)
"
class="mt-4"
></NProgress>
<dl class="production-stats mt-4">
<div>
<dt>可执行</dt>
<dd>{{ stage.data?.ready ?? 0 }}</dd>
</div>
<div>
<dt>已有结果</dt>
<dd>{{ stage.data?.skipped ?? 0 }}</dd>
</div>
<div>
<dt>阻塞</dt>
<dd>{{ stage.data?.blocked ?? 0 }}</dd>
</div>
</dl>
<p
v-if="stage.key === 'keyframes' && staleKeyframes"
class="mt-3 text-[11px] leading-5"
>
已过期 {{ staleKeyframes }} · 会按当前主体参考资产重新生成
</p>
<p
v-if="stage.key === 'videos' && staleVideos"
class="mt-3 text-[11px] leading-5"
>
主视频已过期 {{ staleVideos }} ·
会按当前主首帧与参考资产重新生成
</p>
<p
v-if="stage.key === 'keyframes' && identityBlocked"
class="mt-3 text-[11px] leading-5 text-danger"
>
身份缺失
{{ query.data.value?.keyframes.missingIdentity ?? 0 }} ·
母版缺失
{{ query.data.value?.keyframes.missingIdentityAnchor ?? 0 }} ·
未锁定
{{ query.data.value?.keyframes.identityUnlocked ?? 0 }}
</p>
<ConfirmAction
class="mt-4"
:label="stage.action"
:disabled="
blocked ||
!batchValid ||
(stage.key === 'prompts' && !promptValid) ||
(stage.key === 'keyframes' && !keyframeValid) ||
(stage.key === 'videos' && !videoQualityValid) ||
(stage.key === 'videos' && !selectedPlanCount) ||
!(stage.data?.ready ?? 0)
"
acknowledgement
:description="
stage.key === 'videos'
? staleVideos && !force
? `只处理第 ${episodeNo} 集的${videoInputModeLabel},其中至多 ${videoLimit || '—'} 个过期镜头会启动严格质量流水线;通过后才接替旧主视频。`
: `只处理第 ${episodeNo} 集的${videoInputModeLabel},本批至多 ${videoLimit || '—'} 镜。最多自动修复 ${videoRepairAttempts || '—'} 次,通过后才晋升主视频。`
: stage.key === 'keyframes'
? `处理缺失或过期主首帧。过期首帧成功后自动接替旧主图(覆盖模式也如此),其余已有主图只新增候选。本批上限:${keyframeLimit || '不限制'};尺寸:${keyframeWidth && keyframeHeight ? `${keyframeWidth} × ${keyframeHeight}` : '项目默认'}。`
: `只处理第 ${episodeNo} 集中通过就绪检查的镜头,本批最多 ${promptLimit || '—'} 镜;覆盖模式会重写已有提示词。`
"
:primary="stage.key === 'videos'"
@confirm="run(stage.key)"
/>
<AppForm
v-if="stage.key === 'prompts'"
:model="promptModel"
:rules="promptRules"
:disabled="operation.pending"
validate-on-change
class="mt-4 grid gap-3"
>
<NFormItem path="promptLimit" label="本批镜头上限"
><NInputNumber
v-model:value="promptLimit"
:min="1"
:precision="0"
:disabled="operation.pending"
:input-props="{ 'aria-label': '视频提示词本批镜头上限' }"
/></NFormItem>
</AppForm>
<AppForm
v-if="stage.key === 'keyframes'"
:model="keyframeModel"
:rules="keyframeRules"
:disabled="operation.pending"
validate-on-change
class="mt-4 grid gap-3"
>
<NFormItem path="keyframeLimit" label="本批上限(可选)"
><NInputNumber
:input-props="{ 'aria-label': '本批上限(可选)' }"
:value="keyframeLimit === '' ? null : keyframeLimit"
@update:value="keyframeLimit = $event ?? ''"
:min="1"
:precision="0"
:disabled="operation.pending"
placeholder="留空不限制"
/></NFormItem>
<div class="grid grid-cols-2 gap-3">
<NFormItem path="keyframeWidth" label="宽度(像素)"
><NInputNumber
:input-props="{ 'aria-label': '宽度(像素)' }"
:value="keyframeWidth === '' ? null : keyframeWidth"
@update:value="keyframeWidth = $event ?? ''"
:min="1"
:disabled="operation.pending"
placeholder="默认" /></NFormItem
><NFormItem path="keyframeHeight" label="高度(像素)"
><NInputNumber
:input-props="{ 'aria-label': '高度(像素)' }"
:value="
keyframeHeight === '' ? null : keyframeHeight
"
@update:value="keyframeHeight = $event ?? ''"
:min="1"
:disabled="operation.pending"
placeholder="默认"
/></NFormItem>
</div>
</AppForm>
<AppForm
v-if="stage.key === 'videos'"
:model="videoModel"
:rules="videoRules"
:disabled="operation.pending"
validate-on-change
class="mt-4 grid gap-3"
>
<div class="video-input-plan-summary" aria-label="视频输入规划">
<div>
<span>首帧模式</span>
<strong>{{ inputPlan?.firstFrameCount ?? 0 }}</strong>
</div>
<div>
<span>全模态参考</span>
<strong>{{ inputPlan?.omniReferenceCount ?? 0 }}</strong>
</div>
</div>
<NAlert
v-if="query.data.value?.videoInputPlansError"
type="warning"
:show-icon="false"
class="text-xs"
>
输入规划暂不可用,仍可按“全部推荐模式”提交;刷新后可重试规划。
</NAlert>
<NFormItem path="videoInputMode" label="输入规划范围">
<NSelect
v-model:value="videoInputMode"
:disabled="operation.pending"
:options="[
{
label: `全部推荐模式(${inputPlan?.readyCount ?? 0})`,
value: 'all'
},
{
label: `首帧模式(${inputPlan?.firstFrameCount ?? 0})`,
value: 'first_frame',
disabled: !inputPlan
},
{
label: `全模态参考(${inputPlan?.omniReferenceCount ?? 0})`,
value: 'omni_reference',
disabled: !inputPlan
}
]"
aria-label="视频输入规划范围"
/>
</NFormItem>
<NFormItem path="videoLimit" label="本批镜头上限"
><NInputNumber
v-model:value="videoLimit"
:min="1"
:precision="0"
:disabled="operation.pending"
:input-props="{ 'aria-label': '视频质量任务镜头上限' }"
/></NFormItem>
<NFormItem path="videoRepairAttempts" label="每镜最多自动修复"
><NInputNumber
v-model:value="videoRepairAttempts"
:min="1"
:precision="0"
:disabled="operation.pending"
:input-props="{ 'aria-label': '视频自动修复次数' }"
/></NFormItem>
</AppForm>
</article>
</div>
<div v-if="query.data.value" class="panel mt-4 p-5">
<div class="flex flex-wrap items-center justify-between gap-3">
<div>
<h3 class="text-sm font-semibold">视频任务状态</h3>
<p class="mt-2 text-xs text-muted">
状态统计取每个镜头最近一次任务,不等同于主视频数量。
</p>
</div>
<ConfirmAction
label="重试失败视频"
:disabled="
blocked ||
!batchValid ||
!query.data.value.videoStatus.failed
"
acknowledgement
description="只重新提交可以重试的失败视频;其他项目会跳过,并在结果中显示数量。"
@confirm="run('retry-videos')"
/>
</div>
<dl class="production-status-grid mt-4">
<div>
<dt>完成</dt>
<dd>{{ query.data.value.videoStatus.completed }}</dd>
</div>
<div>
<dt>排队/生成</dt>
<dd>{{ videoRunning }}</dd>
</div>
<div>
<dt>失败</dt>
<dd>{{ query.data.value.videoStatus.failed }}</dd>
</div>
<div>
<dt>取消</dt>
<dd>{{ query.data.value.videoStatus.cancelled }}</dd>
</div>
<div>
<dt>未开始</dt>
<dd>{{ query.data.value.videoStatus.notStarted }}</dd>
</div>
</dl>
</div>
</div>
</div>
<EpisodeAssemblyPanel :project-id="id" />
<AdvancedProduction />
</div>
</WorkspaceTools>
</div></div
></template>
<div v-if="preparationComplete" class="workspace-inline-status">
<span v-if="finalVideosComplete">本项目镜头素材和视频成片已经准备完成。</span>
<span v-else>镜头制作准备已经完成。视频生成费用较高,可按需要逐批提交视频任务。</span>
<NButton v-if="!finalVideosComplete" text size="small" @click="toolsOpen = true">打开批量生产</NButton>
</div>
<NScrollbar v-if="query.error.value" class="workspace-feedback"
><NAlert role="alert" type="error" :show-icon="false"
>{{ query.error.value
}}<span v-if="query.data.value"> 当前保留上次读取的数据,生产操作已暂停。</span></NAlert
></NScrollbar
>
<div v-if="staleKeyframes || staleVideos || identityBlocked" class="workspace-inline-status">
<span>过期首帧 {{ staleKeyframes }} · 过期视频 {{ staleVideos }} · 身份前置问题 {{ identityBlocked }}</span>
<NButton text size="small" @click="toolsOpen = true">查看处理方式</NButton>
</div>
<div v-if="shot" class="panel production-workspace">
<nav class="production-shot-list directory-panel" aria-label="本集生产镜头">
<div class="directory-heading">
<h3>
生产镜头 <span>{{ shots.length }} 镜</span>
</h3>
</div>
<NScrollbar
class="panel-scroll directory-scroll"
content-class="directory-list-content production-shot-list-content"
x-scrollable
>
<BeatShotDirectory
:shots="shots"
:active-id="shot.shotId"
@select="selectedShot = $event"
item-class="production-shot-link"
>
<template #meta="{ shot: item }"
><span
v-if="
query.data.value?.keyframes.items.find(row => row.shotId === item.shotId)
?.primaryKeyframeStale
"
class="directory-status"
>
<CircleAlert :size="12" />主首帧已过期 </span
><span
v-else-if="
query.data.value?.videos.items.find(row => row.shotId === item.shotId)
?.primaryVideoStale
"
class="directory-status"
>
<CircleAlert :size="12" />主视频已过期 </span
><span v-else class="directory-status">
<CheckCircle2
v-if="
query.data.value?.videos.items.find(row => row.shotId === item.shotId)
?.status === 'skipped'
"
:size="12"
/>
<CircleAlert
v-else-if="
query.data.value?.videos.items.find(row => row.shotId === item.shotId)
?.status === 'blocked'
"
:size="12"
/>
{{
productionStatusLabel(
query.data.value?.videoStatus.items.find(row => row.shotId === item.shotId)
?.status || 'not_started'
)
}}
</span></template
></BeatShotDirectory
>
</NScrollbar>
</nav>
<article class="production-detail min-w-0">
<NScrollbar class="panel-scroll" content-class="p-5 lg:p-7">
<header class="mb-5 pb-5">
<NAlert v-if="linkedShotMissing" type="warning" :show-icon="false" class="mb-4"
>链接中的镜头已不存在或不属于该剧集,请在左侧重新选择。</NAlert
>
<div class="flex flex-wrap items-start justify-between gap-3">
<div>
<p class="eyebrow">BEAT {{ shot.beatNo }} / SHOT {{ shot.shotNo }}</p>
<h3 class="mt-2 text-lg font-semibold">{{ shot.title }}</h3>
</div>
<StatusBadge
v-if="videoStatusItem"
:status="videoStatusItem.status"
:label="productionStatusLabel(videoStatusItem.status)"
/>
</div>
<p v-if="shot.description" class="mt-3 text-sm leading-7">{{ shot.description }}</p>
<p class="mt-3 break-all font-mono text-[10px] text-muted">Shot ID · {{ shot.shotId }}</p>
<NAlert
v-if="videoStatusItem?.status === 'failed'"
type="error"
:show-icon="false"
class="mt-3"
>
{{ videoStatusItem.error || '最近一次视频任务失败' }}
<p v-if="videoStatusItem.retryable === false" class="mt-2">
此失败不支持普通重试,请先处理失败原因。
</p>
<p v-else-if="videoStatusItem.retryable === true" class="mt-2">此任务可以重试。</p>
</NAlert>
<StaleKeyframeNotice
v-if="selectedKeyframeStale"
:key="shot.shotId"
:project-id="id"
:shot-id="shot.shotId"
:issues="selectedIssues"
:inconsistent="
keyframeItem?.primaryKeyframeStale === false &&
selectedIssues.some(issue => issue.code === 'stale_keyframe')
"
/>
<NAlert
v-if="videoItem?.primaryVideoStale"
role="status"
type="info"
:show-icon="false"
class="mt-4 text-xs"
>
主视频已过期:当前主首帧或主体参考图与生成该视频时不一致。旧视频仍保留,但需要重新生成后才能作为当前有效成片。
</NAlert>
</header>
<ShotProductionAssets
:key="shot.shotId"
:project-id="id"
:shot="shot"
:prompt-readiness="promptItem"
:keyframe-readiness="keyframeItem"
:video-readiness="videoItem"
:open-keyframe="openRequestedKeyframe"
:disabled="blocked || !!linkedShotMissing"
@changed="refreshProject"
/>
</NScrollbar>
</article>
</div>
<EmptyState
v-else-if="query.data.value"
title="本集还没有正式镜头"
description="先完成剧本拆解、导演设计与正式镜头持久化,再进入镜头生产。"
>
<RouterLink :to="`/projects/${id}/storyboard`" class="button button-secondary">前往分镜设计</RouterLink>
</EmptyState>
<p v-else-if="query.loading.value" class="panel mt-5 p-8 text-sm text-muted" role="status">
正在检查全项目生产就绪状态……
</p>
<QualityDialog
v-model:open="qualityOpen"
:project-id="id"
:target="episodeNo ? { kind: 'batch', episodeNo, title: `第 ${episodeNo} 集首帧` } : null"
:disabled="blocked"
@changed="refreshProject"
@locate="locateQualityShot"
/>
</WorkspacePage>
</template>
<style>
/* 本组件专属布局与 Naive 内部结构覆盖。 */
@reference "../../styles/styles.css";
.production-tools-intro {
@apply flex flex-wrap items-end justify-between gap-4 p-[18px] bg-(--app-surface);
}
.production-tools-intro .eyebrow {
@apply mb-2;
}
.production-batch-config {
@apply mt-3 p-4 bg-(--app-surface);
}
.production-section-heading {
@apply flex items-start justify-between gap-4;
}
.workspace-tools-body .production-batch-config .production-controls {
@apply mt-4 mb-0;
}
.production-tool-stack {
@apply mt-3 px-4 bg-(--app-surface);
}
.production-tool-stack .production-tool-section.n-collapse {
@apply m-0;
box-shadow: inset 0 1px var(--app-border);
}
.production-tool-stack > :first-child.production-tool-section.n-collapse {
box-shadow: none;
}
.production-tool-stack .production-tool-section .n-collapse-item__header {
@apply min-h-12 py-0;
}
.production-tool-stack .production-tool-section .n-collapse-item__header-main {
@apply text-[13px] font-medium;
}
.production-tool-stack .production-tool-section .n-collapse-item__content-inner {
@apply pt-1 pb-4 pl-6;
}
.production-tool-stack .detail-disclosure-content {
@apply py-3 px-4 bg-(--app-subtle);
}
.production-tool-stack .workspace-overview-panel {
@apply m-0;
}
.production-controls {
@apply grid grid-cols-[minmax(220px,_1.6fr)_minmax(110px,_0.5fr)_minmax(230px,_1fr)_auto] items-end gap-[18px];
}
.production-pipeline {
@apply grid grid-cols-[repeat(3,_minmax(0,_1fr))] gap-3.5;
}
.production-pipeline-card {
@apply p-5;
}
.production-stats {
@apply grid grid-cols-[repeat(3,_1fr)] gap-2;
}
.production-stats div,
.production-status-grid div {
@apply p-2.5 rounded-none bg-(--app-subtle);
}
.production-stats dt,
.production-status-grid dt {
@apply text-muted text-[10px];
}
.production-stats dd,
.production-status-grid dd {
@apply mt-[5px] text-[13px] font-mono;
}
.video-input-plan-summary {
@apply grid grid-cols-2 gap-2;
}
.video-input-plan-summary div {
@apply flex items-center justify-between gap-2 p-2.5 bg-(--app-subtle) text-[11px] text-muted;
}
.video-input-plan-summary strong {
@apply font-mono text-xs text-(--app-text);
}
.production-status-grid {
@apply grid grid-cols-[repeat(5,_minmax(0,_1fr))] gap-2.5;
}
.production-workspace {
@apply grid grid-cols-[220px_minmax(0,_1fr)] items-start overflow-hidden;
}
.production-shot-list {
@apply max-h-[760px] overflow-hidden bg-(--app-surface) py-2;
}
@media (max-width: 1100px) {
.production-pipeline {
@apply grid-cols-[1fr];
}
.production-controls {
@apply grid-cols-[repeat(2,_minmax(0,_1fr))];
}
}
@media (max-width: 760px) {
.production-tools-intro,
.production-section-heading {
@apply items-start;
}
.production-tool-stack {
@apply px-3;
}
.production-tool-stack .production-tool-section .n-collapse-item__content-inner {
@apply pl-4;
}
.production-controls,
.production-workspace {
@apply grid-cols-[minmax(0,_1fr)];
}
.production-shot-list {
@apply flex max-h-none overflow-hidden;
border-right: none;
}
.production-status-grid {
@apply grid-cols-[repeat(2,_minmax(0,_1fr))];
}
}
.workspace-inline-status {
@apply flex items-center flex-wrap justify-between gap-y-2 gap-x-4 py-[7px] px-3 shrink-0 rounded-none bg-(--app-subtle) text-xs;
}
.production-pipeline-card > .confirm-action {
@apply mt-4 mb-1;
}
.production-workspace {
@apply flex-1 min-h-0 items-stretch overflow-hidden;
}
.production-workspace {
@apply grid-cols-[clamp(240px,_22%,_280px)_minmax(0,_1fr)];
}
.production-shot-list {
@apply max-h-none overflow-hidden min-h-0;
}
.production-workspace > article {
@apply overflow-hidden min-h-0 overscroll-contain;
}
.production-shot-list-content {
@apply gap-3 pt-0 px-0 pb-3;
}
.production-shot-list {
@apply p-0;
}
@media (max-width: 1000px) {
.production-controls {
@apply grid-cols-[minmax(130px,_1fr)_90px];
}
}
@media (max-width: 760px) {
/* 移动端隐藏可由镜头目录获知的重复统计,并让操作从左侧连续排列。 */
.production-workspace-page .workspace-toolbar {
@apply grid grid-cols-[minmax(0,_1fr)] gap-2;
}
.production-workspace-page .toolbar-episode,
.production-workspace-page .toolbar-actions {
@apply w-full min-w-0 m-0;
}
.production-workspace-page .toolbar-summary {
@apply hidden;
}
.production-workspace-page .toolbar-actions {
@apply justify-start;
}
.production-workspace {
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[184px_minmax(0,_1fr)];
}
.production-pipeline {
@apply grid-cols-[1fr];
}
}
</style>