fix(short-drama-agent-front): 优化拆解引导与质量规则配置
This commit is contained in:
1 parent
c6ef595a8e
commit
2db8549818
13 files changed
+626
-225
No files matched your search
@@ -1,14 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
import { NScrollbar } from 'naive-ui'
|
||||
/** 工作区默认固定标题和操作区,可让手机提示、目录与正文在项目内容区一起滚动。 */
|
||||
defineProps<{
|
||||
/** 是否采用目录与详情分栏。 */
|
||||
split?: boolean
|
||||
/** 是否使用紧凑内容布局。 */
|
||||
compact?: boolean
|
||||
/** 手机是否让提示、工具、目录和正文一起滚动,项目顶栏仍固定。 */
|
||||
mobileScroll?: boolean
|
||||
}>()
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
/** 是否采用目录与详情分栏。 */
|
||||
split?: boolean
|
||||
/** 是否使用紧凑内容布局。 */
|
||||
compact?: boolean
|
||||
/** 手机是否让提示、工具、目录和正文一起滚动,项目顶栏仍固定。 */
|
||||
mobileScroll?: boolean
|
||||
/** 隐藏标题区时保留插槽内已有弹层实例,空状态入口仍能复用它们。 */
|
||||
headerVisible?: boolean
|
||||
}>(),
|
||||
{ headerVisible: true }
|
||||
)
|
||||
</script>
|
||||
<template>
|
||||
<section
|
||||
@@ -17,7 +22,10 @@ defineProps<{
|
||||
>
|
||||
<!-- 以下是统一对齐的页面提示、标题与正文模块 -->
|
||||
<div v-if="$slots.notice" class="workspace-notice"><slot name="notice" /></div>
|
||||
<NScrollbar v-if="$slots.header" class="workspace-heading-scroll"
|
||||
<NScrollbar
|
||||
v-if="$slots.header"
|
||||
:style="headerVisible ? undefined : { display: 'none' }"
|
||||
class="workspace-heading-scroll"
|
||||
><header class="workspace-heading"><slot name="header" /></header
|
||||
></NScrollbar>
|
||||
<div v-if="split" class="workspace-split"><slot /></div>
|
||||
|
||||
@@ -90,6 +90,10 @@ const subjects = computed(() => result.value?.subjectCandidates ?? [])
|
||||
const forms = computed(() => result.value?.subjectForms ?? [])
|
||||
const plans = computed(() => result.value?.storyboardPlans ?? [])
|
||||
const shots = computed(() => result.value?.storyboardEpisodeShots ?? [])
|
||||
/** 主体、分镜及任务记录构成已有结果,搜索筛选不影响是否存在数据。 */
|
||||
const hasBreakdownResults = computed(
|
||||
() => !!(subjects.value.length || plans.value.length || shots.value.length || snapshot.value?.tasks?.length)
|
||||
)
|
||||
const summary = computed(() => snapshot.value?.taskSummary)
|
||||
/** 候选审核读取完成前不展示旧错误。 */
|
||||
const validation = computed(() =>
|
||||
@@ -554,11 +558,24 @@ const rules = {
|
||||
groupSize: integerRule('每组集数'),
|
||||
modules: fieldRule(value => Array.isArray(value) && value.length > 0, '请至少选择一个抽取模块', true)
|
||||
}
|
||||
/** 首次空页面收起重复工具栏;存在任务、历史记录或读取错误时继续显示真实状态。 */
|
||||
const isInitialEmpty = computed(
|
||||
() =>
|
||||
!hasBreakdownResults.value &&
|
||||
!records.value.length &&
|
||||
!backgroundExecution.query.data.value &&
|
||||
!backgroundExecution.active.value &&
|
||||
!backgroundExecution.discovering.value &&
|
||||
!backgroundExecution.discoveryError.value &&
|
||||
!backgroundExecution.query.error.value &&
|
||||
!operation.value.pending &&
|
||||
!error.value
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是手机完成提示自然滚走、分类导航与设置入口吸顶的拆解工作区 -->
|
||||
<WorkspacePage split compact mobile-scroll class="breakdown-workspace-page">
|
||||
<WorkspacePage split compact mobile-scroll class="breakdown-workspace-page" :header-visible="!isInitialEmpty">
|
||||
<template #header>
|
||||
<!-- 以下是拆解状态与设置 -->
|
||||
<div class="workspace-toolbar">
|
||||
@@ -868,7 +885,7 @@ const rules = {
|
||||
<p v-if="sourceLabel" class="text-xs text-muted" role="status">
|
||||
{{ sourceLabel }}<span v-if="quality.loading"> · 正在读取当前质量审核…</span>
|
||||
</p>
|
||||
<div class="result-toolbar tabs-toolbar">
|
||||
<div v-if="!isInitialEmpty" class="result-toolbar tabs-toolbar">
|
||||
<NTabs v-model:value="tab" class="workspace-tabs" type="line" size="small" aria-label="拆解结果"
|
||||
><!-- 以下是仅显示分类名称的拆解标签模块,主体数量保留在搜索统计中 -->
|
||||
<NTab v-for="option in moduleOptions" :key="option.value" :name="option.value">{{
|
||||
@@ -918,8 +935,30 @@ const rules = {
|
||||
</div>
|
||||
<div class="breakdown-content panel">
|
||||
<main class="min-w-0 min-h-0 overflow-hidden">
|
||||
<!-- 以下是首次无任务空页面的居中入口,已有任务时恢复原分类内容 -->
|
||||
<NScrollbar
|
||||
v-if="isInitialEmpty"
|
||||
class="panel-scroll breakdown-results-scroll"
|
||||
content-class="breakdown-empty-scroll-content"
|
||||
>
|
||||
<EmptyState
|
||||
class="breakdown-initial-empty"
|
||||
title="还没有拆解结果"
|
||||
description="点击“拆解设置”,选择需要的模块和分组,预览后再确认生成。"
|
||||
>
|
||||
<NButton
|
||||
type="primary"
|
||||
aria-label="拆解设置"
|
||||
aria-haspopup="dialog"
|
||||
:aria-expanded="toolsOpen"
|
||||
@click="toolsOpen = true"
|
||||
><template #icon><Settings2 :size="16" aria-hidden="true" /></template
|
||||
>拆解设置</NButton
|
||||
>
|
||||
</EmptyState>
|
||||
</NScrollbar>
|
||||
<!-- 所有结果标签共用有界的内容滚动;切换标签回到顶部,不继承上一列表的位置。 -->
|
||||
<NScrollbar :key="tab" class="panel-scroll breakdown-results-scroll">
|
||||
<NScrollbar v-else :key="tab" class="panel-scroll breakdown-results-scroll">
|
||||
<template v-for="option in moduleOptions" :key="option.value"
|
||||
><div v-if="tab === option.value" class="breakdown-result-pad">
|
||||
<SubjectList
|
||||
@@ -1213,6 +1252,13 @@ const rules = {
|
||||
.breakdown-results-scroll .n-scrollbar-content {
|
||||
@apply wrap-anywhere;
|
||||
}
|
||||
/* 空数据引导使用正文剩余高度居中,短视口仍由原有滚动容器承接。 */
|
||||
.breakdown-empty-scroll-content {
|
||||
min-height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
.breakdown-result-pad {
|
||||
/* 条目保留自身背景和内边距,外层不再重复缩进搜索和结果。 */
|
||||
@apply p-0;
|
||||
@@ -1283,6 +1329,10 @@ const rules = {
|
||||
max-height: none;
|
||||
overflow: visible;
|
||||
}
|
||||
/* 手机正文自然滚动,同时为首次操作保留清晰的居中区域。 */
|
||||
.breakdown-empty-scroll-content {
|
||||
min-height: min(55dvh, 420px);
|
||||
}
|
||||
}
|
||||
@media (max-width: 800px) {
|
||||
.breakdown-workspace-page .workspace-toolbar {
|
||||
|
||||
@@ -25,8 +25,8 @@ const filtered = computed(() =>
|
||||
|
||||
<template>
|
||||
<div class="subject-list">
|
||||
<!-- 以下是主体搜索 -->
|
||||
<div class="subject-list-toolbar">
|
||||
<!-- 以下是有主体数据时的搜索与统计,搜索无匹配结果时仍保留操作入口 -->
|
||||
<div v-if="subjects.length" class="subject-list-toolbar">
|
||||
<NInput
|
||||
class="subject-list-search"
|
||||
placeholder="搜索名称或引用"
|
||||
|
||||
@@ -1,20 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { NButton, NTabs, NTabPane } from 'naive-ui'
|
||||
import { AppDrawer } from '../../../components/ui'
|
||||
import type { CreativeProfileInput } from '../types'
|
||||
import CreativeProfileSettings from './CreativeProfileSettings.vue'
|
||||
import QualityPolicySettings from './QualityPolicySettings.vue'
|
||||
import type { ProjectSettingsTab } from '../context'
|
||||
|
||||
/** 项目全局配置全屏抽屉参数。 */
|
||||
const props = defineProps<{
|
||||
/** 当前正式项目 ID。 */
|
||||
projectId: string
|
||||
/** 项目操作期间只读查看,禁止保存模型配置。 */
|
||||
disabled: boolean
|
||||
}>()
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
/** 当前正式项目 ID。 */
|
||||
projectId: string
|
||||
/** 项目操作期间只读查看,禁止保存模型配置。 */
|
||||
disabled: boolean
|
||||
/** 辅助入口指定本次打开的配置分类。 */ initialTab?: ProjectSettingsTab
|
||||
}>(),
|
||||
{ initialTab: 'generation' }
|
||||
)
|
||||
/** 真实保存成功后通知项目布局更新就绪信息。 */
|
||||
const emit = defineEmits<{ saved: [profile: CreativeProfileInput] }>()
|
||||
const emit = defineEmits<{
|
||||
/** 生成配置已真实保存。 */ saved: [profile: CreativeProfileInput]
|
||||
/** 质量规则已真实保存,需要重新读取项目阶段状态。 */ qualitySaved: []
|
||||
}>()
|
||||
/** 项目配置全屏抽屉显隐状态。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 保存进行中时禁止关闭抽屉,避免重复写入。 */
|
||||
@@ -22,7 +30,11 @@ const saving = ref(false)
|
||||
/** 配置表单实例,footer 调用表单自身的校验与保存入口。 */
|
||||
const form = ref<InstanceType<typeof CreativeProfileSettings> | null>(null)
|
||||
/** 项目级配置分类保持同一个全屏抽屉与底栏。 */
|
||||
const tab = ref('generation')
|
||||
const tab = ref<ProjectSettingsTab>(props.initialTab)
|
||||
/** 每次打开定位本次请求的分类,保存中不打断当前表单。 */
|
||||
watch([open, () => props.initialTab, () => props.projectId], ([shown]) => {
|
||||
if (shown && !saving.value) tab.value = props.initialTab
|
||||
})
|
||||
/** 质量策略表单实例。 */
|
||||
const qualityForm = ref<InstanceType<typeof QualityPolicySettings> | null>(null)
|
||||
/** 当前标签的独立保存入口,避免跨接口混合保存。 */
|
||||
@@ -32,7 +44,9 @@ const activeForm = computed(() => (tab.value === 'quality' ? qualityForm.value :
|
||||
<template>
|
||||
<!-- 以下是内容铺满视口的项目全局配置抽屉模块 -->
|
||||
<AppDrawer v-model:open="open" title="项目全局配置" :busy="saving">
|
||||
<template #description>设置生成模型、画布与质量规则,后续制作使用已保存的项目配置。</template>
|
||||
<template #description
|
||||
>生成配置用于后续生图和视频;质量规则用于拆解与分镜检查,启动拆解时会引导核对确认。</template
|
||||
>
|
||||
<!-- 以下是生成配置与质量规则分类导航,保存期间禁止切换 -->
|
||||
<NTabs v-if="open" v-model:value="tab" type="line" size="small">
|
||||
<NTabPane name="generation" tab="生成配置" :disabled="saving" display-directive="show:lazy">
|
||||
@@ -54,6 +68,7 @@ const activeForm = computed(() => (tab.value === 'quality' ? qualityForm.value :
|
||||
:project-id="props.projectId"
|
||||
:disabled="props.disabled"
|
||||
@busy="saving = $event"
|
||||
@saved="emit('qualitySaved')"
|
||||
/>
|
||||
</NTabPane>
|
||||
</NTabs>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<script setup lang="ts">
|
||||
import type { ProjectQualityPolicy } from '../../projects/types'
|
||||
import QualityPolicyExceptions from './QualityPolicyExceptions.vue'
|
||||
|
||||
/** 已保存规则只读核对,不创建可编辑草稿或修改动作许可。 */
|
||||
defineProps<{
|
||||
/** 本次检查使用的真实规则。 */ policy: ProjectQualityPolicy
|
||||
}>()
|
||||
/** 物理表现方式仅翻译显示名称,原始规则保持不变。 */
|
||||
const physicsLabels = { realistic: '写实物理', stylized: '风格化表现', fantasy: '幻想表现' }
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是当前规则的简短只读摘要,编辑统一前往项目配置 -->
|
||||
<div class="grid min-w-0 gap-4 text-sm leading-7">
|
||||
<p>物理表现:{{ physicsLabels[policy.physicsMode] }}</p>
|
||||
<div class="flex flex-wrap gap-x-6 gap-y-2 text-muted">
|
||||
<span>夸张动作:{{ policy.allowExaggeratedMotion ? '允许' : '不允许' }}</span>
|
||||
<span>非物理动作:{{ policy.allowNonPhysicalActions ? '允许' : '不允许' }}</span>
|
||||
<span>超自然能力:{{ policy.allowSupernaturalAbilities ? '允许' : '不允许' }}</span>
|
||||
</div>
|
||||
<div v-if="policy.customRules.length" class="grid gap-2">
|
||||
<p class="font-medium">自定义规则</p>
|
||||
<ul class="list-inside list-disc space-y-1">
|
||||
<li v-for="(rule, index) in policy.customRules" :key="index" class="whitespace-pre-wrap wrap-anywhere">
|
||||
{{ rule }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<p v-else class="text-muted">未添加自定义规则。</p>
|
||||
<QualityPolicyExceptions :exceptions="policy.actionExceptions ?? []" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,9 +1,12 @@
|
||||
import { inject, ref, type InjectionKey, type Ref } from 'vue'
|
||||
|
||||
/** 项目配置沿用同一个抽屉,可直接定位生成配置或质量规则。 */
|
||||
export type ProjectSettingsTab = 'generation' | 'quality'
|
||||
|
||||
/** 项目内共享的配置修订号,成功保存后通知已挂载的生成表单重新读取。 */
|
||||
export const projectGenerationRevisionKey: InjectionKey<Ref<number>> = Symbol('project-generation-revision')
|
||||
/** 工作区辅助入口打开同一个项目配置抽屉,避免新建重复表单或覆盖当前路由。 */
|
||||
export const projectSettingsOpenKey: InjectionKey<() => void> = Symbol('project-settings-open')
|
||||
export const projectSettingsOpenKey: InjectionKey<(tab?: ProjectSettingsTab) => void> = Symbol('project-settings-open')
|
||||
|
||||
/**
|
||||
* 读取项目配置修订号,独立使用组件时保留本地修订状态。
|
||||
|
||||
@@ -153,7 +153,7 @@ const confirmationDescription = computed(
|
||||
v-if="openProjectSettings"
|
||||
class="workspace-action-button"
|
||||
:disabled="operation.pending"
|
||||
@click="openProjectSettings"
|
||||
@click="openProjectSettings()"
|
||||
>
|
||||
<template #icon><Settings2 :size="15" aria-hidden="true" /></template>前往项目配置
|
||||
</NButton>
|
||||
|
||||
@@ -18,6 +18,7 @@ import { productionMessage } from '../production/production-messages'
|
||||
import StoryboardPreparation from '../storyboard-preparation/StoryboardPreparation.vue'
|
||||
import ProjectSettingsDialog from '../generation-config/components/ProjectSettingsDialog.vue'
|
||||
import { projectGenerationRevisionKey, projectSettingsOpenKey } from '../generation-config/context'
|
||||
import type { ProjectSettingsTab } from '../generation-config/context'
|
||||
import CreateDramaSkeleton from '../create-drama/CreateDramaSkeleton.vue'
|
||||
import BreakdownSkeleton from '../breakdown/BreakdownSkeleton.vue'
|
||||
import VisualStyleSkeleton from '../visual-style/VisualStyleSkeleton.vue'
|
||||
@@ -39,8 +40,14 @@ const generationRevision = ref(0)
|
||||
provide(projectGenerationRevisionKey, generationRevision)
|
||||
/** 项目标题栏共用配置弹窗开关。 */
|
||||
const settingsOpen = ref(false)
|
||||
/** 打开标题栏已有的项目配置抽屉,保留当前镜头与工作区。 */
|
||||
function openProjectSettings() {
|
||||
/** 本次项目配置打开的指定分类,不改变当前工作区路由。 */
|
||||
const settingsTab = ref<ProjectSettingsTab>('generation')
|
||||
/**
|
||||
* 打开标题栏已有配置抽屉,保留当前镜头与工作区。
|
||||
* @param tab 本次需要定位的配置分类
|
||||
*/
|
||||
function openProjectSettings(tab: ProjectSettingsTab = 'generation') {
|
||||
settingsTab.value = tab
|
||||
settingsOpen.value = true
|
||||
}
|
||||
provide(projectSettingsOpenKey, openProjectSettings)
|
||||
@@ -48,7 +55,7 @@ provide(projectSettingsOpenKey, openProjectSettings)
|
||||
watch(
|
||||
() => route.query.configure,
|
||||
value => {
|
||||
if (value === 'profile') settingsOpen.value = true
|
||||
if (value === 'profile') openProjectSettings()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
@@ -292,7 +299,7 @@ onScopeDispose(() => {
|
||||
size="small"
|
||||
aria-label="项目配置"
|
||||
:disabled="!context.project.value"
|
||||
@click="settingsOpen = true"
|
||||
@click="openProjectSettings()"
|
||||
><template #icon><Settings2 :size="15" aria-hidden="true" /></template
|
||||
><span class="project-config-label">项目配置</span></NButton
|
||||
>
|
||||
@@ -315,9 +322,11 @@ onScopeDispose(() => {
|
||||
:key="id"
|
||||
v-if="context.project.value?.id === id"
|
||||
v-model:open="settingsOpen"
|
||||
:initial-tab="settingsTab"
|
||||
:project-id="id"
|
||||
:disabled="operation.pending"
|
||||
@saved="projectSettingsSaved"
|
||||
@quality-saved="context.refresh()"
|
||||
/>
|
||||
<div class="project-view">
|
||||
<RouterView v-if="context.project.value?.id === id && currentAccess?.enabled" :key="id" />
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { computed, inject, ref, watch } from 'vue'
|
||||
import { NButton, NCheckbox, NFormItem, NInput, NTag } from 'naive-ui'
|
||||
import { ArrowLeft, CheckCheck, RefreshCw, Save, ShieldCheck, Wrench } from '@lucide/vue'
|
||||
import AppDrawer from '../../components/ui/AppDrawer.vue'
|
||||
import WorkspaceActionTooltip from '../../components/ui/WorkspaceActionTooltip.vue'
|
||||
import WorkspaceSectionHeading from '../../components/ui/WorkspaceSectionHeading.vue'
|
||||
import QualityPolicySettings from '../generation-config/components/QualityPolicySettings.vue'
|
||||
import QualityPolicySummary from '../generation-config/components/QualityPolicySummary.vue'
|
||||
import { projectSettingsOpenKey } from '../generation-config/context'
|
||||
import EmptyState from '../../components/ui/EmptyState.vue'
|
||||
import FormalRepairEditor from './FormalRepairEditor.vue'
|
||||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||||
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||||
@@ -36,6 +38,10 @@ const props = withDefaults(
|
||||
const emit = defineEmits<{ changed: [] }>()
|
||||
/** 全屏入口,未打开不读取完整复检。 */
|
||||
const open = ref(false)
|
||||
/** 复用标题栏的唯一配置入口,跳转时指定质量规则分类。 */
|
||||
const openProjectSettings = inject(projectSettingsOpenKey, undefined)
|
||||
/** 只记录用户主动的抽屉交接,等待当前抽屉离场后再打开配置。 */
|
||||
const queuedSettingsProject = ref('')
|
||||
/** 当前项目任务观察与表单共同绑定项目。 */
|
||||
const id = computed(() => props.projectId)
|
||||
/** 首次打开后才观察派生任务,关闭不丢失正在运行的任务。 */
|
||||
@@ -63,8 +69,6 @@ const repairIssue = ref<PreparationIssue | null>(null)
|
||||
const repairEditor = ref<InstanceType<typeof FormalRepairEditor> | null>(null)
|
||||
/** 真实正式修订写入时锁定关闭。 */
|
||||
const repairWriting = ref(false)
|
||||
/** 项目质量规则表单,完整保留旧例外。 */
|
||||
const policyEditor = ref<InstanceType<typeof QualityPolicySettings> | null>(null)
|
||||
/** 规则确认及派生生成启动中的真实请求。 */
|
||||
const actionWriting = ref(false)
|
||||
/** 明确核对项目规则,打开时不默认勾选。 */
|
||||
@@ -81,6 +85,8 @@ const reviewNote = ref('')
|
||||
const actionError = ref('')
|
||||
/** 真实写入期间统一锁定抽屉。 */
|
||||
const busy = computed(() => flow.writing.value || repairWriting.value || actionWriting.value)
|
||||
/** 正式镜头存在时才展示拆解后的检查项,不将尚未拆解误报为待修复。 */
|
||||
const hasFormalShots = computed(() => (flow.data.value?.quality.coverage.shotCount ?? 0) > 0)
|
||||
/** 必要分项检查只依据真实返回,不使用结构通过代替质量通过。 */
|
||||
const checks = computed(() => {
|
||||
const data = flow.data.value
|
||||
@@ -103,6 +109,10 @@ watch(flow.sourceKey, () => {
|
||||
baselineAcknowledged.value = false
|
||||
reviewAcknowledged.value = false
|
||||
})
|
||||
/** 切项目后撤销旧项目尚未完成的配置交接。 */
|
||||
watch(id, () => {
|
||||
queuedSettingsProject.value = ''
|
||||
})
|
||||
/** 打开时读取;关闭立即废弃旧结果及未完成只读请求。 */
|
||||
watch(
|
||||
[open, id],
|
||||
@@ -128,11 +138,21 @@ for (const task of [directionTask, visualTask])
|
||||
}
|
||||
)
|
||||
|
||||
/** 明确确认当前项目规则,必要时先 CAS 保存,不调用拆解或模型。 */
|
||||
/** 先关闭当前检查抽屉,不叠加项目配置。 */
|
||||
function requestQualitySettings() {
|
||||
if (busy.value || !openProjectSettings) return
|
||||
queuedSettingsProject.value = id.value
|
||||
open.value = false
|
||||
}
|
||||
/** 离场与焦点约束释放后,打开同项目的质量规则编辑入口。 */
|
||||
function preparationClosed() {
|
||||
const projectId = queuedSettingsProject.value
|
||||
queuedSettingsProject.value = ''
|
||||
if (projectId && projectId === id.value) openProjectSettings?.('quality')
|
||||
}
|
||||
/** 明确确认当前已保存规则,只核对版本,不在检查入口保存另一份草稿。 */
|
||||
async function confirmPolicy() {
|
||||
if (locked.value || busy.value || flow.reading.value || !policyAcknowledged.value || !flow.data.value) return
|
||||
const draft = policyEditor.value?.validatedDraft()
|
||||
if (!draft) return
|
||||
const projectId = id.value,
|
||||
expected = flow.data.value.policy
|
||||
actionWriting.value = true
|
||||
@@ -141,17 +161,14 @@ async function confirmPolicy() {
|
||||
projectId,
|
||||
'确认项目质量规则',
|
||||
async () => {
|
||||
let current = validateQualityPolicyReceipt(await projectsApi.qualityPolicy(projectId), projectId)
|
||||
const current = validateQualityPolicyReceipt(await projectsApi.qualityPolicy(projectId), projectId)
|
||||
if (id.value !== projectId || !open.value) throw new Error('项目或确认页面已变化,请重新核对。')
|
||||
if (current.revision !== expected.revision || current.fingerprint !== expected.fingerprint)
|
||||
if (
|
||||
current.revision !== expected.revision ||
|
||||
current.fingerprint !== expected.fingerprint ||
|
||||
qualityPolicySignature(current.policy) !== qualityPolicySignature(expected.policy)
|
||||
)
|
||||
throw new Error('质量规则已变化,请刷新后重新核对。')
|
||||
if (qualityPolicySignature(draft) !== qualityPolicySignature(current.policy))
|
||||
current = validateQualityPolicyReceipt(
|
||||
await projectsApi.saveQualityPolicy(projectId, draft, current.revision),
|
||||
projectId
|
||||
)
|
||||
if (qualityPolicySignature(current.policy) !== qualityPolicySignature(draft))
|
||||
throw new Error('规则保存内容尚未确认,请重新核对。')
|
||||
if (id.value !== projectId || !open.value) throw new Error('项目或确认页面已变化,请重新核对。')
|
||||
const result = validateQualityPolicyReceipt(
|
||||
await projectsApi.confirmQualityPolicy(projectId, current.revision),
|
||||
@@ -164,7 +181,12 @@ async function confirmPolicy() {
|
||||
)
|
||||
throw new Error('规则确认结果不一致,请刷新。')
|
||||
},
|
||||
{ type: 'info', content: '项目质量规则已确认,还需核对正式分镜的来源和质量。' }
|
||||
{
|
||||
type: 'info',
|
||||
content: hasFormalShots.value
|
||||
? '项目质量规则已确认,还需核对正式分镜的来源和质量。'
|
||||
: '项目质量规则已确认,可在拆解设置中继续。分镜检查在拆解后进行。'
|
||||
}
|
||||
)
|
||||
actionWriting.value = false
|
||||
if (id.value !== projectId) return
|
||||
@@ -246,7 +268,8 @@ async function repaired() {
|
||||
v-model:open="open"
|
||||
:title="repairIssue ? '修订正式分镜问题' : '制作前检查'"
|
||||
:busy="busy"
|
||||
description="先核对分镜、处理问题并完成人工审核,再补齐设计和进入镜头制作。"
|
||||
description="用于拆解后的正式分镜审核与制作检查;首次拆解无需先完成这里的分镜检查。"
|
||||
@closed="preparationClosed"
|
||||
>
|
||||
<!-- 以下是在同一抽屉内查看当前正式镜头的修订模块 -->
|
||||
<FormalRepairEditor
|
||||
@@ -274,7 +297,7 @@ async function repaired() {
|
||||
<p v-if="flow.notice.value" role="status" class="text-sm text-muted">{{ flow.notice.value }}</p>
|
||||
<template v-if="flow.data.value">
|
||||
<!-- 以下是分项检查,未知或未通过不伪装成成功 -->
|
||||
<section class="space-y-4">
|
||||
<section v-if="hasFormalShots" class="space-y-4">
|
||||
<WorkspaceSectionHeading
|
||||
title="当前准备情况"
|
||||
description="结构通过、局部修订完成和整体审核是不同步骤。"
|
||||
@@ -292,164 +315,171 @@ async function repaired() {
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- 以下是第一次明确确认规则,不显示空白精确例外 -->
|
||||
<section v-if="!flow.policyConfirmed.value" class="space-y-4">
|
||||
<WorkspaceSectionHeading
|
||||
title="核对项目质量规则"
|
||||
description="确认故事允许哪些动作;已有精确例外会继续保留。"
|
||||
/><QualityPolicySettings
|
||||
ref="policyEditor"
|
||||
:key="flow.data.value.policy.revision"
|
||||
:project-id="projectId"
|
||||
:initial-policy="flow.data.value.policy"
|
||||
:disabled="locked || busy"
|
||||
/><NCheckbox v-model:checked="policyAcknowledged" :disabled="locked || busy"
|
||||
>我已核对当前项目质量规则</NCheckbox
|
||||
><NButton
|
||||
type="primary"
|
||||
:disabled="!policyAcknowledged || locked || busy || flow.reading.value"
|
||||
:loading="actionWriting"
|
||||
@click="confirmPolicy"
|
||||
><template #icon><ShieldCheck :size="15" /></template>确认项目质量规则</NButton
|
||||
>
|
||||
</section>
|
||||
<!-- 以下是旧分镜缺少规则记录时的明确重新核对,不重跑拆解 -->
|
||||
<section v-if="!flow.data.value.quality.provenance.qualityPolicyConsistent" class="space-y-4">
|
||||
<WorkspaceSectionHeading
|
||||
title="核对旧分镜采用的规则"
|
||||
description="旧分镜没有完整规则记录时,由复核人明确采用当前已确认规则重新检查。不会重写历史记录,也不会重新拆解。"
|
||||
/>
|
||||
<p v-for="reason in flow.data.value.baseline.reasons" :key="reason" class="text-sm text-muted">
|
||||
{{ userFacingText(reason) }}
|
||||
</p>
|
||||
<template v-if="flow.baselineAllowed.value"
|
||||
><NFormItem label="复核人"
|
||||
><NInput
|
||||
aria-label="来源复核人"
|
||||
v-model:value="reviewer"
|
||||
placeholder="填写实际复核人" /></NFormItem
|
||||
><NFormItem label="核对说明"
|
||||
><NInput
|
||||
aria-label="来源核对说明"
|
||||
v-model:value="reviewNote"
|
||||
type="textarea"
|
||||
placeholder="说明核对范围及采用当前规则的依据" /></NFormItem
|
||||
><NCheckbox v-model:checked="baselineAcknowledged" :disabled="locked || busy"
|
||||
>我已核对旧分镜,明确采用当前规则继续复检</NCheckbox
|
||||
><NButton
|
||||
type="primary"
|
||||
:disabled="!baselineAcknowledged || locked || busy || flow.reading.value"
|
||||
@click="confirmReview('baseline')"
|
||||
>确认规则来源</NButton
|
||||
></template
|
||||
>
|
||||
</section>
|
||||
<!-- 以下是正式主体、动作及来源问题,局部修订独立确认 -->
|
||||
<!-- 以下是同一份项目规则的只读核对,编辑统一交接到项目配置 -->
|
||||
<section class="space-y-4">
|
||||
<WorkspaceSectionHeading
|
||||
title="处理正式分镜问题"
|
||||
description="只修订明确的问题镜头。涉及规则来源或现有素材保护时,先处理对应限制。"
|
||||
/>
|
||||
<p v-if="!flow.issues.value.length" class="text-sm text-muted">
|
||||
当前未返回具体镜头问题,请继续核对上面的来源条件和人工审核。
|
||||
</p>
|
||||
<article
|
||||
v-for="(item, index) in flow.issues.value"
|
||||
:key="`${item.kind}-${index}`"
|
||||
class="problem-surface p-4 space-y-3"
|
||||
title="项目质量规则"
|
||||
description="规则统一在项目配置中编辑。首次拆解会引导确认,也可在此提前核对当前版本。"
|
||||
>
|
||||
<p class="text-xs text-muted">
|
||||
第 {{ item.episodeNo }} 集 · 剧情段落 {{ item.beatNo }} · 镜头 {{ item.shotNo ?? '待核对' }}
|
||||
</p>
|
||||
<p class="text-sm leading-6">{{ userFacingText(item.message) }}</p>
|
||||
<NButton
|
||||
class="workspace-action-button"
|
||||
v-if="item.kind !== 'source' && item.shotNo"
|
||||
:disabled="locked || busy || flow.reading.value"
|
||||
@click="repairIssue = item"
|
||||
><template #icon><Wrench :size="15" /></template>查看并修订</NButton
|
||||
<template #actions
|
||||
><NButton
|
||||
class="workspace-action-button"
|
||||
:disabled="busy || !openProjectSettings"
|
||||
@click="requestQualitySettings"
|
||||
>前往项目质量规则</NButton
|
||||
></template
|
||||
>
|
||||
</article>
|
||||
</WorkspaceSectionHeading>
|
||||
<NTag :type="flow.policyConfirmed.value ? 'success' : 'default'" :bordered="false">{{
|
||||
flow.policyConfirmed.value ? '当前规则已确认' : '当前规则待确认'
|
||||
}}</NTag>
|
||||
<QualityPolicySummary :policy="flow.data.value.policy.policy" />
|
||||
</section>
|
||||
<!-- 以下是正式整体人工审核,不以只读预检或旧记录代替 -->
|
||||
<section class="space-y-4">
|
||||
<WorkspaceSectionHeading
|
||||
title="人工确认整体分镜"
|
||||
description="检查通过后,由复核人核对动作、主体及镜头衔接。规则或镜头变化后原审核会失效。"
|
||||
/>
|
||||
<p v-if="flow.approved.value" class="text-sm text-muted">当前正式分镜已有有效审核记录。</p>
|
||||
<p v-else-if="!flow.reviewable.value" class="text-sm text-muted">
|
||||
请先处理规则来源、动作与主体问题,再进行整体审核。
|
||||
</p>
|
||||
<template v-else
|
||||
><NFormItem label="审核人"
|
||||
><NInput
|
||||
aria-label="整体审核人"
|
||||
v-model:value="reviewer"
|
||||
placeholder="填写实际审核人" /></NFormItem
|
||||
><NFormItem label="审核说明"
|
||||
><NInput
|
||||
aria-label="整体审核说明"
|
||||
v-model:value="reviewNote"
|
||||
type="textarea"
|
||||
placeholder="说明已核对的动作、主体、画面衔接及结论" /></NFormItem
|
||||
><NCheckbox v-model:checked="reviewAcknowledged" :disabled="locked || busy"
|
||||
>我已人工核对当前版本的全部正式分镜</NCheckbox
|
||||
><NButton
|
||||
type="primary"
|
||||
:disabled="!reviewAcknowledged || locked || busy || flow.reading.value"
|
||||
@click="confirmReview('approval')"
|
||||
><template #icon><CheckCheck :size="15" /></template>确认整体审核</NButton
|
||||
></template
|
||||
>
|
||||
</section>
|
||||
<!-- 以下是审核之后的设计补齐与真实生产入口状态 -->
|
||||
<section class="space-y-4">
|
||||
<WorkspaceSectionHeading
|
||||
title="补齐镜头设计与画面状态"
|
||||
description="先更新镜头设计,再更新画面状态。只补齐缺失或过期结果,生成可能产生模型费用。"
|
||||
/>
|
||||
<p class="text-sm text-muted">
|
||||
已保存镜头设计 {{ flow.data.value.entry.derivedAssets.directionCount }} /
|
||||
{{ flow.data.value.entry.derivedAssets.shotCount }} · 画面状态
|
||||
{{ flow.data.value.entry.derivedAssets.visualStateCount }} /
|
||||
{{ flow.data.value.entry.derivedAssets.shotCount }}
|
||||
</p>
|
||||
<div class="flex flex-wrap gap-3">
|
||||
<ConfirmAction
|
||||
label="补齐或更新镜头设计"
|
||||
description="处理整个项目中缺失或过期的镜头设计,已有当前有效结果会跳过。会调用文字模型并产生费用,不生成图片或视频。"
|
||||
:disabled="
|
||||
!flow.approved.value ||
|
||||
flow.data.value.entry.ready ||
|
||||
locked ||
|
||||
busy ||
|
||||
flow.reading.value
|
||||
"
|
||||
@confirm="generate('direction')"
|
||||
/><ConfirmAction
|
||||
label="补齐或更新画面状态"
|
||||
description="根据正式镜头和最新镜头设计处理整个项目的画面状态,已有当前有效结果会跳过。会调用文字模型并可能进行最多两次修复,可能产生费用。"
|
||||
:disabled="
|
||||
!flow.approved.value ||
|
||||
flow.data.value.entry.ready ||
|
||||
locked ||
|
||||
busy ||
|
||||
flow.reading.value ||
|
||||
flow.data.value.entry.derivedAssets.directionCount !==
|
||||
flow.data.value.entry.derivedAssets.shotCount
|
||||
"
|
||||
@confirm="generate('visual')"
|
||||
<template v-if="hasFormalShots">
|
||||
<!-- 以下是旧分镜缺少规则记录时的明确重新核对,不重跑拆解 -->
|
||||
<section v-if="!flow.data.value.quality.provenance.qualityPolicyConsistent" class="space-y-4">
|
||||
<WorkspaceSectionHeading
|
||||
title="核对旧分镜采用的规则"
|
||||
description="旧分镜没有完整规则记录时,由复核人明确采用当前已确认规则重新检查。不会重写历史记录,也不会重新拆解。"
|
||||
/>
|
||||
</div>
|
||||
<p class="text-sm" :class="flow.data.value.entry.ready ? 'text-muted' : 'text-danger'">
|
||||
{{
|
||||
flow.data.value.entry.ready
|
||||
? '正式分镜已满足制作入口条件。制作计划还会继续检查主体素材和镜头资产。'
|
||||
: userFacingText(flow.data.value.entry.reason, '制作入口尚未满足条件。')
|
||||
}}
|
||||
</p>
|
||||
</section>
|
||||
<p v-for="reason in flow.data.value.baseline.reasons" :key="reason" class="text-sm text-muted">
|
||||
{{ userFacingText(reason) }}
|
||||
</p>
|
||||
<template v-if="flow.baselineAllowed.value"
|
||||
><NFormItem label="复核人"
|
||||
><NInput
|
||||
aria-label="来源复核人"
|
||||
v-model:value="reviewer"
|
||||
placeholder="填写实际复核人" /></NFormItem
|
||||
><NFormItem label="核对说明"
|
||||
><NInput
|
||||
aria-label="来源核对说明"
|
||||
v-model:value="reviewNote"
|
||||
type="textarea"
|
||||
placeholder="说明核对范围及采用当前规则的依据" /></NFormItem
|
||||
><NCheckbox v-model:checked="baselineAcknowledged" :disabled="locked || busy"
|
||||
>我已核对旧分镜,明确采用当前规则继续复检</NCheckbox
|
||||
><NButton
|
||||
type="primary"
|
||||
:disabled="!baselineAcknowledged || locked || busy || flow.reading.value"
|
||||
@click="confirmReview('baseline')"
|
||||
>确认规则来源</NButton
|
||||
></template
|
||||
>
|
||||
</section>
|
||||
<!-- 以下是正式主体、动作及来源问题,局部修订独立确认 -->
|
||||
<section class="space-y-4">
|
||||
<WorkspaceSectionHeading
|
||||
title="处理正式分镜问题"
|
||||
description="只修订明确的问题镜头。涉及规则来源或现有素材保护时,先处理对应限制。"
|
||||
/>
|
||||
<p v-if="!flow.issues.value.length" class="text-sm text-muted">
|
||||
当前未返回具体镜头问题,请继续核对上面的来源条件和人工审核。
|
||||
</p>
|
||||
<article
|
||||
v-for="(item, index) in flow.issues.value"
|
||||
:key="`${item.kind}-${index}`"
|
||||
class="problem-surface p-4 space-y-3"
|
||||
>
|
||||
<p class="text-xs text-muted">
|
||||
第 {{ item.episodeNo }} 集 · 剧情段落 {{ item.beatNo }} · 镜头
|
||||
{{ item.shotNo ?? '待核对' }}
|
||||
</p>
|
||||
<p class="text-sm leading-6">{{ userFacingText(item.message) }}</p>
|
||||
<NButton
|
||||
class="workspace-action-button"
|
||||
v-if="item.kind !== 'source' && item.shotNo"
|
||||
:disabled="locked || busy || flow.reading.value"
|
||||
@click="repairIssue = item"
|
||||
><template #icon><Wrench :size="15" /></template>查看并修订</NButton
|
||||
>
|
||||
</article>
|
||||
</section>
|
||||
<!-- 以下是正式整体人工审核,不以只读预检或旧记录代替 -->
|
||||
<section class="space-y-4">
|
||||
<WorkspaceSectionHeading
|
||||
title="人工确认整体分镜"
|
||||
description="检查通过后,由复核人核对动作、主体及镜头衔接。规则或镜头变化后原审核会失效。"
|
||||
/>
|
||||
<p v-if="flow.approved.value" class="text-sm text-muted">当前正式分镜已有有效审核记录。</p>
|
||||
<p v-else-if="!flow.reviewable.value" class="text-sm text-muted">
|
||||
请先处理规则来源、动作与主体问题,再进行整体审核。
|
||||
</p>
|
||||
<template v-else
|
||||
><NFormItem label="审核人"
|
||||
><NInput
|
||||
aria-label="整体审核人"
|
||||
v-model:value="reviewer"
|
||||
placeholder="填写实际审核人" /></NFormItem
|
||||
><NFormItem label="审核说明"
|
||||
><NInput
|
||||
aria-label="整体审核说明"
|
||||
v-model:value="reviewNote"
|
||||
type="textarea"
|
||||
placeholder="说明已核对的动作、主体、画面衔接及结论" /></NFormItem
|
||||
><NCheckbox v-model:checked="reviewAcknowledged" :disabled="locked || busy"
|
||||
>我已人工核对当前版本的全部正式分镜</NCheckbox
|
||||
><NButton
|
||||
type="primary"
|
||||
:disabled="!reviewAcknowledged || locked || busy || flow.reading.value"
|
||||
@click="confirmReview('approval')"
|
||||
><template #icon><CheckCheck :size="15" /></template>确认整体审核</NButton
|
||||
></template
|
||||
>
|
||||
</section>
|
||||
<!-- 以下是审核之后的设计补齐与真实生产入口状态 -->
|
||||
<section class="space-y-4">
|
||||
<WorkspaceSectionHeading
|
||||
title="补齐镜头设计与画面状态"
|
||||
description="先更新镜头设计,再更新画面状态。只补齐缺失或过期结果,生成可能产生模型费用。"
|
||||
/>
|
||||
<p class="text-sm text-muted">
|
||||
已保存镜头设计 {{ flow.data.value.entry.derivedAssets.directionCount }} /
|
||||
{{ flow.data.value.entry.derivedAssets.shotCount }} · 画面状态
|
||||
{{ flow.data.value.entry.derivedAssets.visualStateCount }} /
|
||||
{{ flow.data.value.entry.derivedAssets.shotCount }}
|
||||
</p>
|
||||
<div class="flex flex-wrap gap-3">
|
||||
<ConfirmAction
|
||||
label="补齐或更新镜头设计"
|
||||
description="处理整个项目中缺失或过期的镜头设计,已有当前有效结果会跳过。会调用文字模型并产生费用,不生成图片或视频。"
|
||||
:disabled="
|
||||
!flow.approved.value ||
|
||||
flow.data.value.entry.ready ||
|
||||
locked ||
|
||||
busy ||
|
||||
flow.reading.value
|
||||
"
|
||||
@confirm="generate('direction')"
|
||||
/><ConfirmAction
|
||||
label="补齐或更新画面状态"
|
||||
description="根据正式镜头和最新镜头设计处理整个项目的画面状态,已有当前有效结果会跳过。会调用文字模型并可能进行最多两次修复,可能产生费用。"
|
||||
:disabled="
|
||||
!flow.approved.value ||
|
||||
flow.data.value.entry.ready ||
|
||||
locked ||
|
||||
busy ||
|
||||
flow.reading.value ||
|
||||
flow.data.value.entry.derivedAssets.directionCount !==
|
||||
flow.data.value.entry.derivedAssets.shotCount
|
||||
"
|
||||
@confirm="generate('visual')"
|
||||
/>
|
||||
</div>
|
||||
<p class="text-sm" :class="flow.data.value.entry.ready ? 'text-muted' : 'text-danger'">
|
||||
{{
|
||||
flow.data.value.entry.ready
|
||||
? '正式分镜已满足制作入口条件。制作计划还会继续检查主体素材和镜头资产。'
|
||||
: userFacingText(flow.data.value.entry.reason, '制作入口尚未满足条件。')
|
||||
}}
|
||||
</p>
|
||||
</section>
|
||||
</template>
|
||||
<EmptyState
|
||||
v-else
|
||||
title="尚无正式分镜"
|
||||
description="请先在剧本拆解中生成并提交分镜,再回来检查问题和整体审核;这些检查不作为首次拆解的前置条件。"
|
||||
/>
|
||||
</template>
|
||||
<!-- 以下是服务持久化的派生任务,关闭抽屉后仍可观察 -->
|
||||
<WorkflowExecutionPanel
|
||||
@@ -471,20 +501,39 @@ async function repaired() {
|
||||
@dismiss="visualTask.dismiss()"
|
||||
/>
|
||||
</div>
|
||||
<template #footer
|
||||
><NButton :disabled="busy" @click="open = false">关闭</NButton
|
||||
><template v-if="repairIssue"
|
||||
><NButton :disabled="busy" @click="repairIssue = null"
|
||||
><template #icon><ArrowLeft :size="15" /></template>返回检查</NButton
|
||||
><NButton
|
||||
type="primary"
|
||||
:loading="repairWriting"
|
||||
:disabled="!repairEditor?.canSave || busy || locked"
|
||||
@click="repairEditor?.save()"
|
||||
><template #icon><Save :size="15" /></template>保存本次修订</NButton
|
||||
></template
|
||||
></template
|
||||
>
|
||||
<template #footer>
|
||||
<div class="flex w-full flex-wrap items-center justify-between gap-4">
|
||||
<NCheckbox
|
||||
v-if="!repairIssue && flow.data.value && !flow.policyConfirmed.value"
|
||||
v-model:checked="policyAcknowledged"
|
||||
class="min-w-0 flex-[1_1_360px]"
|
||||
:disabled="locked || busy || flow.reading.value"
|
||||
>我已核对当前已保存的项目质量规则。</NCheckbox
|
||||
>
|
||||
<div class="ml-auto flex flex-wrap items-center justify-end gap-2">
|
||||
<NButton :disabled="busy" @click="open = false">关闭</NButton>
|
||||
<NButton
|
||||
v-if="!repairIssue && flow.data.value && !flow.policyConfirmed.value"
|
||||
type="primary"
|
||||
:disabled="!policyAcknowledged || locked || busy || flow.reading.value"
|
||||
:loading="actionWriting"
|
||||
@click="confirmPolicy"
|
||||
>确认项目质量规则</NButton
|
||||
>
|
||||
<template v-if="repairIssue"
|
||||
><NButton :disabled="busy" @click="repairIssue = null"
|
||||
><template #icon><ArrowLeft :size="15" /></template>返回检查</NButton
|
||||
><NButton
|
||||
type="primary"
|
||||
:loading="repairWriting"
|
||||
:disabled="!repairEditor?.canSave || busy || locked"
|
||||
@click="repairEditor?.save()"
|
||||
><template #icon><Save :size="15" /></template>保存本次修订</NButton
|
||||
></template
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</AppDrawer>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { policyReceipt } from '../../fixtures/quality-policy'
|
||||
import { computed, ref } from 'vue'
|
||||
import { DOMWrapper, flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { NSelect, NSpin } from 'naive-ui'
|
||||
import { NButton, NSelect, NSpin } from 'naive-ui'
|
||||
import { readFileSync } from 'node:fs'
|
||||
import BreakdownPage from '@/features/breakdown/BreakdownPage.vue'
|
||||
import { projectContextKey, type useProjectData } from '@/features/projects/context'
|
||||
@@ -27,6 +27,32 @@ import { getOperation } from '@/features/workflows/operations'
|
||||
|
||||
let wrapper: VueWrapper | undefined
|
||||
|
||||
it('没有拆解数据时提供居中的主设置入口,只打开现有抽屉,不预览或生成', async () => {
|
||||
const preview = vi.spyOn(breakdownApi, 'preview')
|
||||
const run = vi.spyOn(breakdownApi, 'run')
|
||||
mountPage([])
|
||||
await flushPromises()
|
||||
const empty = wrapper!.find('.breakdown-initial-empty')
|
||||
expect(empty.exists()).toBe(true)
|
||||
expect(wrapper!.get('.workspace-heading-scroll').isVisible()).toBe(false)
|
||||
expect(wrapper!.find('.result-toolbar').exists()).toBe(false)
|
||||
const entry = empty.get('button[aria-label="拆解设置"]')
|
||||
expect(
|
||||
wrapper!
|
||||
.findAllComponents(NButton)
|
||||
.find(button => button.element === entry.element)!
|
||||
.props('type')
|
||||
).toBe('primary')
|
||||
await entry.trigger('click')
|
||||
await flushPromises()
|
||||
expect(document.querySelectorAll('.app-drawer')).toHaveLength(1)
|
||||
expect(drawerPanel().isVisible()).toBe(true)
|
||||
expect(wrapper!.get('[data-workspace-tools]').attributes('aria-expanded')).toBe('true')
|
||||
expect(drawerPanel().text()).toContain('拆解设置')
|
||||
expect(preview).not.toHaveBeenCalled()
|
||||
expect(run).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('首次点击生成先读取并确认质量规则,不直接打开模型启动确认', async () => {
|
||||
const readPolicy = vi.spyOn(projectsApi, 'qualityPolicy').mockResolvedValue(
|
||||
policyReceipt('breakdown-scroll-test', {
|
||||
@@ -233,6 +259,54 @@ afterEach(() => {
|
||||
localStorage.clear()
|
||||
})
|
||||
|
||||
it.each(['pending', 'running'] as const)(
|
||||
'已有 %s 拆解任务但尚无结果时恢复分类空状态,刷新后也不显示首次引导',
|
||||
async status => {
|
||||
mountPage([])
|
||||
const record = {
|
||||
id: `empty-result-${status}`,
|
||||
projectId: 'breakdown-scroll-test',
|
||||
workflowName: 'breakdown',
|
||||
status: status as 'pending' | 'running' | 'completed',
|
||||
stage: 'breakdown',
|
||||
current: 0,
|
||||
total: 0,
|
||||
currentResourceId: null,
|
||||
metadata: {},
|
||||
result: null,
|
||||
error: null,
|
||||
startedAt: '2026-10-28T00:00:00Z',
|
||||
completedAt: null,
|
||||
createdAt: '2026-10-28T00:00:00Z',
|
||||
updatedAt: '2026-10-28T00:01:00Z'
|
||||
}
|
||||
vi.spyOn(workflowExecutionApi, 'get').mockImplementation(async () => ({ ...record }))
|
||||
taskScope = effectScope()
|
||||
const tracker = taskScope.run(() => useWorkflowExecution(ref(record.projectId), 'breakdown'))!
|
||||
await tracker.track(record.id)
|
||||
await flushPromises()
|
||||
try {
|
||||
expect(wrapper!.find('.breakdown-initial-empty').exists()).toBe(false)
|
||||
expect(wrapper!.get('.workspace-heading-scroll').isVisible()).toBe(true)
|
||||
expect(wrapper!.find('.result-toolbar').exists()).toBe(true)
|
||||
expect(wrapper!.text()).toContain('尚无主体结果')
|
||||
await selectTab('分镜')
|
||||
expect(wrapper!.text()).toContain('分镜规划尚未生成')
|
||||
wrapper!.unmount()
|
||||
wrapper = undefined
|
||||
mountPage([])
|
||||
await flushPromises()
|
||||
expect(wrapper!.find('.breakdown-initial-empty').exists()).toBe(false)
|
||||
expect(wrapper!.text()).toContain('尚无主体结果')
|
||||
} finally {
|
||||
record.status = 'completed'
|
||||
record.updatedAt = '2026-10-28T00:02:00Z'
|
||||
await tracker.query.refresh()
|
||||
tracker.dismiss()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
it('后台重新拆解时显示真实运行状态并隐藏所有诊断入口,终态后恢复', async () => {
|
||||
vi.stubGlobal(
|
||||
'fetch',
|
||||
@@ -594,6 +668,12 @@ describe('拆解页内容滚动', () => {
|
||||
expect(list.classes()).toContain('record-list')
|
||||
expect(list.findAll(':scope > article')).toHaveLength(30)
|
||||
const toolbar = wrapper!.get('.subject-list-toolbar')
|
||||
const exportButton = wrapper!.get<HTMLButtonElement>(
|
||||
'.result-toolbar .n-tabs-nav__suffix [aria-label="导出拆解结果"]'
|
||||
)
|
||||
expect(exportButton.element.disabled).toBe(false)
|
||||
expect(exportButton.text()).toBe('')
|
||||
expect(exportButton.get('svg').attributes('width')).toBe('18')
|
||||
expect(toolbar.element.firstElementChild).toBe(toolbar.get('.subject-list-search').element)
|
||||
expect(toolbar.element.lastElementChild).toBe(toolbar.get('.subject-list-count').element)
|
||||
expect(toolbar.get('.n-input__prefix svg').attributes('aria-hidden')).toBe('true')
|
||||
@@ -607,6 +687,7 @@ describe('拆解页内容滚动', () => {
|
||||
await input.setValue('不存在的主体')
|
||||
expect(toolbar.get('[role="status"]').text()).toBe('匹配 0 / 30 个主体')
|
||||
expect(wrapper!.text()).toContain('没有匹配的主体')
|
||||
expect(wrapper!.find('.breakdown-initial-empty').exists()).toBe(false)
|
||||
await input.setValue('')
|
||||
expect(toolbar.get('[role="status"]').text()).toBe('共 30 个主体')
|
||||
expect(wrapper!.findAll('.subject-record-list > article')).toHaveLength(30)
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||
import { NTabs } from 'naive-ui'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import ProjectSettingsDialog from '@/features/generation-config/components/ProjectSettingsDialog.vue'
|
||||
import { projectsApi } from '@/features/projects/api'
|
||||
import { policyReceipt } from '../../fixtures/quality-policy'
|
||||
|
||||
/** 当前全屏配置抽屉。 */
|
||||
let wrapper: VueWrapper | undefined
|
||||
afterEach(() => {
|
||||
wrapper?.unmount()
|
||||
wrapper = undefined
|
||||
document.body.innerHTML = ''
|
||||
})
|
||||
|
||||
describe('配置入口定位到指定分类', () => {
|
||||
it('规则入口直接显示质量规则,关闭后从普通入口重开回到生成配置', async () => {
|
||||
const save = vi.spyOn(projectsApi, 'saveQualityPolicy')
|
||||
const confirm = vi.spyOn(projectsApi, 'confirmQualityPolicy')
|
||||
vi.spyOn(projectsApi, 'qualityPolicy').mockResolvedValue(
|
||||
policyReceipt('settings-quality', {
|
||||
version: 1,
|
||||
physicsMode: 'realistic',
|
||||
allowExaggeratedMotion: false,
|
||||
allowNonPhysicalActions: false,
|
||||
allowSupernaturalAbilities: false,
|
||||
customRules: []
|
||||
})
|
||||
)
|
||||
wrapper = mount(ProjectSettingsDialog, {
|
||||
attachTo: document.body,
|
||||
props: { projectId: 'settings-quality', disabled: false, open: true, initialTab: 'quality' },
|
||||
global: { stubs: { CreativeProfileSettings: true } }
|
||||
})
|
||||
await flushPromises()
|
||||
expect(wrapper.getComponent(NTabs).props('value')).toBe('quality')
|
||||
expect(wrapper.findComponent({ name: 'QualityPolicySettings' }).exists()).toBe(true)
|
||||
expect(save).not.toHaveBeenCalled()
|
||||
expect(confirm).not.toHaveBeenCalled()
|
||||
await wrapper.setProps({ open: false })
|
||||
await wrapper.setProps({ open: true, initialTab: 'generation' })
|
||||
await flushPromises()
|
||||
expect(wrapper.getComponent(NTabs).props('value')).toBe('generation')
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,112 @@
|
||||
import { DOMWrapper, flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import StoryboardPreparation from '@/features/storyboard-preparation/StoryboardPreparation.vue'
|
||||
import AppDrawer from '@/components/ui/AppDrawer.vue'
|
||||
import { preparationApi } from '@/features/storyboard-preparation/api'
|
||||
import { projectsApi } from '@/features/projects/api'
|
||||
import { projectSettingsOpenKey } from '@/features/generation-config/context'
|
||||
import { preparationFixture } from './fixtures'
|
||||
|
||||
/** 当前挂载的检查入口,不连接模型或数据库写入。 */
|
||||
let wrapper: VueWrapper | undefined
|
||||
afterEach(() => {
|
||||
wrapper?.unmount()
|
||||
wrapper = undefined
|
||||
document.body.innerHTML = ''
|
||||
localStorage.clear()
|
||||
})
|
||||
|
||||
/**
|
||||
* 用实际响应结构打开首次拆解前的制作检查。
|
||||
* @param id 隔离项目编号
|
||||
* @returns 已打开抽屉、接口样例及配置入口
|
||||
*/
|
||||
async function openPreparation(id: string) {
|
||||
const data = preparationFixture(id)
|
||||
data.policy.confirmed = false
|
||||
data.policy.confirmedRevision = null
|
||||
data.policy.confirmedAt = null
|
||||
data.quality.coverage.shotCount = 0
|
||||
data.entry.derivedAssets.shotCount = 0
|
||||
vi.spyOn(preparationApi, 'recheck').mockImplementation(async () => structuredClone(data.quality))
|
||||
vi.spyOn(preparationApi, 'approval').mockImplementation(async () => structuredClone(data.approval))
|
||||
vi.spyOn(preparationApi, 'baseline').mockImplementation(async () => structuredClone(data.baseline))
|
||||
vi.spyOn(preparationApi, 'entry').mockImplementation(async () => structuredClone(data.entry))
|
||||
vi.spyOn(projectsApi, 'qualityPolicy').mockImplementation(async () => structuredClone(data.policy))
|
||||
const openSettings = vi.fn<(tab?: string) => void>()
|
||||
wrapper = mount(StoryboardPreparation, {
|
||||
attachTo: document.body,
|
||||
props: { projectId: id },
|
||||
global: { provide: { [projectSettingsOpenKey as symbol]: openSettings } }
|
||||
})
|
||||
await wrapper.get('button[aria-label="制作前检查"]').trigger('click')
|
||||
await flushPromises()
|
||||
return { data, openSettings, drawer: new DOMWrapper(document.querySelector<HTMLElement>('.app-drawer')!) }
|
||||
}
|
||||
|
||||
describe('制作检查与项目配置职责分离', () => {
|
||||
it('尚无正式分镜时说明后续步骤,只读核对规则,不再重复完整编辑表单', async () => {
|
||||
const { drawer } = await openPreparation('preparation-empty-first')
|
||||
expect(drawer.text()).toContain('尚无正式分镜')
|
||||
expect(drawer.find('.quality-policy-settings').exists()).toBe(false)
|
||||
expect(drawer.text()).not.toContain('人工确认整体分镜')
|
||||
expect(drawer.text()).toContain('风格化表现')
|
||||
expect(drawer.text()).toContain('前往项目质量规则')
|
||||
})
|
||||
it('前往质量配置先关闭检查抽屉,离场后才打开同项目的质量规则标签', async () => {
|
||||
const { drawer, openSettings } = await openPreparation('preparation-settings-handoff')
|
||||
const entry = drawer.findAll('button').find(button => button.text() === '前往项目质量规则')
|
||||
expect(entry).toBeDefined()
|
||||
await entry!.trigger('click')
|
||||
expect(wrapper!.getComponent(AppDrawer).props('open')).toBe(false)
|
||||
expect(openSettings).not.toHaveBeenCalled()
|
||||
wrapper!.getComponent(AppDrawer).vm.$emit('closed')
|
||||
await flushPromises()
|
||||
expect(openSettings).toHaveBeenCalledExactlyOnceWith('quality')
|
||||
})
|
||||
it('只读核对后明确确认现有规则,不在检查入口保存另一份草稿', async () => {
|
||||
const { data, drawer } = await openPreparation('preparation-confirm-readonly')
|
||||
const save = vi.spyOn(projectsApi, 'saveQualityPolicy')
|
||||
const confirm = vi.spyOn(projectsApi, 'confirmQualityPolicy').mockImplementation(async () => {
|
||||
data.policy.confirmed = true
|
||||
data.policy.confirmedRevision = data.policy.revision
|
||||
data.policy.confirmedAt = '2026-10-28T09:00:00Z'
|
||||
return structuredClone(data.policy)
|
||||
})
|
||||
const footer = drawer.get('.app-drawer-footer')
|
||||
const button = footer.findAll('button').find(item => item.text() === '确认项目质量规则')
|
||||
expect(button).toBeDefined()
|
||||
expect(button!.attributes('disabled')).toBeDefined()
|
||||
expect(confirm).not.toHaveBeenCalled()
|
||||
await footer.get('[role="checkbox"]').trigger('click')
|
||||
await button!.trigger('click')
|
||||
await flushPromises()
|
||||
expect(save).not.toHaveBeenCalled()
|
||||
expect(confirm).toHaveBeenCalledExactlyOnceWith(data.policy.projectId, data.policy.revision)
|
||||
})
|
||||
it('规则在其他入口变化后不确认旧版本,保留重新核对入口', async () => {
|
||||
const { data, drawer } = await openPreparation('preparation-policy-stale')
|
||||
const confirm = vi.spyOn(projectsApi, 'confirmQualityPolicy')
|
||||
const footer = drawer.get('.app-drawer-footer')
|
||||
const button = footer.findAll('button').find(item => item.text() === '确认项目质量规则')
|
||||
expect(button).toBeDefined()
|
||||
await footer.get('[role="checkbox"]').trigger('click')
|
||||
data.policy.revision++
|
||||
data.policy.fingerprint = 'c'.repeat(64)
|
||||
await button!.trigger('click')
|
||||
await flushPromises()
|
||||
expect(confirm).not.toHaveBeenCalled()
|
||||
expect(drawer.text()).toContain('已变化')
|
||||
})
|
||||
it('检查抽屉关闭期间切换项目,不回填旧项目的配置跳转', async () => {
|
||||
const { drawer, openSettings } = await openPreparation('preparation-old-project')
|
||||
await drawer
|
||||
.findAll('button')
|
||||
.find(button => button.text() === '前往项目质量规则')!
|
||||
.trigger('click')
|
||||
await wrapper!.setProps({ projectId: 'preparation-new-project' })
|
||||
wrapper!.getComponent(AppDrawer).vm.$emit('closed')
|
||||
await flushPromises()
|
||||
expect(openSettings).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
@@ -1396,19 +1396,15 @@ describe('工作台页面交互', () => {
|
||||
expect(fetcher.mock.calls.every(([, init]) => init?.method === 'GET')).toBe(true)
|
||||
})
|
||||
|
||||
it('拆解导出图标位于 Tabs suffix,空快照时禁用且不再提供执行记录', async () => {
|
||||
it('拆解初始空页面隐藏标题、分类和导出,仅保留中央设置引导', async () => {
|
||||
wrapper = mount(BreakdownPage, {
|
||||
attachTo: document.body,
|
||||
global: { provide: { [projectContextKey as symbol]: context() }, stubs: routerLinkStubs }
|
||||
})
|
||||
const toolbar = wrapper.get('.result-toolbar')
|
||||
expect(toolbar.find('[aria-label="拆解结果"]').exists()).toBe(true)
|
||||
expect(toolbar.find(':scope > button').exists()).toBe(false)
|
||||
const exportButton = toolbar.get<HTMLButtonElement>('.n-tabs-nav__suffix [aria-label="导出拆解结果"]')
|
||||
expect(exportButton.element.disabled).toBe(true)
|
||||
expect(exportButton.text()).toBe('')
|
||||
expect(exportButton.get('svg').attributes('width')).toBe('18')
|
||||
expect(toolbar.find('[aria-label="拆解更多操作"]').exists()).toBe(false)
|
||||
expect(wrapper.get('.workspace-heading-scroll').isVisible()).toBe(false)
|
||||
expect(wrapper.find('.result-toolbar').exists()).toBe(false)
|
||||
expect(wrapper.find('[aria-label="导出拆解结果"]').exists()).toBe(false)
|
||||
expect(wrapper.get('.breakdown-initial-empty').text()).toContain('拆解设置')
|
||||
expect(wrapper.find('.history-panel').exists()).toBe(false)
|
||||
expect(wrapper.text()).not.toContain('执行记录')
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user