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
@@ -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>
|
||||
Reference in new issue
Block a user