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

155 lines
7.3 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 ContextNotice from '../../../components/ui/ContextNotice.vue'
import ImagePreparationPlan from './ImagePreparationPlan.vue'
import { userFacingText } from '../../../lib/user-facing-text'
import { computed } from 'vue'
import { NCollapse, NCollapseItem, NScrollbar } from 'naive-ui'
import type { ProductionPlan, ProjectProductionStatus } from '../types'
/** 展示当前制作计划与真实资产状态,不在页面重复推断业务规则。 */
const props = defineProps<{
/** 当前真实计划。 */ plan: ProductionPlan
/** 可选的已生成资产统计。 */ status?: ProjectProductionStatus
}>()
/** 生产阶段共享计划字段,角色身份就绪信息单独展示,避免混用不同 DTO。 */
const rows = computed(() => [
...(props.plan.stableIdentityAnchors ? [{ label: '稳定身份锚点', stage: props.plan.stableIdentityAnchors }] : []),
{ label: '主体参考图', stage: props.plan.subjectImages },
{ label: '首帧质量', stage: props.plan.keyframes },
{ label: '视频提示词', stage: props.plan.videoPrompts },
{ label: '视频任务', stage: props.plan.videos }
])
const stageNames = { subject_images: '主体参考图', keyframes: '首帧', videos: '视频', completed: '全部完成' }
/** 保留全部后端问题,包括预计可由前置阶段解决的问题,便于核对计划。 */
const problems = computed(() => [
...props.plan.details.subjectImages
.filter(item => item.issues.length)
.map(item => ({
key: `form:${item.subjectFormId}`,
label: `主体参考图 · ${item.subjectName} / ${item.formName}(${item.subjectRef})`,
issues: item.issues
})),
...[
{ label: '首帧', key: 'keyframe', items: props.plan.details.keyframes },
{ label: '视频提示词', key: 'prompt', items: props.plan.details.videoPrompts },
{ label: '视频', key: 'video', items: props.plan.details.videos }
].flatMap(group =>
group.items
.filter(item => item.issues.length)
.map(item => ({
key: `${group.key}:${item.shotId}`,
label: `${group.label} · 镜头 ${item.shotNo}(${item.shotId})`,
issues: item.issues
}))
)
])
</script>
<template>
<section class="surface-inset mt-3 p-4" aria-label="制作执行计划">
<h3 class="text-sm font-semibold">执行计划 · 仅检查,不产生生成费用</h3>
<div class="mt-3 flex flex-wrap gap-2 text-xs" role="status">
<span class="status-chip">入口:{{ plan.canStart ? '可启动' : '未就绪' }}</span>
<span class="status-chip">自动执行:{{ plan.canAutoRun ? '可继续' : '需处理阻塞' }}</span>
<span class="status-chip">图片模型:{{ plan.providers.image }}</span>
<span class="status-chip">视频模型:{{ plan.providers.video }}</span>
</div>
<!-- 以下是角色身份实际就绪统计模块 -->
<p v-if="plan.characterIdentity" class="mt-2 text-xs">
角色身份:已就绪 {{ plan.characterIdentity.ready }} / {{ plan.characterIdentity.total }} · 待就绪
{{ plan.characterIdentity.pending }} · 可自动补齐 {{ plan.characterIdentity.autoResolvable }} · 需人工处理
{{ plan.characterIdentity.manualBlocked }}
</p>
<p v-if="status" class="mt-2 text-xs" role="status">
当前制作状态:{{ status.completed ? '制作已完成' : `待完成${stageNames[status.stage]}` }} · 有效主体图
{{ status.subjectImages.current }}/{{ status.subjectImages.total }} · 有效首帧
{{ status.keyframes.skipped }}/{{ status.keyframes.total }} · 有效主视频 {{ status.videos.skipped }}/{{
status.videos.total
}}
· 视频进行中 {{ status.videos.inProgress }}
</p>
<NScrollbar x-scrollable class="mt-3">
<table class="production-plan-table">
<caption class="sr-only">
各阶段当前执行数量
</caption>
<thead>
<tr>
<th scope="col">阶段</th>
<th scope="col">总数</th>
<th scope="col">可执行</th>
<th scope="col">跳过</th>
<th scope="col">准备完成后可执行</th>
<th scope="col">需人工处理</th>
</tr>
</thead>
<tbody>
<tr v-for="row in rows" :key="row.label">
<th scope="row">{{ row.label }}</th>
<td>{{ row.stage.total }}</td>
<td>{{ row.stage.planned }}</td>
<td>{{ row.stage.skipped }}</td>
<td>{{ row.stage.upstreamResolvable }}</td>
<td>{{ row.stage.manualBlocked }}</td>
</tr>
</tbody>
</table>
</NScrollbar>
<p class="mt-2 text-xs text-muted">
计划只反映当前准备情况。图片生成完成后仍需通过质量和来源检查;失败候选会保留,不能用重新生图自动消除质量阻断。
</p>
<ContextNotice v-if="plan.hasManualBlockers" type="warning" :show-icon="false" class="mt-3">
当前有
{{ plan.manualBlocked }}
项独立准备问题需人工处理。上表各阶段的影响数量可能重叠,不能直接相加。可先生成就绪的主体参考图;成功结果会保留,遇到阻塞时后续阶段可能暂停。
</ContextNotice>
<!-- 以下是当前道具规格、共享母版依赖与质量处理入口 -->
<div class="mt-5 grid items-start gap-6 lg:grid-cols-2"><ImagePreparationPlan :plan="plan" /></div>
<NCollapse v-if="problems.length" class="mt-3" :default-expanded-names="['issues']">
<NCollapseItem name="issues" title="查看还需要准备的内容">
<ul class="space-y-3 text-xs">
<li v-for="item in problems" :key="item.key">
<strong class="break-all">{{ item.label }}</strong>
<p v-for="(issue, index) in item.issues" :key="index" class="mt-1 break-words">
{{ userFacingText(issue.reason)
}}<span v-if="issue.missingSubjects?.length">
· 关联主体:{{ issue.missingSubjects.join('、') }}</span
>
</p>
</li>
</ul>
</NCollapseItem>
</NCollapse>
</section>
</template>
<style scoped>
.production-plan-table {
width: 100%;
min-width: 540px;
border-collapse: collapse;
font-size: 12px;
}
.production-plan-table th,
.production-plan-table td {
padding: 9px 12px;
text-align: left;
}
.production-plan-table thead {
background: var(--app-control);
}
.production-plan-table tbody {
background: var(--app-surface);
}
.production-plan-table tbody tr:nth-child(even) {
background: var(--app-subtle);
}
.status-chip {
display: inline-flex;
align-items: center;
padding: 4px 8px;
background: var(--app-subtle);
}
</style>