fix(short-drama-agent-front): 统一全屏布局与问题处理交互
This commit is contained in:
1 parent
db91a4b871
commit
cc27d463e0
25 files changed
+838
-316
No files matched your search
@@ -13,7 +13,82 @@
|
||||
|
||||
- 尽量使用中文沟通,沿用项目现有的 Vue 3、TypeScript、Tailwind CSS 和 pnpm 约定。
|
||||
- 新增或修改的函数、类型、响应式状态及页面模块需要中文注释;函数有参数或返回值时补充 `@param`、`@returns`。
|
||||
- 无参数、无返回值的函数使用 `/** 描述 */`;类型及其字段分别注释,`ref`、`computed`、`defineProps`、`defineEmits` 等也要说明用途;Vue 模板中的功能模块之间换行并添加中文模块注释。
|
||||
- 超过两个位置使用的相同功能或组件,应抽成公共方法或组件。
|
||||
- 页面和交互验证使用本地 Chrome,地址使用 `localhost`,禁止使用 Playwright;已有对应测试标签页时复用它。
|
||||
- 以真实接口和后端契约为准,不用占位数据或其他功能代替缺失能力。
|
||||
- 根据后端新增或重构前端功能前,先核对真实路由、请求参数、返回结果、服务逻辑和接口文档;不能只补类型而遗漏页面流程。缺少契约且无法确认时明确说明,不猜测或用其他功能代替。
|
||||
- 提交代码时遵循项目的 Conventional Commits 规范,使用中文描述;提交前先检查实际差异。
|
||||
|
||||
## 全局页面与交互规范
|
||||
|
||||
以下规则是用户长期确认的项目要求,适用于后续所有新增、修改和重构的页面、弹窗及抽屉。换窗口后也应直接沿用,不等待用户再次指出同类问题。
|
||||
|
||||
### 整体协调与公共实现
|
||||
|
||||
- 修改前先查看所在完整页面、相邻模块及已有公共组件,同时考虑整体协调、元素间距和功能一致性,不能只修改截图中的一个局部而忽略其他状态。
|
||||
- 同类布局、按钮、状态色、关闭入口和交互流程保持一致;发现本次改动涉及的同类问题时,一并修正相关公共组件或当前功能中的使用位置。
|
||||
- 优先复用 `src/components/ui` 中的公共组件、`src/styles/admin.css` 中的设计变量和现有主题配置;公共问题在公共层解决,避免各页面重复覆盖或硬编码颜色、尺寸。
|
||||
- 维持项目现有简洁、扁平的视觉风格。用标题、简短说明、留白和对齐区分普通功能区域,避免无意义的底色、边框和装饰线。
|
||||
- 页面文案保持精简,说明应帮助用户理解当前操作;不把大量错误、技术细节和重复提示堆在设置页面。
|
||||
|
||||
### 全屏抽屉与关闭入口
|
||||
|
||||
- 新建剧本、项目全局配置、拆解设置、拆解问题等已确认使用全屏的界面统一复用 `AppDrawer`。后续同类复杂表单、设置和问题处理界面默认沿用全屏抽屉;简短确认或轻量提示仍可使用 `AppDialog`。
|
||||
- 全屏必须同时覆盖容器与正文:内容使用可用的完整宽度,不能只把外壳放大而保留原弹窗的固定宽度或居中最大宽度。
|
||||
- 标题区和底部操作区固定,只有正文独立滚动。长内容不能把关闭或提交按钮挤出视口,也不能产生页面与抽屉重复滚动。
|
||||
- 抽屉标题、说明、正文和底栏左右边界统一。复用公共抽屉的桌面、移动端内边距;正文 `padding-top` 保持为 `0`,不要额外叠加顶部空白。
|
||||
- 所有弹窗和抽屉底部至少保留一个可见的“关闭”或“取消”按钮,不能只有右上角叉号。底部操作使用公共组件的 `footer` 插槽,避免正文末尾再放一套底栏或重复关闭按钮。
|
||||
- 关闭、取消统一为灰色底面和中性文字的普通按钮,不使用绿色主按钮;右上角关闭图标的尺寸、底色与交互反馈也统一复用公共样式。
|
||||
- 提交期间按真实业务状态防止重复操作及意外关闭;普通只读加载不能无故阻止用户关闭。关闭、切换或定位后,不回填已失效的异步结果。
|
||||
|
||||
### 布局、说明与间距
|
||||
|
||||
- 页面外边距、模块间距优先复用 `--app-content-padding`、`--app-content-gap`;表单与抽屉内部复用对应公共组件的间距,不在各页面随意添加不同数值。
|
||||
- 同级模块使用一致的标题、说明、字段间距和上下留白。需要说明时采用“模块标题 + 一句简短说明”,例如画布设置、图片配置、视频配置、动作与物理规则;优先复用 `WorkspaceSectionHeading`。
|
||||
- 新建剧本等长表单默认每个字段单独占一行并铺满内容宽度;不因改成全屏就自动把原来的字段挤成两列。
|
||||
- 图片、视频等已有明确分组的并列模块可以保留协调的分栏,窄屏改为单列;同一行的标签、控件及操作必须分别对齐,不能因说明或校验消息出现而上下错位。
|
||||
- 行内按钮按输入控件本身的基线对齐,不能按包含标签的整块区域垂直居中。动态例外行中的移除按钮与输入框底部对齐,使用 `Trash2` 等现有图标,不再显示“移除”文字,并提供可访问名称。
|
||||
- 项目生成配置等普通表单分区不铺大块背景色,使用标题、说明和统一间距组织;错误、成功等有明确状态含义的提示区域才使用对应柔和底色。
|
||||
|
||||
### 按钮、图标与状态颜色
|
||||
|
||||
- 绿色背景、白色文字用于保存、提交、开始生成等主要执行操作;关闭、取消和普通辅助操作使用中性样式。
|
||||
- 错误、校验未通过、需要修复的区域使用柔和浅红背景,深色主题使用对应柔和深红底面。禁止使用上下两条绿色横线表示错误或待修复状态,也不能借用绿色选中态来标记错误。
|
||||
- 错误入口按钮的文字、图标和焦点提示与红色底面保持一致;默认、悬停、按下、聚焦各状态都不能被主题主色覆盖成绿色。保留清晰的键盘焦点提示。
|
||||
- 只有执行完成且结果明确通过校验时,成功任务区域才使用柔和浅绿背景。执行结束但校验失败、质量待审或结果未确认时,不能显示成绿色成功状态,也不能用满格绿色进度条暗示业务成功。
|
||||
- 工具栏中相邻按钮保持一致的高度、内边距、图标大小和间距。问题入口使用图标加文字;分镜结构校验失败时文案为“分镜校验未通过”,其他问题按真实类型命名。
|
||||
- 移动端的工具栏操作优先只显示图标,保留完整的 `aria-label`、提示文本和足够点击区域;普通表单的底部关闭、取消、提交按钮仍保留文字。
|
||||
- 页面左侧汇总状态在运行、成功、失败等状态下均有意义,应保留;右侧操作入口负责打开对应处理界面,避免把状态展示和操作混成重复文案。
|
||||
|
||||
### 设置、问题处理与任务进度
|
||||
|
||||
- 拆解设置与问题处理分开:设置界面负责模块选择、分组预览、启动拆解、候选确认与提交;问题界面负责错误查看、分镜定位、人工修订、读取修复清单及阶段恢复。
|
||||
- 不在拆解设置中重复堆放详细错误列表和修复说明;问题按剧集、节拍、镜头分组并去重,保留后端原始问题及可定位位置。
|
||||
- 从问题界面定位正文时,先关闭抽屉,等离场和焦点约束释放后再定位,不能同时叠加两个主界面。
|
||||
- 后端从其他入口启动或重新执行任务时,前端也应发现任务并显示真实运行阶段、进度、作用范围及更新时间;重新进入页面后能够恢复观察,不能只依赖前端本次点击形成的加载状态。
|
||||
- 执行状态与质量校验结果分别表达,不能把“执行完成”直接等同于“校验通过”;没有真实进度或结果时明确显示待确认,不伪造百分比。
|
||||
- 拆解执行中暂不显示“查看诊断”等需要稳定结果的入口。问题可以只读查看,但人工修改、候选提交、修复和恢复操作应遵守真实活动任务锁,避免冲突。
|
||||
- 拆解任务卡片与相邻模块采用统一边距和状态底色,必要的阶段、范围、进度和时间直接简洁展示;不要把重要信息只藏在“任务详情”折叠中,也不默认展示无助于操作的内部编号或原始数据。
|
||||
|
||||
### 表单校验与交互时机
|
||||
|
||||
- 打开表单、加载已有配置或添加一条空白例外时,不立即展示红色校验错误。
|
||||
- 点击保存、提交时再执行完整校验,阻止不完整请求;需要字段交互校验时,只在用户已操作该字段或已尝试提交后显示。
|
||||
- 用户修改相关内容后及时清除或更新旧错误,不能让已经失效的提示长期挂在表单上。
|
||||
- 必填标记、字段提示和错误信息保持统一位置与间距;删除行、增添行和错误出现时,操作按钮仍应与对应控件对齐。
|
||||
|
||||
### 页面验收
|
||||
|
||||
- 涉及页面或交互的改动,必须在已有本地 Chrome 标签页使用 `localhost` 验证后才算完成,不能只根据代码、构建或 DOM 测试声称布局通过。
|
||||
- 验证本次改动涉及的桌面、移动端、长内容滚动、固定底栏及必要的加载、错误、成功状态;检查普通、悬停和键盘聚焦时的颜色、对齐与可访问名称。
|
||||
- 界面验收不得为了制造状态而触发真实付费生成、覆盖正式结果或提交用户数据;使用现有状态、只读操作和合适的自动化测试验证。
|
||||
- 测试与检查按改动范围执行;纯文档变更无需启动页面或重复完整构建。报告时区分自动化检查与真实浏览器验证,并明确未完成项,不把尝试操作当作验收通过。
|
||||
|
||||
## 提交规范补充
|
||||
|
||||
- 仅用户明确要求“提交”时才提交,“提交并 push”才同时授权推送;不因界面修改完成而自动提交或推送。
|
||||
- 提交前必须查看 `git diff --stat` 和 `git diff`,按实际文件与所属包确定提交类型及作用域;不根据用户描述猜测,也不覆盖已有无关改动。
|
||||
- 提交类型仅使用 `feat`、`perf`、`fix`;中文描述用动词开头,简洁明确,提交信息不超过 50 个字符。
|
||||
- 单包修改优先以 `package.json` 的 `name` 作为 scope;多个项目或公共基础设施改动可省略 scope,不用目录名代替包名。
|
||||
- 不使用 `update`、`fix bug`、`修改代码`、`提交代码`、`test`、`wip`、`temp` 等含糊信息。
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { NModal, NScrollbar } from 'naive-ui'
|
||||
import { NButton, NModal, NScrollbar } from 'naive-ui'
|
||||
import { onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||||
|
||||
/** 公共弹窗的标题、说明、操作状态和宽度。 */
|
||||
@@ -113,8 +113,11 @@ onBeforeUnmount(() => {
|
||||
>
|
||||
<div ref="bodyContent" class="flow-root"><slot /></div>
|
||||
</NScrollbar>
|
||||
<template v-if="$slots.footer" #footer>
|
||||
<div class="dialog-footer"><slot name="footer" /></div>
|
||||
<!-- 以下是固定操作底栏,未自定义操作时仍保留关闭入口 -->
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<slot name="footer"><NButton type="default" :disabled="busy" @click="open = false">关闭</NButton></slot>
|
||||
</div>
|
||||
</template>
|
||||
</NModal>
|
||||
</template>
|
||||
@@ -172,11 +175,6 @@ onBeforeUnmount(() => {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
/* 没有按钮底栏时,正文保留与左右内边距一致的底部留白。 */
|
||||
.app-dialog.n-card:not(:has(> .n-card__footer)) > .n-card-content {
|
||||
padding-bottom: var(--n-padding-left);
|
||||
}
|
||||
|
||||
.app-dialog.n-card > .n-card__footer {
|
||||
padding-top: var(--n-padding-left);
|
||||
padding-bottom: var(--n-padding-left);
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton, NDrawer, NDrawerContent } from 'naive-ui'
|
||||
|
||||
/** 全屏抽屉共用标题、说明和保存期间的关闭锁定。 */
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
/** 抽屉标题,同时作为可访问名称。 */
|
||||
title: string
|
||||
/** 标题下的说明,可使用同名插槽覆盖。 */
|
||||
description?: string
|
||||
/** 提交期间禁止关闭抽屉。 */
|
||||
busy?: boolean
|
||||
}>(),
|
||||
{ description: '', busy: false }
|
||||
)
|
||||
/** 全屏抽屉显隐状态,由调用方保留业务草稿。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 关闭动画结束后通知调用方,便于交接焦点。 */
|
||||
const emit = defineEmits<{ closed: [] }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是从右侧展开、内容同步铺满视口的公共全屏抽屉模块 -->
|
||||
<NDrawer
|
||||
v-model:show="open"
|
||||
placement="right"
|
||||
width="100vw"
|
||||
:auto-focus="false"
|
||||
:mask-closable="!busy"
|
||||
:close-on-esc="!busy"
|
||||
class="app-drawer"
|
||||
:aria-label="title"
|
||||
@after-leave="emit('closed')"
|
||||
>
|
||||
<NDrawerContent :closable="!busy" :native-scrollbar="false">
|
||||
<!-- 以下是固定标题与说明模块,与正文共用左右边界 -->
|
||||
<template #header>
|
||||
<div class="app-drawer-heading">
|
||||
<div class="text-lg font-semibold">{{ title }}</div>
|
||||
<div v-if="description || $slots.description" class="mt-2 text-sm font-normal leading-6 text-muted">
|
||||
<slot name="description">{{ description }}</slot>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 以下是独立滚动的正文模块 -->
|
||||
<slot />
|
||||
<!-- 以下是固定底部操作模块,未自定义底栏时默认显示关闭按钮 -->
|
||||
<template #footer>
|
||||
<div class="app-drawer-footer">
|
||||
<slot name="footer"
|
||||
><NButton type="default" :disabled="busy" @click="open = false">关闭</NButton></slot
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</NDrawerContent>
|
||||
</NDrawer>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
/* 全屏抽屉沿用项目表面和输入底色,不对正文设置最大宽度。 */
|
||||
.app-drawer.n-drawer {
|
||||
--app-field: var(--app-control);
|
||||
--app-field-hover: var(--app-control-hover);
|
||||
max-width: 100vw;
|
||||
background: var(--app-surface);
|
||||
}
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-header {
|
||||
position: relative;
|
||||
padding: 24px;
|
||||
}
|
||||
/* 关闭入口独立定位,避免占据标题列后造成正文边界错位。 */
|
||||
.app-drawer .n-drawer-header__close {
|
||||
position: absolute;
|
||||
top: 24px;
|
||||
right: 24px;
|
||||
}
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-header__main {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
.app-drawer-heading {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
padding-right: 40px;
|
||||
}
|
||||
/* 正文顶部不再叠加留白,保留左右边界和滚动到底部时的间距。 */
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-body-content-wrapper {
|
||||
padding: 0 24px 32px;
|
||||
}
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-footer {
|
||||
display: block;
|
||||
padding: 20px 24px max(20px, env(safe-area-inset-bottom));
|
||||
}
|
||||
.app-drawer-footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 窄屏缩小外层留白,正文布局由各业务表单控制。 */
|
||||
@media (max-width: 639px) {
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-header {
|
||||
padding: 20px 16px;
|
||||
}
|
||||
.app-drawer .n-drawer-header__close {
|
||||
top: 20px;
|
||||
right: 16px;
|
||||
}
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-body-content-wrapper {
|
||||
padding: 0 16px 24px;
|
||||
}
|
||||
.app-drawer.n-drawer .n-drawer-content .n-drawer-footer {
|
||||
padding-inline: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -7,10 +7,11 @@ defineProps<{ title: string; description: string }>()
|
||||
<template>
|
||||
<NEmpty class="empty-state" :description="title">
|
||||
<template #icon><FileText :size="30" :stroke-width="1.4" /></template>
|
||||
<template #extra
|
||||
><p class="max-w-md text-sm leading-6 text-muted">{{ description }}</p>
|
||||
<div class="mt-5"><slot /></div
|
||||
></template>
|
||||
<template #extra>
|
||||
<p class="max-w-md text-sm leading-6 text-muted">{{ description }}</p>
|
||||
<!-- 以下是统一居中、换行和间距的空态操作模块,加载图标不再影响按钮基线 -->
|
||||
<div class="empty-state-actions mt-5 flex flex-wrap items-center justify-center gap-3"><slot /></div>
|
||||
</template>
|
||||
</NEmpty>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { NButton } from 'naive-ui'
|
||||
import AppDialog from './AppDialog.vue'
|
||||
import AppDrawer from './AppDrawer.vue'
|
||||
import { LoaderCircle, Settings2 } from '@lucide/vue'
|
||||
|
||||
/** 批量设置与回执属于临时操作,统一使用大尺寸弹窗;完整制作流程继续保留独立页面。 */
|
||||
/** 工作区设置与回执按需使用宽弹窗或全屏抽屉,正文与任务状态仍由工作区持有。 */
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
/** 设置容器的标题。 */
|
||||
title: string
|
||||
/** 工作区中的入口文案。 */
|
||||
label?: string
|
||||
/** 是否提示存在任务回执。 */
|
||||
hasReceipt?: boolean
|
||||
/** 是否由调用方提供入口。 */
|
||||
triggerless?: boolean
|
||||
/** 使用内容铺满视口的全屏抽屉。 */
|
||||
fullscreen?: boolean
|
||||
/** 当前工作区存在运行中的请求或持久化任务。 */
|
||||
pending?: boolean
|
||||
/** 在操作入口原位置展示真实任务名称。 */
|
||||
@@ -17,11 +24,13 @@ withDefaults(
|
||||
}>(),
|
||||
{
|
||||
label: '操作与回执',
|
||||
triggerless: false
|
||||
triggerless: false,
|
||||
fullscreen: false
|
||||
}
|
||||
)
|
||||
/** 工具区容器显隐状态,关闭时保留调用方的配置草稿。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 工具弹窗完全关闭后通知调用方,便于切换独立的问题弹窗。 */
|
||||
/** 工具容器完全关闭后通知调用方,便于切换独立的问题弹窗。 */
|
||||
const emit = defineEmits<{ closed: [] }>()
|
||||
</script>
|
||||
|
||||
@@ -43,9 +52,17 @@ const emit = defineEmits<{ closed: [] }>()
|
||||
<span class="workspace-tools-label">{{ pending ? pendingLabel || '任务执行中' : label }}</span
|
||||
><span v-if="hasReceipt" class="workspace-tools-receipt text-xs text-muted"> · 有回执</span>
|
||||
</NButton>
|
||||
<AppDialog v-model:open="open" :title="title" description="" wide @closed="emit('closed')">
|
||||
<!-- 以下是按工作区要求切换的工具容器模块,共用关闭后的交接事件 -->
|
||||
<component
|
||||
:is="fullscreen ? AppDrawer : AppDialog"
|
||||
v-model:open="open"
|
||||
:title="title"
|
||||
description=""
|
||||
v-bind="fullscreen ? {} : { wide: true }"
|
||||
@closed="emit('closed')"
|
||||
>
|
||||
<div class="workspace-tools-body"><slot /></div>
|
||||
</AppDialog>
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** 公共 UI 的统一导出入口。 */
|
||||
export { default as FieldLabel } from './FieldLabel.vue'
|
||||
export { default as AppDialog } from './AppDialog.vue'
|
||||
export { default as AppDrawer } from './AppDrawer.vue'
|
||||
export { default as EmptyState } from './EmptyState.vue'
|
||||
export { default as StatusBadge } from './StatusBadge.vue'
|
||||
export { default as StudioLogo } from './StudioLogo.vue'
|
||||
|
||||
@@ -7,7 +7,7 @@ import WorkspaceExportButton from '../../components/ui/WorkspaceExportButton.vue
|
||||
import { NScrollbar, NButton, NCheckbox, NInputNumber, NTab, NTable, NTabs } from 'naive-ui'
|
||||
import { computed, h, nextTick, onScopeDispose, ref, watch } from 'vue'
|
||||
import { useActionMessage } from '../../components/ui/useActionMessage'
|
||||
import { Layers, LoaderCircle, Settings2 } from '@lucide/vue'
|
||||
import { CircleAlert, Layers, LoaderCircle, Settings2 } from '@lucide/vue'
|
||||
import { EmptyState, StatusBadge, WorkspaceTools } from '../../components/ui'
|
||||
import { useProjectContext } from '../projects/context'
|
||||
import { breakdownApi } from './api'
|
||||
@@ -37,10 +37,21 @@ const previewBusy = ref(false)
|
||||
const candidateOnly = ref(true)
|
||||
const tab = ref('character')
|
||||
const toolsOpen = ref(false)
|
||||
/** 错误详情使用独立弹窗,不在设置区展开长文本。 */
|
||||
/** 问题查看、人工修订和阶段恢复共用独立窗口。 */
|
||||
const issuesOpen = ref(false)
|
||||
/** 从设置切换时等待关闭动画结束,避免两层弹窗同时显示。 */
|
||||
const pendingIssues = ref(false)
|
||||
/** 问题入口统一使用红色文字、图标和柔和底色,交互时保持错误语义。 */
|
||||
const issueButtonTheme = {
|
||||
color: 'var(--app-danger-soft)',
|
||||
colorHover: 'color-mix(in srgb, var(--app-danger-soft), var(--app-danger) 8%)',
|
||||
colorPressed: 'color-mix(in srgb, var(--app-danger-soft), var(--app-danger) 14%)',
|
||||
colorFocus: 'var(--app-danger-soft)',
|
||||
textColor: 'var(--app-danger)',
|
||||
textColorHover: 'var(--app-danger)',
|
||||
textColorPressed: 'var(--app-danger)',
|
||||
textColorFocus: 'var(--app-danger)'
|
||||
}
|
||||
const moduleOptions: { value: BreakdownModule; label: string; description: string }[] = [
|
||||
{ value: 'character', label: '人物', description: '人物身份、外观与形态' },
|
||||
{ value: 'scene', label: '场景', description: '故事空间与环境特征' },
|
||||
@@ -177,8 +188,36 @@ watch(
|
||||
void Promise.all([refresh(), refreshStageReadiness()])
|
||||
}
|
||||
)
|
||||
/** 结构校验通过后仍可能存在服务端明确标记的质量待审剧集。 */
|
||||
const pendingQuality = computed(() => !!latestCheckpoint.value?.state.storyboardPendingQualityEpisodeNos?.length)
|
||||
/** 只在已有拆解结果且任务中断或校验待处理时提供阶段恢复。 */
|
||||
const showRecovery = computed(
|
||||
() => records.value.length > 0 && (execution.value?.status !== 'completed' || validation.value?.valid === false)
|
||||
() =>
|
||||
records.value.length > 0 &&
|
||||
(execution.value?.status !== 'completed' || validation.value?.valid === false || pendingQuality.value)
|
||||
)
|
||||
/** 问题入口兼顾执行异常、结构错误、质量待审和已停止的恢复任务。 */
|
||||
const hasBreakdownIssues = computed(() =>
|
||||
Boolean(
|
||||
execution.value?.errorMessage ||
|
||||
validation.value?.valid === false ||
|
||||
pendingQuality.value ||
|
||||
(showRecovery.value && taskStopped.value)
|
||||
)
|
||||
)
|
||||
/** 问题按钮按真实问题类型展示,不把质量待审或执行异常误称为结构校验失败。 */
|
||||
const issueEntryLabel = computed(() =>
|
||||
validation.value?.valid === false ? '分镜校验未通过' : pendingQuality.value ? '分镜质量待修订' : '拆解问题待处理'
|
||||
)
|
||||
/** 所有问题修改和恢复共用活动锁及后台状态读取限制,查看问题不受影响。 */
|
||||
const issueActionsDisabled = computed(
|
||||
() =>
|
||||
project.value?.status !== 'completed' ||
|
||||
!!error.value ||
|
||||
operation.value.pending ||
|
||||
breakdownBusy.value ||
|
||||
backgroundExecution.discovering.value ||
|
||||
!!backgroundExecution.discoveryError.value
|
||||
)
|
||||
const configValid = computed(
|
||||
() => Number.isSafeInteger(groupSize.value) && groupSize.value > 0 && modules.value.length > 0
|
||||
@@ -191,7 +230,7 @@ const input = computed<BreakdownInput>(() => ({
|
||||
}))
|
||||
/** 后端就绪状态用于拆解完成反馈。 */
|
||||
const stageComplete = computed(() => stageReadiness.value?.breakdown.ready === true)
|
||||
/** 拆解提示复用全局 NMessage,详细问题留在设置弹窗。 */
|
||||
/** 拆解提示复用全局 NMessage,详细问题与修订操作放在独立问题窗口。 */
|
||||
const actionMessage = useActionMessage()
|
||||
/** 问题内容变化才通知,轮询取得相同快照时不会重复弹出。 */
|
||||
const issueSignature = computed(() =>
|
||||
@@ -319,7 +358,7 @@ async function run(action: BreakdownAction) {
|
||||
await backgroundExecution.track(started.executionId)
|
||||
return started
|
||||
},
|
||||
{ type: 'info', content: '拆解任务已提交,可在“拆解设置与恢复”中查看进度。' }
|
||||
{ type: 'info', content: '拆解任务已提交,可在“拆解设置”中查看进度。' }
|
||||
)
|
||||
await refresh()
|
||||
}
|
||||
@@ -387,22 +426,29 @@ const rules = {
|
||||
><LoaderCircle :size="13" class="animate-spin" />最近阶段:{{ runningStage }}</span
|
||||
>
|
||||
</div>
|
||||
<!-- 以下是轻量状态入口,详细问题与恢复操作统一放入弹窗;阶段切换使用侧栏 -->
|
||||
<!-- 以下是独立的拆解入口与问题处理入口,避免混合生成和修订流程 -->
|
||||
<div v-if="project?.episodes.length" class="toolbar-actions">
|
||||
<NButton
|
||||
v-if="execution?.errorMessage || validation?.valid === false"
|
||||
text
|
||||
type="error"
|
||||
v-if="hasBreakdownIssues"
|
||||
class="breakdown-issues-trigger breakdown-desktop-issues"
|
||||
:theme-overrides="issueButtonTheme"
|
||||
:aria-label="issueEntryLabel"
|
||||
:title="issueEntryLabel"
|
||||
aria-haspopup="dialog"
|
||||
:aria-expanded="issuesOpen"
|
||||
@click="openIssues"
|
||||
>查看拆解问题</NButton
|
||||
>
|
||||
<template #icon><CircleAlert :size="15" aria-hidden="true" /></template>
|
||||
<span class="breakdown-issues-label">{{ issueEntryLabel }}</span>
|
||||
</NButton>
|
||||
|
||||
<WorkspaceTools
|
||||
:pending="operation.pending"
|
||||
:pending-label="operation.label"
|
||||
v-model:open="toolsOpen"
|
||||
title="拆解设置与恢复"
|
||||
label="拆解设置与恢复"
|
||||
title="拆解设置"
|
||||
label="拆解设置"
|
||||
fullscreen
|
||||
@closed="finishOpeningIssues"
|
||||
>
|
||||
<section class="panel workspace-panel breakdown-settings-panel">
|
||||
@@ -547,13 +593,6 @@ const rules = {
|
||||
:disabled="!!error || operation.pending || backgroundExecution.active.value"
|
||||
@refresh="refreshCandidate"
|
||||
/>
|
||||
<StoryboardQualityRepair
|
||||
v-if="toolsOpen && snapshot"
|
||||
:project-id="projectId"
|
||||
:checkpoint="latestCheckpoint"
|
||||
:disabled="!!error || operation.pending || backgroundExecution.active.value"
|
||||
@refresh="refreshCandidate"
|
||||
/>
|
||||
<WorkflowExecutionPanel
|
||||
v-if="backgroundExecution.executionId.value"
|
||||
title="剧本拆解任务"
|
||||
@@ -565,71 +604,6 @@ const rules = {
|
||||
@refresh="backgroundExecution.query.refresh"
|
||||
@dismiss="backgroundExecution.dismiss"
|
||||
/>
|
||||
<!-- 以下是简洁的问题摘要与恢复操作,详细错误只在独立弹窗展示 -->
|
||||
<section v-if="snapshot" class="space-y-4">
|
||||
<div
|
||||
v-if="execution?.errorMessage || validation?.valid === false"
|
||||
class="workspace-panel problem-surface flex flex-wrap items-center justify-between gap-3"
|
||||
>
|
||||
<p class="text-sm">
|
||||
{{ execution?.errorMessage ? '拆解执行异常' : '分镜校验未通过'
|
||||
}}<span v-if="storyboardIssues.length" class="ml-2 text-xs text-muted"
|
||||
>{{ storyboardIssues.length }} 项问题</span
|
||||
>
|
||||
</p>
|
||||
<NButton text @click="openIssues">查看问题</NButton>
|
||||
</div>
|
||||
<div v-if="showRecovery" class="recovery-strip">
|
||||
<div>
|
||||
<p class="text-sm font-medium">从中断处继续</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<ConfirmAction
|
||||
:loading="isOperationRunning(operation, '正在重试失败抽取')"
|
||||
label="重试失败抽取"
|
||||
description="只重试 character / scene / prop 抽取任务中的失败项。不能用于镜头阶段失败。"
|
||||
acknowledgement
|
||||
:disabled="
|
||||
project?.status !== 'completed' ||
|
||||
!recovery.retry ||
|
||||
operation.pending ||
|
||||
backgroundExecution.discovering.value ||
|
||||
!!backgroundExecution.discoveryError.value ||
|
||||
!!error
|
||||
"
|
||||
@confirm="run('retry')"
|
||||
/><ConfirmAction
|
||||
:loading="isOperationRunning(operation, '正在补齐镜头')"
|
||||
label="补齐缺失镜头"
|
||||
description="复用已完成剧集的镜头,仅生成尚未完成的 Episode Shot,再进行校验与入库。"
|
||||
acknowledgement
|
||||
:disabled="
|
||||
project?.status !== 'completed' ||
|
||||
!recovery.shots ||
|
||||
operation.pending ||
|
||||
backgroundExecution.discovering.value ||
|
||||
!!backgroundExecution.discoveryError.value ||
|
||||
!!error
|
||||
"
|
||||
@confirm="run('resume-shots')"
|
||||
/><ConfirmAction
|
||||
:loading="isOperationRunning(operation, '正在修复分镜绑定')"
|
||||
label="修复分镜绑定"
|
||||
description="复用已有镜头,修复 SubjectRef 与视觉 Form 绑定,再校验并保存。"
|
||||
acknowledgement
|
||||
:disabled="
|
||||
project?.status !== 'completed' ||
|
||||
!recovery.storyboard ||
|
||||
operation.pending ||
|
||||
backgroundExecution.discovering.value ||
|
||||
!!backgroundExecution.discoveryError.value ||
|
||||
!!error
|
||||
"
|
||||
@confirm="run('resume-storyboard')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</WorkspaceTools>
|
||||
</div>
|
||||
</div>
|
||||
@@ -655,12 +629,25 @@ const rules = {
|
||||
>
|
||||
<template #suffix
|
||||
><div class="tabs-toolbar-actions breakdown-toolbar-actions">
|
||||
<!-- 以下是移动端校验问题入口,与设置图标并排且共用问题详情 -->
|
||||
<NButton
|
||||
v-if="hasBreakdownIssues"
|
||||
class="icon-button breakdown-issues-trigger breakdown-mobile-issues"
|
||||
:theme-overrides="issueButtonTheme"
|
||||
:aria-label="issueEntryLabel"
|
||||
:title="issueEntryLabel"
|
||||
aria-haspopup="dialog"
|
||||
:aria-expanded="issuesOpen"
|
||||
@click="openIssues"
|
||||
>
|
||||
<template #icon><CircleAlert :size="15" aria-hidden="true" /></template>
|
||||
</NButton>
|
||||
<!-- 以下是手机分类导航中的拆解设置入口,共用原有设置弹窗 -->
|
||||
<NButton
|
||||
quaternary
|
||||
class="icon-button breakdown-mobile-tools"
|
||||
aria-label="拆解设置与恢复"
|
||||
title="拆解设置与恢复"
|
||||
aria-label="拆解设置"
|
||||
title="拆解设置"
|
||||
aria-haspopup="dialog"
|
||||
:aria-expanded="toolsOpen"
|
||||
@click="toolsOpen = true"
|
||||
@@ -768,24 +755,73 @@ const rules = {
|
||||
</section>
|
||||
</template>
|
||||
</WorkspacePage>
|
||||
<!-- 以下是与拆解设置分离的问题详情弹窗 -->
|
||||
<!-- 以下是与拆解设置分离的全屏问题详情抽屉 -->
|
||||
<BreakdownIssuesDialog
|
||||
v-model:open="issuesOpen"
|
||||
:issues="storyboardIssues"
|
||||
:workflow-error="execution?.errorMessage"
|
||||
:locatable="!breakdownBusy && !!shots.length"
|
||||
@locate="locateIssue"
|
||||
@settings="toolsOpen = true"
|
||||
/>
|
||||
>
|
||||
<!-- 以下是只属于问题处理的人工修订与阶段恢复,不混入拆解启动配置 -->
|
||||
<template #repair>
|
||||
<p v-if="breakdownBusy || operation.pending" role="status" class="text-xs leading-6 text-muted">
|
||||
任务执行中,可查看问题,结束后再修订或恢复。
|
||||
</p>
|
||||
<p
|
||||
v-else-if="backgroundExecution.discovering.value || backgroundExecution.discoveryError.value || error"
|
||||
role="status"
|
||||
class="text-xs leading-6 text-muted"
|
||||
>
|
||||
任务状态或结果尚未确认,请先重新读取状态与结果。
|
||||
</p>
|
||||
<StoryboardQualityRepair
|
||||
v-if="issuesOpen && snapshot"
|
||||
:project-id="projectId"
|
||||
:checkpoint="latestCheckpoint"
|
||||
:disabled="issueActionsDisabled"
|
||||
@refresh="refreshCandidate"
|
||||
/>
|
||||
<div v-if="snapshot && showRecovery" class="recovery-strip">
|
||||
<div>
|
||||
<p class="text-sm font-medium">从中断处继续</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<ConfirmAction
|
||||
:loading="isOperationRunning(operation, '正在重试失败抽取')"
|
||||
label="重试失败抽取"
|
||||
description="只重试 character / scene / prop 抽取任务中的失败项。不能用于镜头阶段失败。"
|
||||
acknowledgement
|
||||
:disabled="issueActionsDisabled || !recovery.retry"
|
||||
@confirm="run('retry')"
|
||||
/><ConfirmAction
|
||||
:loading="isOperationRunning(operation, '正在补齐镜头')"
|
||||
label="补齐缺失镜头"
|
||||
description="复用已完成剧集的镜头,仅生成尚未完成的 Episode Shot,再进行校验与入库。"
|
||||
acknowledgement
|
||||
:disabled="issueActionsDisabled || !recovery.shots"
|
||||
@confirm="run('resume-shots')"
|
||||
/><ConfirmAction
|
||||
:loading="isOperationRunning(operation, '正在修复分镜绑定')"
|
||||
label="修复分镜绑定"
|
||||
description="复用已有镜头,修复 SubjectRef 与视觉 Form 绑定,再校验并保存。"
|
||||
acknowledgement
|
||||
:disabled="issueActionsDisabled || !recovery.storyboard"
|
||||
@confirm="run('resume-storyboard')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</BreakdownIssuesDialog>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
/* 键盘聚焦仍有清晰提示,并与问题入口的红色语义保持一致。 */
|
||||
.breakdown-workspace-page .breakdown-issues-trigger.n-button:focus-visible {
|
||||
outline-color: var(--app-danger);
|
||||
}
|
||||
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
||||
@reference "../../styles/styles.css";
|
||||
/* 任务进度与设置面板共用水平边界,避免重复内缩。 */
|
||||
.workspace-tools-body .breakdown-execution-panel {
|
||||
padding: 0;
|
||||
}
|
||||
.group-preview {
|
||||
@apply mt-6 pt-5;
|
||||
}
|
||||
@@ -887,7 +923,8 @@ const rules = {
|
||||
.breakdown-workspace-page .breakdown-toolbar-actions {
|
||||
gap: 0;
|
||||
}
|
||||
.breakdown-workspace-page .breakdown-mobile-tools.n-button {
|
||||
.breakdown-workspace-page .breakdown-mobile-tools.n-button,
|
||||
.breakdown-workspace-page .breakdown-mobile-issues.n-button {
|
||||
display: none;
|
||||
}
|
||||
.breakdown-task-label-mobile {
|
||||
@@ -908,7 +945,8 @@ const rules = {
|
||||
.breakdown-workspace-page .workspace-tabs.n-tabs .n-tabs-nav .n-tabs-tab {
|
||||
padding-inline: 8px;
|
||||
}
|
||||
.breakdown-workspace-page .breakdown-mobile-tools.n-button {
|
||||
.breakdown-workspace-page .breakdown-mobile-tools.n-button,
|
||||
.breakdown-workspace-page .breakdown-mobile-issues.n-button {
|
||||
display: inline-flex;
|
||||
width: 44px;
|
||||
min-width: 44px;
|
||||
@@ -963,6 +1001,19 @@ const rules = {
|
||||
.breakdown-workspace-page .workspace-tools-label {
|
||||
@apply hidden;
|
||||
}
|
||||
/* 窄屏问题入口与设置按钮保持同样的方形尺寸,仅隐藏可见文案。 */
|
||||
.breakdown-workspace-page .breakdown-issues-label {
|
||||
display: none;
|
||||
}
|
||||
.breakdown-workspace-page .breakdown-desktop-issues.n-button {
|
||||
width: 32px;
|
||||
min-width: 32px;
|
||||
height: 32px;
|
||||
padding: 0;
|
||||
}
|
||||
.breakdown-workspace-page .breakdown-issues-trigger .n-button__icon {
|
||||
margin: 0;
|
||||
}
|
||||
.breakdown-workspace-page .workspace-tools-trigger {
|
||||
@apply h-8 w-8 p-0;
|
||||
min-width: 32px;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { NButton } from 'naive-ui'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import { AppDrawer } from '../../../components/ui'
|
||||
import type { ShotValidation } from '../types'
|
||||
|
||||
/** 同一剧集、节拍和镜头的校验问题分组。 */
|
||||
@@ -14,7 +14,7 @@ interface BreakdownIssueGroup {
|
||||
messages: string[]
|
||||
}
|
||||
|
||||
/** 拆解问题单独展示,设置弹窗不承载长错误正文。 */
|
||||
/** 拆解问题及调用方提供的修订、恢复操作使用独立全屏抽屉展示。 */
|
||||
const props = defineProps<{
|
||||
/** 后端分镜校验问题,保留原始描述和位置。 */
|
||||
issues: ShotValidation['issues']
|
||||
@@ -23,10 +23,10 @@ const props = defineProps<{
|
||||
/** 当前结果是否允许定位到分镜正文。 */
|
||||
locatable: boolean
|
||||
}>()
|
||||
/** 独立问题弹窗显隐。 */
|
||||
/** 独立问题抽屉显隐。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 弹窗关闭后再定位正文或打开设置,避免叠加焦点陷阱。 */
|
||||
const emit = defineEmits<{ locate: [issue: ShotValidation['issues'][number]]; settings: [] }>()
|
||||
/** 抽屉关闭后再定位正文,避免焦点陷阱阻止定位。 */
|
||||
const emit = defineEmits<{ locate: [issue: ShotValidation['issues'][number]] }>()
|
||||
/** 相同镜头的问题合并为一组,重复消息不重复显示。 */
|
||||
const groups = computed(() => {
|
||||
const result = new Map<string, BreakdownIssueGroup>()
|
||||
@@ -42,11 +42,9 @@ const groups = computed(() => {
|
||||
const count = computed(() => groups.value.reduce((total, group) => total + group.messages.length, 0))
|
||||
/** 等待离场后执行的定位。 */
|
||||
const pendingLocation = ref<ShotValidation['issues'][number] | null>(null)
|
||||
/** 等待离场后打开设置。 */
|
||||
const pendingSettings = ref(false)
|
||||
|
||||
/**
|
||||
* 关闭问题弹窗后定位到对应剧集、节拍或镜头。
|
||||
* 关闭问题抽屉后定位到对应剧集、节拍或镜头。
|
||||
* @param issue 后端提供的问题位置
|
||||
*/
|
||||
function locate(issue: ShotValidation['issues'][number]) {
|
||||
@@ -54,11 +52,6 @@ function locate(issue: ShotValidation['issues'][number]) {
|
||||
pendingLocation.value = { ...issue }
|
||||
open.value = false
|
||||
}
|
||||
/** 关闭当前弹窗后打开拆解设置,避免同时显示两个操作弹窗。 */
|
||||
function settings() {
|
||||
pendingSettings.value = true
|
||||
open.value = false
|
||||
}
|
||||
/** 离场动画结束后再交接焦点。 */
|
||||
function finish() {
|
||||
if (pendingLocation.value) {
|
||||
@@ -66,16 +59,12 @@ function finish() {
|
||||
pendingLocation.value = null
|
||||
emit('locate', issue)
|
||||
}
|
||||
if (pendingSettings.value) {
|
||||
pendingSettings.value = false
|
||||
emit('settings')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是独立的拆解执行错误与分镜校验问题模块 -->
|
||||
<AppDialog v-model:open="open" title="拆解问题" wide @closed="finish">
|
||||
<!-- 以下是全屏展示的拆解执行错误与分镜校验问题模块 -->
|
||||
<AppDrawer v-model:open="open" title="拆解问题" @closed="finish">
|
||||
<template #description
|
||||
><span v-if="count">{{ count }} 项校验问题 · {{ groups.length }} 个位置</span
|
||||
><span v-else>查看最近保存结果中的问题</span></template
|
||||
@@ -105,12 +94,12 @@ function finish() {
|
||||
</p>
|
||||
</article>
|
||||
<p v-if="!groups.length && !workflowError" class="py-5 text-sm text-muted">
|
||||
后端尚未返回具体问题,请刷新拆解结果后查看。
|
||||
当前没有具体错误描述,可读取修复清单确认待处理镜头。
|
||||
</p>
|
||||
</div>
|
||||
<template #footer
|
||||
><NButton @click="settings">拆解设置</NButton
|
||||
><NButton type="primary" @click="open = false">关闭</NButton></template
|
||||
>
|
||||
</AppDialog>
|
||||
<!-- 以下是独立的问题修订与阶段恢复模块,不承载生成配置或候选提交 -->
|
||||
<div v-if="$slots.repair" class="mt-6 space-y-5" aria-label="问题修订与恢复"><slot name="repair" /></div>
|
||||
<!-- 以下是灰底关闭操作,绿色主按钮仅用于提交或执行任务 -->
|
||||
<template #footer><NButton type="default" @click="open = false">关闭</NButton></template>
|
||||
</AppDrawer>
|
||||
</template>
|
||||
@@ -696,8 +696,9 @@ defineExpose({ open })
|
||||
</div>
|
||||
</div>
|
||||
</NSpin>
|
||||
<!-- 以下是固定底栏操作模块,正文滚动时仍可预览范围并进行费用确认 -->
|
||||
<!-- 以下是固定底栏关闭、预览与确认模块,正文滚动时仍可退出 -->
|
||||
<template #footer>
|
||||
<NButton @click="dialogOpen = false">关闭</NButton>
|
||||
<NButton
|
||||
:loading="previewBusy"
|
||||
:disabled="!dialogDataReady || dialogLoading || starting || execution.active.value"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||||
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
|
||||
|
||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||
import { NButton, NFormItem, NSelect, NSpin } from 'naive-ui'
|
||||
@@ -249,8 +250,8 @@ onScopeDispose(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是项目画布与图片、视频模型配置模块 -->
|
||||
<section class="production-tool-section creative-profile-settings workspace-panel">
|
||||
<!-- 以下是平铺的项目画布与模型配置模块,使用留白分组而不叠加背景面板 -->
|
||||
<section class="production-tool-section creative-profile-settings">
|
||||
<h3 v-if="!hideActions" class="text-sm font-semibold">项目画布与生成模型</h3>
|
||||
<NSpin :show="loading">
|
||||
<ContextNotice v-if="disabled" type="info" :show-icon="false" class="mb-3"
|
||||
@@ -269,18 +270,28 @@ onScopeDispose(() => {
|
||||
当前没有可用的完整图片和视频模型,暂时无法保存项目生成配置。
|
||||
</ContextNotice>
|
||||
<div v-if="profile" class="creative-profile-grid">
|
||||
<NFormItem label="作品宽高比">
|
||||
<NSelect
|
||||
:value="profile.aspectRatio"
|
||||
:options="aspectRatios"
|
||||
:disabled="saving || disabled"
|
||||
@update:value="profile.aspectRatio = $event as CreativeProfileAspectRatio"
|
||||
<!-- 以下是独占一行的画布设置,与下方两个模型分组共用边界 -->
|
||||
<section class="creative-profile-canvas space-y-4">
|
||||
<WorkspaceSectionHeading
|
||||
title="画布设置"
|
||||
description="设置作品画面比例,后续制作使用已保存的项目画布。"
|
||||
/>
|
||||
</NFormItem>
|
||||
<div></div>
|
||||
<NFormItem label="作品宽高比">
|
||||
<NSelect
|
||||
:value="profile.aspectRatio"
|
||||
:options="aspectRatios"
|
||||
:disabled="saving || disabled"
|
||||
@update:value="profile.aspectRatio = $event as CreativeProfileAspectRatio"
|
||||
/>
|
||||
</NFormItem>
|
||||
</section>
|
||||
<!-- 以下是项目图片生成配置模块 -->
|
||||
<section class="model-section min-w-0 pt-5">
|
||||
<h3 class="mb-4 text-sm font-semibold">图片配置</h3>
|
||||
<section class="model-section min-w-0">
|
||||
<WorkspaceSectionHeading
|
||||
class="mb-4"
|
||||
title="图片配置"
|
||||
description="选择图片模型和默认生成参数,后续图片制作将继承此配置。"
|
||||
/>
|
||||
<NFormItem label="图片模型">
|
||||
<NSelect
|
||||
:value="imageSelection"
|
||||
@@ -296,8 +307,12 @@ onScopeDispose(() => {
|
||||
/>
|
||||
</section>
|
||||
<!-- 以下是项目视频生成配置模块 -->
|
||||
<section class="model-section min-w-0 pt-5">
|
||||
<h3 class="mb-4 text-sm font-semibold">视频配置</h3>
|
||||
<section class="model-section min-w-0">
|
||||
<WorkspaceSectionHeading
|
||||
class="mb-4"
|
||||
title="视频配置"
|
||||
description="选择视频模型和默认生成参数,后续视频制作将继承此配置。"
|
||||
/>
|
||||
<NFormItem label="视频模型">
|
||||
<NSelect
|
||||
:value="videoSelection"
|
||||
@@ -324,27 +339,30 @@ onScopeDispose(() => {
|
||||
<style scoped>
|
||||
@reference "../../../styles/styles.css";
|
||||
.creative-profile-grid {
|
||||
@apply grid grid-cols-[repeat(2,_minmax(0,_1fr))] items-start gap-x-5 gap-y-6;
|
||||
@apply grid grid-cols-[repeat(2,_minmax(0,_1fr))] items-start gap-x-10 gap-y-6;
|
||||
}
|
||||
/* 画布设置铺满一行,图片与视频在宽屏并排、窄屏依次显示。 */
|
||||
.creative-profile-canvas {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
.model-section > :deep(.n-form-item) {
|
||||
@apply mb-6;
|
||||
}
|
||||
.creative-profile-grid > :deep(.n-form-item--top-labelled),
|
||||
.model-section > :deep(.n-form-item--top-labelled) {
|
||||
/* 模块首字段与动态参数字段使用相同的标签和控件行高。 */
|
||||
.creative-profile-grid :deep(.n-form-item--top-labelled) {
|
||||
grid-template-rows: minmax(var(--n-label-height), auto) auto auto;
|
||||
}
|
||||
.creative-profile-grid > :deep(.n-form-item-label),
|
||||
.model-section > :deep(.n-form-item-label) {
|
||||
.creative-profile-grid :deep(.n-form-item-label) {
|
||||
min-height: 30px;
|
||||
padding: 0 0 8px;
|
||||
}
|
||||
.creative-profile-grid > :deep(.n-form-item-blank),
|
||||
.model-section > :deep(.n-form-item-blank) {
|
||||
.creative-profile-grid :deep(.n-form-item-blank) {
|
||||
min-height: 34px;
|
||||
align-items: center;
|
||||
}
|
||||
.creative-profile-settings {
|
||||
@apply m-0;
|
||||
/* 与质量规则页的首模块保持相同的顶部留白。 */
|
||||
@apply m-0 pt-5;
|
||||
}
|
||||
.creative-profile-settings > h3 {
|
||||
@apply mb-4;
|
||||
@@ -356,8 +374,5 @@ onScopeDispose(() => {
|
||||
.creative-profile-grid {
|
||||
@apply grid-cols-[minmax(0,_1fr)];
|
||||
}
|
||||
.creative-profile-grid > div:empty {
|
||||
@apply hidden;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -135,6 +135,10 @@ function constrainedOptions(schema: GenerationOptionSchema, current: string | nu
|
||||
.generation-option-grid :deep(.n-form-item) {
|
||||
@apply min-w-0 mb-0 self-start;
|
||||
}
|
||||
/* 数值字段与同列的下拉字段使用相同宽度,避免留下不齐的空白。 */
|
||||
.generation-option-grid :deep(.n-input-number) {
|
||||
width: 100%;
|
||||
}
|
||||
/* Naive 默认使用 1fr 扩展控件行;同排说明文字不等高时会把较短字段的控件推到底部。 */
|
||||
.generation-option-grid :deep(.n-form-item--top-labelled) {
|
||||
grid-template-rows: minmax(var(--n-label-height), auto) auto auto;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue'
|
||||
import { NButton, NTabs, NTabPane } from 'naive-ui'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import { AppDrawer } from '../../../components/ui'
|
||||
import type { CreativeProfileInput } from '../types'
|
||||
import CreativeProfileSettings from './CreativeProfileSettings.vue'
|
||||
import QualityPolicySettings from './QualityPolicySettings.vue'
|
||||
|
||||
/** 项目全局配置弹窗参数。 */
|
||||
/** 项目全局配置全屏抽屉参数。 */
|
||||
const props = defineProps<{
|
||||
/** 当前正式项目 ID。 */
|
||||
projectId: string
|
||||
@@ -15,13 +15,13 @@ const props = defineProps<{
|
||||
}>()
|
||||
/** 真实保存成功后通知项目布局更新就绪信息。 */
|
||||
const emit = defineEmits<{ saved: [profile: CreativeProfileInput] }>()
|
||||
/** 弹窗显隐状态。 */
|
||||
/** 项目配置全屏抽屉显隐状态。 */
|
||||
const open = defineModel<boolean>('open', { default: false })
|
||||
/** 保存进行中时禁止关闭弹窗,避免重复写入。 */
|
||||
/** 保存进行中时禁止关闭抽屉,避免重复写入。 */
|
||||
const saving = ref(false)
|
||||
/** 配置表单实例,footer 调用表单自身的校验与保存入口。 */
|
||||
const form = ref<InstanceType<typeof CreativeProfileSettings> | null>(null)
|
||||
/** 项目级配置分类保持同一个弹窗与底栏。 */
|
||||
/** 项目级配置分类保持同一个全屏抽屉与底栏。 */
|
||||
const tab = ref('generation')
|
||||
/** 质量策略表单实例。 */
|
||||
const qualityForm = ref<InstanceType<typeof QualityPolicySettings> | null>(null)
|
||||
@@ -30,8 +30,8 @@ const activeForm = computed(() => (tab.value === 'quality' ? qualityForm.value :
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是项目图片与视频全局配置弹窗模块 -->
|
||||
<AppDialog v-model:open="open" title="项目全局配置" :busy="saving" wide>
|
||||
<!-- 以下是内容铺满视口的项目全局配置抽屉模块 -->
|
||||
<AppDrawer v-model:open="open" title="项目全局配置" :busy="saving">
|
||||
<template #description>设置生成模型、画布与质量规则,后续制作使用已保存的项目配置。</template>
|
||||
<!-- 以下是生成配置与质量规则分类导航,保存期间禁止切换 -->
|
||||
<NTabs v-if="open" v-model:value="tab" type="line" size="small">
|
||||
@@ -64,5 +64,5 @@ const activeForm = computed(() => (tab.value === 'quality' ? qualityForm.value :
|
||||
tab === 'quality' ? '保存质量规则' : '保存配置'
|
||||
}}</NButton>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</AppDrawer>
|
||||
</template>
|
||||
@@ -1,10 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||||
import { NButton, NCheckbox, NFormItem, NInput, NSelect } from 'naive-ui'
|
||||
import { Trash2 } from '@lucide/vue'
|
||||
import { projectsApi } from '../../projects/api'
|
||||
import { actionResourceOptions, policyDraft, policyIssue } from '../../projects/quality-policy'
|
||||
import type { ProjectQualityPolicy } from '../../projects/types'
|
||||
import { errorMessage } from '../../../lib/http'
|
||||
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
|
||||
|
||||
/** 项目质量策略独立编辑表单。 */
|
||||
const props = defineProps<{
|
||||
@@ -31,10 +33,18 @@ const physicsOptions = [
|
||||
{ value: 'stylized', label: '风格化表现' },
|
||||
{ value: 'fantasy', label: '幻想表现' }
|
||||
]
|
||||
/** 草稿校验错误。 */
|
||||
const issue = computed(() => (policy.value ? policyIssue(policy.value) : ''))
|
||||
/** 只有已读取真实策略且没有活动操作才允许提交。 */
|
||||
const canSave = computed(() => !!policy.value && !issue.value && !props.disabled && !loading.value && !saving.value)
|
||||
/** 仅在用户点击保存时产生校验反馈,不在读取或新增空白例外时提前报错。 */
|
||||
const issue = ref('')
|
||||
/** 已读取策略且没有活动操作时允许点击保存,由保存入口校验完整性。 */
|
||||
const canSave = computed(() => !!policy.value && !props.disabled && !loading.value && !saving.value)
|
||||
/** 修改草稿后清除上一次校验反馈,下一次保存再检查完整策略。 */
|
||||
watch(
|
||||
policy,
|
||||
() => {
|
||||
issue.value = ''
|
||||
},
|
||||
{ deep: true, flush: 'sync' }
|
||||
)
|
||||
/** 规则文本仅做逐行编辑,空行不作为规则提交。 */
|
||||
const rulesText = ref('')
|
||||
/** 保留输入中的换行,仅在策略草稿中去除空白规则。 */
|
||||
@@ -60,6 +70,7 @@ async function load() {
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
notice.value = ''
|
||||
issue.value = ''
|
||||
try {
|
||||
const result = await projectsApi.qualityPolicy(id, controller.signal)
|
||||
if (current !== version) return
|
||||
@@ -89,9 +100,11 @@ function removeException(index: number) {
|
||||
policy.value?.actionExceptions?.splice(index, 1)
|
||||
}
|
||||
|
||||
/** 保存完整策略,保留项目和请求归属检查。 */
|
||||
/** 点击保存时校验完整策略,通过后再提交并核对项目归属。 */
|
||||
async function save() {
|
||||
if (!canSave.value || !policy.value) return
|
||||
issue.value = policyIssue(policy.value)
|
||||
if (issue.value) return
|
||||
const id = props.projectId
|
||||
const current = version
|
||||
const input = policyDraft(policy.value)
|
||||
@@ -134,12 +147,10 @@ defineExpose({ save, canSave })
|
||||
<template v-if="policy">
|
||||
<!-- 以下是物理表现与明确动作许可模块 -->
|
||||
<section class="space-y-4" aria-label="动作与物理规则">
|
||||
<div>
|
||||
<h3 class="text-sm font-medium">动作与物理规则</h3>
|
||||
<p class="mt-2 text-xs leading-6 text-muted">
|
||||
选择表现方式后,仍需明确勾选允许的动作范围。保存不会重新生成已有资产。
|
||||
</p>
|
||||
</div>
|
||||
<WorkspaceSectionHeading
|
||||
title="动作与物理规则"
|
||||
description="选择表现方式后,仍需明确勾选允许的动作范围。保存不会重新生成已有资产。"
|
||||
/>
|
||||
<NFormItem label="物理表现方式" :label-props="{ id: 'quality-physics-mode-label' }">
|
||||
<NSelect
|
||||
v-model:value="policy.physicsMode"
|
||||
@@ -173,16 +184,20 @@ defineExpose({ save, canSave })
|
||||
</NFormItem>
|
||||
<!-- 以下是主体和具体动作资源的精确例外模块 -->
|
||||
<section class="space-y-4" aria-label="精确动作例外">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h3 class="text-sm font-medium">精确动作例外</h3>
|
||||
<NButton
|
||||
size="small"
|
||||
:disabled="disabled || saving || (policy.actionExceptions?.length ?? 0) >= 30"
|
||||
@click="addException"
|
||||
>添加例外</NButton
|
||||
>
|
||||
</div>
|
||||
<p class="text-xs leading-6 text-muted">仅对填写的主体与资源放宽动作资源冲突,需记录明确依据。</p>
|
||||
<!-- 以下是与生成配置统一间距的模块标题、说明和操作模块 -->
|
||||
<WorkspaceSectionHeading
|
||||
title="精确动作例外"
|
||||
description="仅对填写的主体与资源放宽动作资源冲突,需记录明确依据。"
|
||||
>
|
||||
<template #actions>
|
||||
<NButton
|
||||
size="small"
|
||||
:disabled="disabled || saving || (policy.actionExceptions?.length ?? 0) >= 30"
|
||||
@click="addException"
|
||||
>添加例外</NButton
|
||||
>
|
||||
</template>
|
||||
</WorkspaceSectionHeading>
|
||||
<div v-for="(item, index) in policy.actionExceptions" :key="index" class="quality-exception-row">
|
||||
<NFormItem label="主体引用"
|
||||
><NInput
|
||||
@@ -204,7 +219,15 @@ defineExpose({ save, canSave })
|
||||
:aria-label="`例外 ${index + 1} 确认依据`"
|
||||
:disabled="disabled || saving"
|
||||
/></NFormItem>
|
||||
<NButton :disabled="disabled || saving" @click="removeException(index)">移除</NButton>
|
||||
<!-- 以下是与输入框底部对齐的图标移除操作,保留明确的可访问名称 -->
|
||||
<NButton
|
||||
class="icon-button quality-exception-remove"
|
||||
:aria-label="`移除例外 ${index + 1}`"
|
||||
title="移除例外"
|
||||
:disabled="disabled || saving"
|
||||
@click="removeException(index)"
|
||||
><Trash2 :size="16" aria-hidden="true"
|
||||
/></NButton>
|
||||
</div>
|
||||
</section>
|
||||
<p v-if="issue" role="status" class="text-xs leading-6 text-danger">{{ issue }}</p>
|
||||
@@ -222,9 +245,12 @@ defineExpose({ save, canSave })
|
||||
.quality-exception-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(120px, 1fr) minmax(100px, 0.7fr) minmax(160px, 1.5fr) auto;
|
||||
align-items: center;
|
||||
align-items: end;
|
||||
gap: 16px;
|
||||
}
|
||||
.quality-exception-remove {
|
||||
justify-self: end;
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
.quality-exception-row {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
|
||||
@@ -4,7 +4,7 @@ import ContextNotice from '../../components/ui/ContextNotice.vue'
|
||||
import { computed, h, inject, onScopeDispose, provide, ref, watch, watchEffect } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { NScrollbar, NButton, NPageHeader, NSpin, NEllipsis } from 'naive-ui'
|
||||
import { EmptyState } from '../../components/ui'
|
||||
import { EmptyState, WorkspaceRefreshButton } from '../../components/ui'
|
||||
import { projectContextKey, useProjectData } from './context'
|
||||
import { getOperation } from '../workflows/operations'
|
||||
import { projectAccessKey, projectSectionFromPath, type ProjectAccess } from './access'
|
||||
@@ -294,9 +294,13 @@ onScopeDispose(() => {
|
||||
@click="router.push(`/projects/${id}/${currentAccess.nextPath}`)"
|
||||
>{{ currentAccess.nextLabel || '前往上一步' }}</NButton
|
||||
>
|
||||
<NButton v-if="isGallery" class="ml-3" :loading="context.loading.value" @click="context.refresh"
|
||||
>刷新项目状态</NButton
|
||||
>
|
||||
<!-- 以下是手动刷新项目状态模块,图标位常驻以保持加载前后的按钮尺寸 -->
|
||||
<WorkspaceRefreshButton
|
||||
v-if="isGallery"
|
||||
label="刷新项目状态"
|
||||
:loading="context.loading.value"
|
||||
@refresh="context.refresh"
|
||||
/>
|
||||
</EmptyState>
|
||||
<!-- 以下是剧本创作首次读取的骨架屏模块 -->
|
||||
<CreateDramaSkeleton v-else-if="isProjectInitialLoading && isCreation" />
|
||||
|
||||
@@ -6,14 +6,14 @@ import { requiredTextRule, integerRule } from '../../../lib/form-rules'
|
||||
import { NButton, NInput, NInputNumber, NSelect } from 'naive-ui'
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { ArrowRight, LoaderCircle, Plus } from '@lucide/vue'
|
||||
import { AppDialog } from '../../../components/ui'
|
||||
import { AppDrawer } from '../../../components/ui'
|
||||
import { projectsApi } from '../api'
|
||||
import type { DramaDurationBudget } from '../types'
|
||||
import { errorMessage } from '../../../lib/http'
|
||||
|
||||
/** 新建剧本表单,202 成功后交由父级跳转,不在前端模拟生成。 */
|
||||
const emit = defineEmits<{ created: [projectId: string, executionId: string] }>()
|
||||
/** 新建剧本弹窗是否打开。 */
|
||||
/** 新建剧本全屏抽屉是否打开。 */
|
||||
const open = ref(false)
|
||||
/** 创建请求是否正在提交。 */
|
||||
const busy = ref(false)
|
||||
@@ -120,22 +120,22 @@ const rules = computed(() => ({
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppDialog
|
||||
<!-- 以下是新建剧本入口与从右侧展开的全屏抽屉模块 -->
|
||||
<NButton @click="open = true" type="primary"><Plus :size="16" />新建剧本</NButton>
|
||||
<AppDrawer
|
||||
v-model:open="open"
|
||||
title="新建剧本"
|
||||
description="从一个故事想法开始。提交后,工作流将依次生成角色、世界观和剧集,并进行审核。"
|
||||
:busy="busy"
|
||||
class="create-project-drawer"
|
||||
>
|
||||
<template #trigger
|
||||
><NButton @click="open = true" type="primary"><Plus :size="16" />新建剧本</NButton></template
|
||||
>
|
||||
<AppForm
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:disabled="busy"
|
||||
:reset-key="open"
|
||||
class="mt-7 space-y-4"
|
||||
class="create-project-form grid gap-6"
|
||||
@submit="submit"
|
||||
>
|
||||
<!-- 以下是项目基本信息模块 -->
|
||||
@@ -147,65 +147,65 @@ const rules = computed(() => ({
|
||||
:input-props="{ id: 'title', autocomplete: 'off' }"
|
||||
></NInput
|
||||
></NFormItem>
|
||||
<NFormItem path="topic" label="故事主题" :label-props="{ for: 'topic' }"
|
||||
><NInput
|
||||
placeholder="描述主角、故事背景,以及你希望展开的核心冲突……"
|
||||
:disabled="busy"
|
||||
:input-props="{ id: 'topic' }"
|
||||
class="project-story-input min-h-32 resize-y"
|
||||
v-model:value="form.topic"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 3, maxRows: 12 }"
|
||||
></NInput
|
||||
></NFormItem>
|
||||
<!-- 故事内容:主题和风格相邻,方便填写与对照。 -->
|
||||
<div class="grid grid-cols-1 gap-4">
|
||||
<!-- 以下是故事内容模块,主题和风格各占一行并铺满可用宽度 -->
|
||||
<div class="grid grid-cols-1 items-start gap-6">
|
||||
<NFormItem path="topic" label="故事主题" :label-props="{ for: 'topic' }"
|
||||
><NInput
|
||||
placeholder="描述主角、故事背景,以及你希望展开的核心冲突……"
|
||||
:disabled="busy"
|
||||
:input-props="{ id: 'topic' }"
|
||||
class="project-story-input min-h-48 resize-y"
|
||||
v-model:value="form.topic"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 6, maxRows: 16 }"
|
||||
></NInput
|
||||
></NFormItem>
|
||||
<NFormItem path="style" label="剧本风格" :label-props="{ for: 'style' }"
|
||||
><NInput
|
||||
placeholder="如:都市悬疑、爽文反转"
|
||||
:disabled="busy"
|
||||
:input-props="{ id: 'style' }"
|
||||
class="project-story-input min-h-32 resize-y"
|
||||
class="project-story-input min-h-48 resize-y"
|
||||
v-model:value="form.style"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 3, maxRows: 12 }"
|
||||
:autosize="{ minRows: 6, maxRows: 16 }"
|
||||
></NInput
|
||||
></NFormItem>
|
||||
</div>
|
||||
<!-- 时长与集数:按规划模式动态显示。 -->
|
||||
<NFormItem label="时长规划模式"
|
||||
><NSelect v-model:value="form.durationMode" :options="durationOptions" :disabled="busy"
|
||||
/></NFormItem>
|
||||
<NFormItem v-if="form.durationMode !== 'auto'" label="整剧目标时长(分钟)"
|
||||
><NInputNumber
|
||||
:value="form.totalMinutes"
|
||||
@update:value="form.totalMinutes = $event ?? 0"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:disabled="busy"
|
||||
class="w-full"
|
||||
/></NFormItem>
|
||||
<div v-if="form.durationMode === 'flexible_episode_count'" class="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
||||
<NFormItem label="单集最短时长(秒)"
|
||||
<!-- 以下是时长与集数模块,各字段按规划模式逐行显示 -->
|
||||
<div class="grid grid-cols-1 items-start gap-6">
|
||||
<NFormItem label="时长规划模式"
|
||||
><NSelect v-model:value="form.durationMode" :options="durationOptions" :disabled="busy"
|
||||
/></NFormItem>
|
||||
<NFormItem v-if="form.durationMode !== 'auto'" label="整剧目标时长(分钟)"
|
||||
><NInputNumber
|
||||
:value="form.minSeconds"
|
||||
@update:value="form.minSeconds = $event ?? 0"
|
||||
:value="form.totalMinutes"
|
||||
@update:value="form.totalMinutes = $event ?? 0"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:disabled="busy"
|
||||
class="w-full"
|
||||
/></NFormItem>
|
||||
<NFormItem label="单集最长时长(秒)"
|
||||
><NInputNumber
|
||||
:value="form.maxSeconds"
|
||||
@update:value="form.maxSeconds = $event ?? 0"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:disabled="busy"
|
||||
class="w-full"
|
||||
/></NFormItem>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 gap-4">
|
||||
<template v-if="form.durationMode === 'flexible_episode_count'">
|
||||
<NFormItem label="单集最短时长(秒)"
|
||||
><NInputNumber
|
||||
:value="form.minSeconds"
|
||||
@update:value="form.minSeconds = $event ?? 0"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:disabled="busy"
|
||||
class="w-full"
|
||||
/></NFormItem>
|
||||
<NFormItem label="单集最长时长(秒)"
|
||||
><NInputNumber
|
||||
:value="form.maxSeconds"
|
||||
@update:value="form.maxSeconds = $event ?? 0"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:disabled="busy"
|
||||
class="w-full"
|
||||
/></NFormItem>
|
||||
</template>
|
||||
<NFormItem
|
||||
v-if="form.durationMode !== 'flexible_episode_count'"
|
||||
path="episodeCount"
|
||||
@@ -223,6 +223,7 @@ const rules = computed(() => ({
|
||||
</div>
|
||||
<FeedbackMessage v-if="feedback" :message="feedback" />
|
||||
</AppForm>
|
||||
<!-- 以下是固定底部操作模块,长内容滚动时仍可取消或提交 -->
|
||||
<template #footer>
|
||||
<NButton :disabled="busy" @click="open = false">取消</NButton>
|
||||
<NButton :disabled="busy" type="primary" @click="formRef?.validate(submit)">
|
||||
@@ -231,5 +232,5 @@ const rules = computed(() => ({
|
||||
<ArrowRight v-if="!busy" :size="16" />
|
||||
</NButton>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</AppDrawer>
|
||||
</template>
|
||||
@@ -4,7 +4,6 @@ import { computed, onBeforeUnmount, reactive, ref, watch } from 'vue'
|
||||
import AppForm from '../../../components/ui/AppForm.vue'
|
||||
import { AppDialog, AssetImage } from '../../../components/ui'
|
||||
import { fieldRule, imageUrlRule } from '../../../lib/form-rules'
|
||||
import { referenceImageUrl } from '../../../lib/assets'
|
||||
import { errorMessage } from '../../../lib/http'
|
||||
import { projectAssetsApi } from '../../project-assets/api'
|
||||
import type { ProjectAsset } from '../../project-assets/types'
|
||||
@@ -178,15 +177,8 @@ onBeforeUnmount(() => assetController?.abort())
|
||||
<p v-if="image.provider || image.model" class="mt-2 break-words text-[11px] text-muted">
|
||||
{{ image.provider }} {{ image.model }}
|
||||
</p>
|
||||
<!-- 以下是参考图启停与移除操作模块,图片查看复用缩略图预览 -->
|
||||
<div class="mt-3 flex flex-wrap gap-3">
|
||||
<a
|
||||
v-if="referenceImageUrl(image.imageUrl)"
|
||||
:href="referenceImageUrl(image.imageUrl)!"
|
||||
class="text-button"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>原图</a
|
||||
>
|
||||
<NButton :disabled="disabled" @click="emit('toggle', image)" text size="small">{{
|
||||
image.enabled ? '停用' : '启用'
|
||||
}}</NButton>
|
||||
|
||||
@@ -60,7 +60,8 @@ function confirm() {
|
||||
class="mt-5 flex items-start gap-3 text-sm leading-6"
|
||||
>我已确认后台任务停止,当前没有同项目的生成或拆解任务在运行。</NCheckbox
|
||||
>
|
||||
<div class="dialog-footer mt-6">
|
||||
<!-- 以下是固定的取消与确认操作,使用公共底栏避免重复关闭按钮 -->
|
||||
<template #footer>
|
||||
<NButton @click="open = false">取消</NButton
|
||||
><NButton
|
||||
:disabled="disabled || loading || (acknowledgement && !acknowledged)"
|
||||
@@ -69,7 +70,7 @@ function confirm() {
|
||||
>
|
||||
确认{{ label }}</NButton
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
@@ -30,16 +30,28 @@ const percentage = computed(() => executionPercentage(props.execution?.current ?
|
||||
const result = computed(() => props.execution?.result ?? {})
|
||||
/** 拆解任务的单位和结果文案与镜头素材任务分开。 */
|
||||
const breakdownTask = computed(() => props.execution?.workflowName === 'breakdown')
|
||||
/** 执行完成不等于业务校验通过,明确保留待修复状态。 */
|
||||
const breakdownInvalid = computed(() => {
|
||||
/** 只采用后端明确返回的校验结果,缺失时保留待确认状态。 */
|
||||
const breakdownValidation = computed<boolean | null>(() => {
|
||||
const validation = result.value.storyboardShotValidation
|
||||
return (
|
||||
breakdownTask.value &&
|
||||
validation &&
|
||||
typeof validation === 'object' &&
|
||||
'valid' in validation &&
|
||||
validation.valid === false
|
||||
)
|
||||
if (!validation || typeof validation !== 'object' || !('valid' in validation)) return null
|
||||
return typeof validation.valid === 'boolean' ? validation.valid : null
|
||||
})
|
||||
/** 执行完成不等于业务校验通过,明确保留待修复状态。 */
|
||||
const breakdownInvalid = computed(() => breakdownTask.value && breakdownValidation.value === false)
|
||||
/** 后端明确标记的人工审核或待审剧集不能使用成功底色。 */
|
||||
const breakdownNeedsReview = computed(
|
||||
() =>
|
||||
result.value.storyboardNeedsManualReview === true ||
|
||||
(Array.isArray(result.value.storyboardPendingQualityEpisodeNos) &&
|
||||
result.value.storyboardPendingQualityEpisodeNos.length > 0)
|
||||
)
|
||||
/** 拆解卡片区分真实成功、待修复、运行中和结果待确认。 */
|
||||
const breakdownState = computed<'success' | 'error' | 'running' | 'unknown'>(() => {
|
||||
if (props.error || props.execution?.status === 'failed') return 'error'
|
||||
if (props.execution?.status === 'pending' || props.execution?.status === 'running') return 'running'
|
||||
if (props.execution?.status !== 'completed') return 'unknown'
|
||||
if (breakdownInvalid.value || breakdownNeedsReview.value) return 'error'
|
||||
return breakdownValidation.value === true ? 'success' : 'unknown'
|
||||
})
|
||||
/** 后端提供的进度单位,避免把抽取完成误报为整个拆解完成。 */
|
||||
const progressLabel = computed(() =>
|
||||
@@ -52,11 +64,13 @@ const progressLabel = computed(() =>
|
||||
/** 后端执行终态与业务审核结果共同决定可读状态。 */
|
||||
const statusLabel = computed(() => {
|
||||
const labels = { pending: '等待开始', running: '执行中', completed: '已完成', failed: '失败' }
|
||||
return props.execution
|
||||
? props.execution.status === 'completed' && breakdownInvalid.value
|
||||
? '执行结束 · 校验未通过'
|
||||
: labels[props.execution.status]
|
||||
: ''
|
||||
if (!props.execution) return ''
|
||||
if (breakdownTask.value && props.execution.status === 'completed') {
|
||||
if (breakdownInvalid.value) return '执行结束 · 校验未通过'
|
||||
if (breakdownNeedsReview.value) return '执行结束 · 待修订'
|
||||
if (breakdownValidation.value !== true) return '执行结束 · 结果待确认'
|
||||
}
|
||||
return labels[props.execution.status]
|
||||
})
|
||||
const finished = computed(() => ['completed', 'failed'].includes(props.execution?.status ?? ''))
|
||||
/** 是否为剧本创作任务,避免使用镜头素材的提示文案。 */
|
||||
@@ -71,16 +85,24 @@ const staleMotionPlanCount = computed(() => {
|
||||
: props.execution?.metadata?.staleMotionPlan
|
||||
return typeof count === 'number' && Number.isSafeInteger(count) && count >= 0 ? count : 0
|
||||
})
|
||||
/** 视频流程结束但含过期候选时使用警告标签,不显示全成功的绿色状态。 */
|
||||
const statusType = computed(() =>
|
||||
props.execution?.status === 'completed'
|
||||
? breakdownInvalid.value || (videoQuality.value && staleMotionPlanCount.value > 0)
|
||||
/** 业务未通过或结果未知时,不把任务执行结束展示为全成功。 */
|
||||
const statusType = computed(() => {
|
||||
if (breakdownTask.value)
|
||||
return breakdownState.value === 'success'
|
||||
? 'success'
|
||||
: breakdownState.value === 'error'
|
||||
? 'error'
|
||||
: breakdownState.value === 'unknown'
|
||||
? 'default'
|
||||
: 'warning'
|
||||
return props.execution?.status === 'completed'
|
||||
? videoQuality.value && staleMotionPlanCount.value > 0
|
||||
? 'warning'
|
||||
: 'success'
|
||||
: props.execution?.status === 'failed'
|
||||
? 'error'
|
||||
: 'warning'
|
||||
)
|
||||
})
|
||||
/** 逐镜终态从运行 metadata 或完成 result 读取,不根据历史通过猜测状态。 */
|
||||
const settledItems = computed(() => {
|
||||
const settled = props.execution?.status === 'completed' ? result.value.settled : props.execution?.metadata?.settled
|
||||
@@ -152,7 +174,13 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section v-if="execution || error" class="panel mt-4 p-5" :aria-label="title">
|
||||
<section
|
||||
v-if="execution || error"
|
||||
class="panel mt-4 p-5"
|
||||
:class="{ 'breakdown-execution-card': breakdownTask }"
|
||||
:data-task-state="breakdownTask ? breakdownState : undefined"
|
||||
:aria-label="title"
|
||||
>
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -160,10 +188,10 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
<LoaderCircle v-if="!finished" :size="14" class="animate-spin text-muted" aria-hidden="true" />
|
||||
<NTag v-if="execution" size="small" :type="statusType" :bordered="false">{{ statusLabel }}</NTag>
|
||||
</div>
|
||||
<p v-if="execution" class="mt-2 text-xs text-muted">
|
||||
<p v-if="execution && !breakdownTask" class="mt-2 text-xs text-muted">
|
||||
{{ executionStageLabel(execution.stage) }} · 更新于 {{ formatDate(execution.updatedAt) }}
|
||||
</p>
|
||||
<p v-if="scopeLabel" class="mt-1 text-xs text-muted">范围:{{ scopeLabel }}</p>
|
||||
<p v-if="scopeLabel && !breakdownTask" class="mt-1 text-xs text-muted">范围:{{ scopeLabel }}</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<NButton
|
||||
@@ -179,15 +207,37 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
</div>
|
||||
|
||||
<template v-if="execution">
|
||||
<!-- 以下是拆解任务的直接可见摘要,替代折叠详情和重复进度说明 -->
|
||||
<dl v-if="breakdownTask" class="mt-4 grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<div>
|
||||
<dt class="text-xs text-muted">当前阶段</dt>
|
||||
<dd class="mt-2 text-sm">{{ executionStageLabel(execution.stage) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-xs text-muted">处理范围</dt>
|
||||
<dd class="mt-2 text-sm">{{ scopeLabel || '未提供范围' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-xs text-muted">{{ progressLabel }}</dt>
|
||||
<dd class="mt-2 text-sm">
|
||||
<template v-if="execution.total > 0">{{ execution.current }} / {{ execution.total }}</template>
|
||||
<template v-else>{{ finished ? '本次任务已结束' : '等待进度更新' }}</template>
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-xs text-muted">更新时间</dt>
|
||||
<dd class="mt-2 text-sm">{{ formatDate(execution.updatedAt) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<NProgress
|
||||
v-if="execution.total > 0"
|
||||
v-if="execution.total > 0 && (!breakdownTask || !finished)"
|
||||
type="line"
|
||||
:percentage="percentage"
|
||||
:height="5"
|
||||
:show-indicator="false"
|
||||
class="mt-4"
|
||||
/>
|
||||
<p class="mt-3 text-xs">
|
||||
<p v-if="!breakdownTask" class="mt-3 text-xs">
|
||||
<template v-if="execution.total > 0"
|
||||
>{{ progressLabel }} {{ execution.current }} / {{ execution.total }}</template
|
||||
>
|
||||
@@ -295,7 +345,7 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
}}
|
||||
</p>
|
||||
</ContextNotice>
|
||||
<details class="mt-3 text-[10px] text-muted">
|
||||
<details v-if="!breakdownTask" class="mt-3 text-[10px] text-muted">
|
||||
<summary class="cursor-pointer">任务详情</summary>
|
||||
<p class="mt-2 break-all font-mono">任务编号 · {{ execution.id }}</p>
|
||||
<!-- 以下是逐镜已结束质量任务的持久化状态模块 -->
|
||||
@@ -325,3 +375,16 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
</ContextNotice>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
/* 拆解任务与设置、候选卡片使用相同底面和内边距,终态不再展示铺满宽度的进度条。 */
|
||||
.breakdown-execution-card {
|
||||
background: var(--app-subtle);
|
||||
}
|
||||
.breakdown-execution-card[data-task-state='success'] {
|
||||
background: var(--app-success-soft);
|
||||
}
|
||||
.breakdown-execution-card[data-task-state='error'] {
|
||||
background: var(--app-danger-soft);
|
||||
}
|
||||
</style>
|
||||
+17
-5
@@ -29,6 +29,8 @@
|
||||
/* 问题和待修复区域使用浅红底色,与普通选中状态区分。 */
|
||||
--app-danger-soft: #fff1f0;
|
||||
--app-success: #087c42;
|
||||
/* 已明确通过校验的完成任务使用浅绿底色。 */
|
||||
--app-success-soft: #eaf7ee;
|
||||
}
|
||||
:root[data-theme='dark'] {
|
||||
--app-ink: #d9d9d9;
|
||||
@@ -51,6 +53,8 @@
|
||||
/* 深色主题保留柔和红色提示,避免亮色块打断页面层级。 */
|
||||
--app-danger-soft: #3a2323;
|
||||
--app-success: #5cd693;
|
||||
/* 深色主题使用柔和深绿底面表示成功,避免大块高亮。 */
|
||||
--app-success-soft: #1c3325;
|
||||
}
|
||||
html,
|
||||
body,
|
||||
@@ -82,9 +86,9 @@ body {
|
||||
.n-button.icon-button .n-button__icon {
|
||||
margin: 0;
|
||||
}
|
||||
/* 全局弹窗与章节目录抽屉共用关闭图标的尺寸、底色和悬停反馈。 */
|
||||
/* 弹窗、章节目录与公共全屏抽屉共用关闭图标的尺寸、底色和悬停反馈。 */
|
||||
.app-dialog .n-card-header__close,
|
||||
.n-drawer.reader-directory-sheet .n-drawer-content .n-drawer-header .n-drawer-header__close {
|
||||
.n-drawer:is(.reader-directory-sheet, .app-drawer) .n-drawer-content .n-drawer-header .n-drawer-header__close {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 40px;
|
||||
@@ -94,17 +98,25 @@ body {
|
||||
background: transparent;
|
||||
}
|
||||
.app-dialog .n-card-header__close .n-base-icon,
|
||||
.n-drawer.reader-directory-sheet .n-drawer-content .n-drawer-header .n-drawer-header__close .n-base-icon {
|
||||
.n-drawer:is(.reader-directory-sheet, .app-drawer)
|
||||
.n-drawer-content
|
||||
.n-drawer-header
|
||||
.n-drawer-header__close
|
||||
.n-base-icon {
|
||||
padding: 8px;
|
||||
box-sizing: content-box;
|
||||
background: var(--app-subtle);
|
||||
}
|
||||
.app-dialog .n-card-header__close:hover,
|
||||
.n-drawer.reader-directory-sheet .n-drawer-content .n-drawer-header .n-drawer-header__close:hover {
|
||||
.n-drawer:is(.reader-directory-sheet, .app-drawer) .n-drawer-content .n-drawer-header .n-drawer-header__close:hover {
|
||||
background: transparent;
|
||||
}
|
||||
.app-dialog .n-card-header__close:hover .n-base-icon,
|
||||
.n-drawer.reader-directory-sheet .n-drawer-content .n-drawer-header .n-drawer-header__close:hover .n-base-icon {
|
||||
.n-drawer:is(.reader-directory-sheet, .app-drawer)
|
||||
.n-drawer-content
|
||||
.n-drawer-header
|
||||
.n-drawer-header__close:hover
|
||||
.n-base-icon {
|
||||
background: var(--app-control-hover);
|
||||
}
|
||||
.n-button:focus-visible {
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
import { DOMWrapper, flushPromises, type VueWrapper } from '@vue/test-utils'
|
||||
import { NSelect } from 'naive-ui'
|
||||
|
||||
/** 工作区工具弹窗通过真实 Teleport 挂到 body,测试从外层读取,不禁用 Teleport 掩盖挂载问题。 */
|
||||
/**
|
||||
* 从真实 Teleport 内容读取工作区工具容器,兼容宽弹窗和全屏抽屉。
|
||||
* @returns 已打开的工具容器包装器
|
||||
*/
|
||||
export function drawerPanel() {
|
||||
const body = document.querySelector<HTMLElement>('.workspace-tools-body')
|
||||
const modal = body?.closest<HTMLElement>('.app-dialog')
|
||||
if (!modal) throw new Error('工作区工具弹窗未打开')
|
||||
const modal = body?.closest<HTMLElement>('.app-dialog, .app-drawer')
|
||||
if (!modal) throw new Error('工作区工具容器未打开')
|
||||
return new DOMWrapper(modal)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { h, ref } from 'vue'
|
||||
import { createMemoryHistory, createRouter } from 'vue-router'
|
||||
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||
import { DOMWrapper, flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { NConfigProvider, NMenu, NModal, NPopover, NScrollbar, NTooltip } from 'naive-ui'
|
||||
import { NConfigProvider, NDrawer, NMenu, NModal, NPopover, NScrollbar, NTooltip } from 'naive-ui'
|
||||
import App from '@/App.vue'
|
||||
import WorkspacePage from '@/components/ui/WorkspacePage.vue'
|
||||
import AppDialog from '@/components/ui/AppDialog.vue'
|
||||
import AppDrawer from '@/components/ui/AppDrawer.vue'
|
||||
import WorkspaceTools from '@/components/ui/WorkspaceTools.vue'
|
||||
import ProjectLayout from '@/features/projects/ProjectLayout.vue'
|
||||
import ConfirmAction from '@/features/workflows/ConfirmAction.vue'
|
||||
@@ -348,19 +349,36 @@ describe('管理后台组件边界', () => {
|
||||
expect(wrapper.get('.admin-sider-footer [aria-label="连接设置"]').text()).toBe('连接设置')
|
||||
})
|
||||
|
||||
it('长弹窗使用内部滚动,提交期间禁止遮罩和 Esc 关闭', async () => {
|
||||
wrapper = mount(AppDialog, {
|
||||
it.each([
|
||||
['弹窗', AppDialog, '.app-dialog .n-card__footer'],
|
||||
['全屏抽屉', AppDrawer, '.app-drawer .n-drawer-footer']
|
||||
] as const)('%s 默认底栏可关闭,提交期间继续锁定所有关闭入口', async (kind, component, selector) => {
|
||||
wrapper = mount(component, {
|
||||
attachTo: document.body,
|
||||
props: { open: true, title: '确认生图', description: '费用确认', busy: true },
|
||||
slots: { default: '<p>内容</p>' }
|
||||
})
|
||||
await flushPromises()
|
||||
expect(wrapper.getComponent(NModal).props()).toMatchObject({
|
||||
closable: false,
|
||||
const frame = kind === '弹窗' ? wrapper.getComponent(NModal) : wrapper.getComponent(NDrawer)
|
||||
expect(frame.props()).toMatchObject({
|
||||
maskClosable: false,
|
||||
closeOnEsc: false
|
||||
})
|
||||
expect(document.querySelector('.dialog-body-scroll .n-scrollbar-container')).not.toBeNull()
|
||||
expect(
|
||||
document.querySelector(
|
||||
kind === '弹窗' ? '.app-dialog .n-card-header__close' : '.app-drawer .n-drawer-header__close'
|
||||
)
|
||||
).toBeNull()
|
||||
const footer = document.querySelector<HTMLElement>(selector)
|
||||
expect(footer).not.toBeNull()
|
||||
const close = new DOMWrapper(footer!).get<HTMLButtonElement>('button')
|
||||
expect(close.text()).toBe('关闭')
|
||||
expect(close.element.disabled).toBe(true)
|
||||
await close.trigger('click')
|
||||
expect(wrapper.emitted('update:open')).toBeUndefined()
|
||||
await wrapper.setProps({ busy: false })
|
||||
await close.trigger('click')
|
||||
expect(wrapper.emitted('update:open')?.at(-1)).toEqual([false])
|
||||
})
|
||||
|
||||
it('操作弹窗挂载 body 并限制视口尺寸,开关保留列表与配置草稿', async () => {
|
||||
|
||||
@@ -528,7 +528,7 @@ describe('拆解页内容滚动', () => {
|
||||
await flushPromises()
|
||||
expect(drawerPanel().element.closest('.workspace-split')).toBeNull()
|
||||
await drawerPanel().get('#group-size').setValue('2')
|
||||
await drawerPanel().get('.n-card-header__close').trigger('click')
|
||||
await drawerPanel().get('.n-drawer-header__close').trigger('click')
|
||||
provided.data.value!.checkpoints = [checkpoint()]
|
||||
await flushPromises()
|
||||
expect(wrapper!.get('.breakdown-results-scroll .n-scrollbar-container').element).toBe(results)
|
||||
@@ -544,7 +544,7 @@ describe('拆解页内容滚动', () => {
|
||||
expect(fetcher).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('问题入口打开独立错误弹窗,拆解设置不再包含详细错误', async () => {
|
||||
it('问题窗口集中查看、修订和恢复,拆解设置只保留生成与候选流程', async () => {
|
||||
const record = checkpoint()
|
||||
record.state.workflowExecution!.status = 'failed'
|
||||
record.state.workflowExecution!.errorMessage = '工作流中断'
|
||||
@@ -555,21 +555,55 @@ describe('拆解页内容滚动', () => {
|
||||
mountPage([record])
|
||||
expect(wrapper!.find('.workspace-feedback').exists()).toBe(false)
|
||||
expect(wrapper!.text()).not.toContain('缺少形态绑定')
|
||||
const action = wrapper!.findAll('button').find(item => item.text() === '查看拆解问题')!
|
||||
const action = wrapper!.get('button.breakdown-desktop-issues')
|
||||
await action.trigger('click')
|
||||
await flushPromises()
|
||||
const issues = document.querySelector<HTMLElement>('.app-dialog[aria-label="拆解问题"]')
|
||||
const issues = document.querySelector<HTMLElement>('.app-drawer[aria-label="拆解问题"]')
|
||||
expect(issues?.textContent).toContain('缺少形态绑定')
|
||||
expect(issues?.textContent).toContain('工作流中断')
|
||||
expect(issues?.textContent).not.toContain('重试失败抽取')
|
||||
await new DOMWrapper(issues!).get('.n-card-header__close').trigger('click')
|
||||
expect(issues?.textContent).toContain('重试失败抽取')
|
||||
expect(issues?.textContent).toContain('读取修复清单')
|
||||
expect(issues?.textContent).not.toContain('预览分组')
|
||||
expect(issues?.textContent).not.toContain('提交候选为正式结果')
|
||||
await new DOMWrapper(issues!).get('.n-drawer-header__close').trigger('click')
|
||||
await flushPromises()
|
||||
await wrapper!.get('[data-workspace-tools]').trigger('click')
|
||||
await flushPromises()
|
||||
expect(drawerPanel().text()).not.toContain('缺少形态绑定')
|
||||
expect(drawerPanel().text()).not.toContain('工作流中断')
|
||||
expect(drawerPanel().text()).toContain('查看问题')
|
||||
expect(drawerPanel().text()).toContain('重试失败抽取')
|
||||
expect(drawerPanel().text()).toContain('预览分组')
|
||||
expect(drawerPanel().text()).not.toContain('查看问题')
|
||||
expect(drawerPanel().text()).not.toContain('重试失败抽取')
|
||||
expect(drawerPanel().text()).not.toContain('读取修复清单')
|
||||
})
|
||||
|
||||
it('问题窗口在任务执行期间仅可查看,修订与恢复继续受活动锁保护', async () => {
|
||||
const record = checkpoint()
|
||||
record.state.workflowExecution!.status = 'running'
|
||||
record.state.breakdownResult!.storyboardShotValidation = {
|
||||
valid: false,
|
||||
issues: [{ episodeNo: 1, message: '待修复问题' }]
|
||||
}
|
||||
mountPage([record])
|
||||
await wrapper!.get('button.breakdown-desktop-issues').trigger('click')
|
||||
await flushPromises()
|
||||
const issues = new DOMWrapper(document.querySelector<HTMLElement>('.app-drawer[aria-label="拆解问题"]')!)
|
||||
expect(issues.text()).toContain('待修复问题')
|
||||
for (const label of ['读取修复清单', '重试失败抽取', '补齐缺失镜头', '修复分镜绑定']) {
|
||||
const action = issues.findAll('button').find(button => button.text() === label)!
|
||||
expect((action.element as HTMLButtonElement).disabled).toBe(true)
|
||||
}
|
||||
})
|
||||
|
||||
it('质量待审核但没有结构错误时仍可进入问题窗口读取修复清单', async () => {
|
||||
const record = checkpoint()
|
||||
record.state.storyboardPendingQualityEpisodeNos = [1]
|
||||
record.state.breakdownResult!.storyboardShotValidation = { valid: true, issues: [] }
|
||||
mountPage([record])
|
||||
await wrapper!.get('button.breakdown-desktop-issues').trigger('click')
|
||||
await flushPromises()
|
||||
const issues = document.querySelector<HTMLElement>('.app-drawer[aria-label="拆解问题"]')
|
||||
expect(issues?.textContent).toContain('读取修复清单')
|
||||
})
|
||||
|
||||
it('诊断摘要与弹窗按需读取,展开结构化校验后展示证据不足', async () => {
|
||||
@@ -593,6 +627,7 @@ describe('拆解页内容滚动', () => {
|
||||
const footer = panel.get('.n-card__footer')
|
||||
expect(footer.text()).toContain('预览诊断范围')
|
||||
expect(footer.text()).toContain('启动 AI 诊断')
|
||||
expect(footer.text()).toContain('关闭')
|
||||
await panel.get('.n-collapse-item__header-main').trigger('click')
|
||||
await flushPromises()
|
||||
expect(panel.text()).toContain('有效动作证据 0 / 25 镜')
|
||||
@@ -732,9 +767,15 @@ describe('拆解页内容滚动', () => {
|
||||
qualityDialog()
|
||||
.get('.n-card__footer')
|
||||
.findAll('button')
|
||||
.filter(button => button.text() !== '关闭')
|
||||
.every(button => (button.element as HTMLButtonElement).disabled)
|
||||
).toBe(true)
|
||||
await qualityDialog().get('.n-card-header__close').trigger('click')
|
||||
const close = qualityDialog()
|
||||
.get('.n-card__footer')
|
||||
.findAll('button')
|
||||
.find(button => button.text() === '关闭')!
|
||||
expect((close.element as HTMLButtonElement).disabled).toBe(false)
|
||||
await close.trigger('click')
|
||||
await flushPromises()
|
||||
resolveFirst!(handDiagnosticsResponse(25))
|
||||
await flushPromises()
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { afterEach, describe, expect, it } from 'vitest'
|
||||
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||
import BreakdownIssuesDialog from '@/features/breakdown/components/BreakdownIssuesDialog.vue'
|
||||
import AppDialog from '@/components/ui/AppDialog.vue'
|
||||
import AppDrawer from '@/components/ui/AppDrawer.vue'
|
||||
|
||||
/** 独立问题弹窗实例,验证后移除 Teleport。 */
|
||||
/** 独立全屏问题抽屉实例,验证后移除 Teleport。 */
|
||||
let wrapper: VueWrapper | undefined
|
||||
afterEach(() => {
|
||||
wrapper?.unmount()
|
||||
document.body.innerHTML = ''
|
||||
})
|
||||
|
||||
describe('拆解问题弹窗', () => {
|
||||
it('同镜头问题合并展示并去重,定位等待弹窗离场后发出', async () => {
|
||||
describe('拆解问题抽屉', () => {
|
||||
it('同镜头问题合并展示并去重,定位等待抽屉离场后发出', async () => {
|
||||
wrapper = mount(BreakdownIssuesDialog, {
|
||||
attachTo: document.body,
|
||||
props: {
|
||||
@@ -34,7 +34,7 @@ describe('拆解问题弹窗', () => {
|
||||
button.click()
|
||||
await flushPromises()
|
||||
expect(wrapper.emitted('locate')).toBeUndefined()
|
||||
wrapper.getComponent(AppDialog).vm.$emit('closed')
|
||||
wrapper.getComponent(AppDrawer).vm.$emit('closed')
|
||||
expect(wrapper.emitted('locate')?.[0]?.[0]).toMatchObject({ episodeNo: 1, beatNo: 2, shotNo: 3 })
|
||||
})
|
||||
})
|
||||
@@ -1,7 +1,9 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { flushPromises, mount, type VueWrapper } from '@vue/test-utils'
|
||||
import { policyDraft, policyIssue } from '@/features/projects/quality-policy'
|
||||
import { projectsApi } from '@/features/projects/api'
|
||||
import type { ProjectQualityPolicy } from '@/features/projects/types'
|
||||
import QualityPolicySettings from '@/features/generation-config/components/QualityPolicySettings.vue'
|
||||
|
||||
/** 保留已有精确例外的服务端完整策略。 */
|
||||
const saved: ProjectQualityPolicy = {
|
||||
@@ -15,8 +17,73 @@ const saved: ProjectQualityPolicy = {
|
||||
{ code: 'action_resource_conflict', ownerRef: '@人物', resource: 'left_hand', reason: '明确依据' }
|
||||
]
|
||||
}
|
||||
afterEach(() => vi.unstubAllGlobals())
|
||||
/** 真实策略表单实例,验证结束后移除组件与事件监听。 */
|
||||
let settings: VueWrapper | undefined
|
||||
afterEach(() => {
|
||||
settings?.unmount()
|
||||
settings = undefined
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
describe('项目质量策略', () => {
|
||||
it('进入和新增例外不立即报错,保存时拦截缺失字段,修正后才写入', async () => {
|
||||
const fetcher = vi.fn<typeof fetch>().mockImplementation(
|
||||
async (_url, init) =>
|
||||
new Response(
|
||||
JSON.stringify({
|
||||
data: {
|
||||
projectId: 'p',
|
||||
policy:
|
||||
init?.method === 'PUT'
|
||||
? JSON.parse(String(init.body))
|
||||
: { ...saved, actionExceptions: [] }
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
vi.stubGlobal('fetch', fetcher)
|
||||
const wrapper = mount(QualityPolicySettings, { props: { projectId: 'p', disabled: false } })
|
||||
settings = wrapper
|
||||
await flushPromises()
|
||||
expect(wrapper.find('.text-danger').exists()).toBe(false)
|
||||
await wrapper
|
||||
.findAll('button')
|
||||
.find(button => button.text() === '添加例外')!
|
||||
.trigger('click')
|
||||
expect(wrapper.text()).not.toContain('精确例外需填写')
|
||||
expect(wrapper.vm.canSave).toBe(true)
|
||||
|
||||
await wrapper.vm.save()
|
||||
expect(wrapper.text()).toContain('精确例外需填写')
|
||||
expect(fetcher.mock.calls.filter(([, init]) => init?.method === 'PUT')).toHaveLength(0)
|
||||
await wrapper.get('[aria-label="例外 1 主体引用"] input').setValue('@CH0001')
|
||||
expect(wrapper.text()).not.toContain('精确例外需填写')
|
||||
await wrapper.vm.save()
|
||||
expect(wrapper.text()).toContain('精确例外需填写')
|
||||
expect(fetcher.mock.calls.filter(([, init]) => init?.method === 'PUT')).toHaveLength(0)
|
||||
|
||||
await wrapper.get('[aria-label="例外 1 确认依据"] input').setValue('剧本明确的动作许可')
|
||||
await wrapper.vm.save()
|
||||
await flushPromises()
|
||||
const writes = fetcher.mock.calls.filter(([, init]) => init?.method === 'PUT')
|
||||
expect(writes).toHaveLength(1)
|
||||
expect(JSON.parse(String(writes[0]?.[1]?.body))).toEqual({
|
||||
version: 1,
|
||||
physicsMode: 'realistic',
|
||||
allowExaggeratedMotion: false,
|
||||
allowNonPhysicalActions: false,
|
||||
allowSupernaturalAbilities: false,
|
||||
customRules: ['规则'],
|
||||
actionExceptions: [
|
||||
{
|
||||
code: 'action_resource_conflict',
|
||||
ownerRef: '@CH0001',
|
||||
resource: 'left_hand',
|
||||
reason: '剧本明确的动作许可'
|
||||
}
|
||||
]
|
||||
})
|
||||
expect(wrapper.text()).toContain('质量策略已保存')
|
||||
})
|
||||
it('草稿编辑不污染已保存策略,完整保留精确例外', () => {
|
||||
const draft = policyDraft(saved)
|
||||
draft.actionExceptions![0]!.reason = '新依据'
|
||||
|
||||
@@ -45,11 +45,36 @@ describe('WorkflowExecution 前端契约', () => {
|
||||
error: ''
|
||||
}
|
||||
})
|
||||
expect(wrapper.text()).toContain('抽取任务 3 / 3')
|
||||
expect(wrapper.text().replace(/\s/g, '')).toContain('抽取任务3/3')
|
||||
expect(wrapper.text()).toContain('校验未通过')
|
||||
expect(wrapper.get('section').attributes('data-task-state')).toBe('error')
|
||||
expect(wrapper.find('details').exists()).toBe(false)
|
||||
expect(wrapper.text()).not.toContain('最新镜头资产状态')
|
||||
wrapper.unmount()
|
||||
})
|
||||
it.each([
|
||||
{ result: { storyboardShotValidation: { valid: true, issues: [] } }, state: 'success', label: '已完成' },
|
||||
{ result: null, state: 'unknown', label: '结果待确认' },
|
||||
{
|
||||
result: { storyboardShotValidation: { valid: true, issues: [] }, storyboardPendingQualityEpisodeNos: [1] },
|
||||
state: 'error',
|
||||
label: '待修订'
|
||||
}
|
||||
])('拆解终态仅在明确通过校验且没有待修订剧集时显示成功底色:$state', ({ result, state, label }) => {
|
||||
const wrapper = mount(WorkflowExecutionPanel, {
|
||||
props: {
|
||||
execution: execution({ workflowName: 'breakdown', status: 'completed', result }),
|
||||
loading: false,
|
||||
error: '',
|
||||
showStatusHint: false
|
||||
}
|
||||
})
|
||||
expect(wrapper.get('section').attributes('data-task-state')).toBe(state)
|
||||
expect(wrapper.text()).toContain(label)
|
||||
expect(wrapper.find('details').exists()).toBe(false)
|
||||
expect(wrapper.text()).toContain('更新时间')
|
||||
wrapper.unmount()
|
||||
})
|
||||
it('保留未知阶段并限制真实进度范围', () => {
|
||||
expect(executionStageLabel('repairing')).toBe('自动修复')
|
||||
expect(executionStageLabel('new_backend_stage')).toBe('new_backend_stage')
|
||||
|
||||
Reference in new issue
Block a user