693 lines
37 KiB
Vue
693 lines
37 KiB
Vue
<script setup lang="ts">
|
||
import AppForm from '../../components/ui/AppForm.vue'
|
||
import { NFormItem } from 'naive-ui'
|
||
import { integerRule, fieldRule } from '../../lib/form-rules'
|
||
import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||
import ActionMenu from '../../components/ui/ActionMenu.vue'
|
||
import { NScrollbar, NAlert, NButton, NCheckbox, NInputNumber, NProgress, NTab, NTable, NTabs, NTag } from 'naive-ui'
|
||
import { computed, onScopeDispose, ref, watch } from 'vue'
|
||
import { Layers, LoaderCircle, ArrowRight } from '@lucide/vue'
|
||
import { EmptyState, StatusBadge, WorkspaceTools } from '../../components/ui'
|
||
import { useProjectContext } from '../projects/context'
|
||
import { breakdownApi } from './api'
|
||
import type { BreakdownAction, BreakdownInput, BreakdownModule, BreakdownPreview } from './types'
|
||
import { breakdownSnapshot, recoveryOptions, workflowCheckpoints } from '../workflows/selectors'
|
||
import { getOperation, runOperation } from '../workflows/operations'
|
||
import ConfirmAction from '../workflows/ConfirmAction.vue'
|
||
import HistoryPanel from '../workflows/HistoryPanel.vue'
|
||
import WorkflowExecutionPanel from '../workflows/WorkflowExecutionPanel.vue'
|
||
import { useWorkflowExecution } from '../workflows/execution'
|
||
import SubjectList from './components/SubjectList.vue'
|
||
import StoryboardList from './components/StoryboardList.vue'
|
||
import { errorMessage } from '../../lib/http'
|
||
import { downloadText, nodeLabel } from '../../lib/format'
|
||
|
||
/** 拆解工作区:先预览真实分组,再启动;恢复操作根据 checkpoint 分阶段展示。 */
|
||
const { project, checkpoints, refresh, refreshStageReadiness, stageReadiness, error } = useProjectContext()
|
||
const groupSize = ref(3)
|
||
const modules = ref<BreakdownModule[]>(['character', 'scene', 'prop'])
|
||
const preview = ref<BreakdownPreview | null>(null)
|
||
const previewBusy = ref(false)
|
||
const previewError = ref('')
|
||
const tab = ref('character')
|
||
const toolsOpen = ref(false)
|
||
const showHistory = ref(false)
|
||
const moduleOptions: { value: BreakdownModule; label: string; description: string }[] = [
|
||
{ value: 'character', label: '人物', description: '人物身份、外观与形态' },
|
||
{ value: 'scene', label: '场景', description: '故事空间与环境特征' },
|
||
{ value: 'prop', label: '道具', description: '关键物件与视觉描述' }
|
||
]
|
||
const records = computed(() => workflowCheckpoints(checkpoints.value, 'breakdown'))
|
||
const snapshot = computed(() => breakdownSnapshot(checkpoints.value))
|
||
const result = computed(() => snapshot.value?.breakdownResult ?? snapshot.value)
|
||
const subjects = computed(() => result.value?.subjectCandidates ?? [])
|
||
const forms = computed(() => result.value?.subjectForms ?? [])
|
||
const plans = computed(() => result.value?.storyboardPlans ?? [])
|
||
const shots = computed(() => result.value?.storyboardEpisodeShots ?? [])
|
||
const summary = computed(() => snapshot.value?.taskSummary)
|
||
const validation = computed(() => result.value?.storyboardShotValidation ?? snapshot.value?.storyboardShotValidation)
|
||
const projectId = computed(() => project.value?.id ?? '')
|
||
const operation = computed(() => getOperation(projectId.value))
|
||
const backgroundExecution = useWorkflowExecution(projectId, 'breakdown')
|
||
const recovery = computed(() => recoveryOptions(checkpoints.value))
|
||
const execution = computed(() => snapshot.value?.workflowExecution)
|
||
const taskStopped = computed(() => execution.value?.status === 'failed' || execution.value?.status === 'completed')
|
||
/** 后台拆解结束后自动刷新项目、Checkpoint 与正式主体/分镜数据。 */
|
||
watch(
|
||
() => backgroundExecution.query.data.value?.status,
|
||
(status, previous) => {
|
||
if ((status === 'completed' || status === 'failed') && status !== previous)
|
||
void Promise.all([refresh(), refreshStageReadiness()])
|
||
}
|
||
)
|
||
const showRecovery = computed(
|
||
() => records.value.length > 0 && (execution.value?.status !== 'completed' || validation.value?.valid === false)
|
||
)
|
||
const configValid = computed(
|
||
() => Number.isSafeInteger(groupSize.value) && groupSize.value > 0 && modules.value.length > 0
|
||
)
|
||
const input = computed<BreakdownInput>(() => ({ groupSize: groupSize.value, modules: [...modules.value] }))
|
||
const stageComplete = computed(() => stageReadiness.value?.breakdown.ready === true)
|
||
const canStart = computed(
|
||
() =>
|
||
!!project.value?.episodes.length &&
|
||
project.value.status === 'completed' &&
|
||
!!preview.value &&
|
||
configValid.value &&
|
||
!operation.value.pending &&
|
||
!backgroundExecution.active.value &&
|
||
!error.value &&
|
||
(!records.value.length || taskStopped.value)
|
||
)
|
||
let previewController: AbortController | undefined
|
||
let previewVersion = 0
|
||
|
||
/** 输入变化立即废弃旧预览,防止按新配置启动旧的任务清单。 */
|
||
function invalidatePreview() {
|
||
previewVersion++
|
||
previewController?.abort()
|
||
preview.value = null
|
||
previewBusy.value = false
|
||
previewError.value = ''
|
||
}
|
||
watch(
|
||
[
|
||
groupSize,
|
||
() => modules.value.join(','),
|
||
() => project.value?.episodes.map(item => item.episode + ':' + item.content).join('|')
|
||
],
|
||
invalidatePreview
|
||
)
|
||
onScopeDispose(invalidatePreview)
|
||
|
||
/** 只接受明确勾选状态,不把不确定值作为模块选择。 */
|
||
function toggleModule(module: BreakdownModule, checked: boolean | 'indeterminate') {
|
||
if (checked === true && !modules.value.includes(module)) modules.value.push(module)
|
||
else modules.value = modules.value.filter(item => item !== module)
|
||
}
|
||
|
||
/** 获取服务器生成的任务分组,不在浏览器伪造任务 ID。 */
|
||
async function loadPreview() {
|
||
if (!configValid.value || project.value?.status !== 'completed' || previewBusy.value) return
|
||
invalidatePreview()
|
||
const version = previewVersion
|
||
previewController = new AbortController()
|
||
previewBusy.value = true
|
||
try {
|
||
const data = await breakdownApi.preview(project.value.id, input.value, previewController.signal)
|
||
if (version === previewVersion) preview.value = data
|
||
} catch (cause) {
|
||
if (version === previewVersion) previewError.value = errorMessage(cause)
|
||
} finally {
|
||
if (version === previewVersion) previewBusy.value = false
|
||
}
|
||
}
|
||
|
||
/** 长请求不随路由切换取消,返回后刷新 checkpoint 与正式项目数据。 */
|
||
async function run(action: BreakdownAction) {
|
||
if (project.value?.status !== 'completed' || operation.value.pending || error.value) return
|
||
if (action === 'start' && !canStart.value) return
|
||
const labels: Record<BreakdownAction, string> = {
|
||
start: '正在拆解剧本',
|
||
retry: '正在重试失败抽取',
|
||
'resume-shots': '正在补齐镜头',
|
||
'resume-storyboard': '正在修复分镜绑定'
|
||
}
|
||
const id = project.value.id
|
||
await runOperation(id, labels[action], async () => {
|
||
const started = await breakdownApi.run(id, action, action === 'start' ? input.value : undefined)
|
||
await backgroundExecution.track(started.executionId)
|
||
return started
|
||
})
|
||
await refresh()
|
||
}
|
||
|
||
/** 导出当前拆解结果;阶段性数据也明确标记为 snapshot。 */
|
||
function exportResult() {
|
||
if (!snapshot.value) return
|
||
downloadText(
|
||
`breakdown-${project.value?.id}-snapshot.json`,
|
||
JSON.stringify(snapshot.value, null, 2),
|
||
'application/json'
|
||
)
|
||
}
|
||
const formModel = computed(() => ({ groupSize: groupSize.value, modules: modules.value }))
|
||
const rules = {
|
||
groupSize: integerRule('每组集数'),
|
||
modules: fieldRule(value => Array.isArray(value) && value.length > 0, '请至少选择一个抽取模块', true)
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<NAlert v-if="stageComplete" type="success" :show-icon="false" class="mb-3">\n 剧本拆解已经准备完成,人物、场景、道具和正式镜头都可以进入后续制作。\n <RouterLink :to="`/projects/${projectId}/visual-style`" class="text-button ml-2">继续视觉风格 →</RouterLink>\n </NAlert>\n <WorkspacePage split compact class="breakdown-workspace-page">
|
||
<template #header>
|
||
<!-- 以下是拆解状态与设置 -->
|
||
<div class="workspace-toolbar">
|
||
<h2 class="font-semibold">剧本拆解</h2>
|
||
<div v-if="snapshot" class="toolbar-summary">
|
||
<span v-if="summary"
|
||
>抽取 {{ summary.completed }} / {{ summary.total }} · 失败 {{ summary.failed }}</span
|
||
>
|
||
<span>主体 {{ subjects.length }} · 分镜剧集 {{ shots.length }} / {{ plans.length }}</span>
|
||
<StatusBadge
|
||
:status="execution?.status || 'unknown'"
|
||
:label="
|
||
execution?.status === 'completed'
|
||
? '工作流已完成'
|
||
: execution?.status === 'failed'
|
||
? '工作流失败'
|
||
: '执行状态待确认'
|
||
"
|
||
/>
|
||
</div>
|
||
<div v-if="project?.episodes.length" class="toolbar-actions">
|
||
<WorkspaceTools v-model:open="toolsOpen" title="拆解设置与恢复" label="拆解设置与恢复">
|
||
<section class="panel breakdown-settings-panel p-5 lg:p-6">
|
||
<div class="mb-5 flex flex-wrap items-start justify-between gap-3">
|
||
<div>
|
||
<h2 class="flex items-center gap-2 font-semibold"><Layers :size="17" />拆解设置</h2>
|
||
<p class="mt-2 text-xs leading-5 text-muted">
|
||
读取已保存的
|
||
{{ project.episodes.length }}
|
||
集剧本。每个分组分别抽取所选模块,再生成主体与分镜。
|
||
</p>
|
||
</div>
|
||
<NTag size="small" :bordered="false">来源:正式剧集</NTag>
|
||
</div>
|
||
<AppForm
|
||
:model="formModel"
|
||
:rules="rules"
|
||
:disabled="operation.pending"
|
||
validate-on-change
|
||
@submit="loadPreview"
|
||
>
|
||
<div class="breakdown-config">
|
||
<NFormItem
|
||
class="breakdown-group-field"
|
||
path="groupSize"
|
||
label="每组集数"
|
||
:label-props="{ for: 'group-size' }"
|
||
>
|
||
<div class="breakdown-group-input">
|
||
<NInputNumber
|
||
:disabled="operation.pending"
|
||
:input-props="{ id: 'group-size' }"
|
||
class="breakdown-group-number"
|
||
:value="typeof groupSize === 'number' ? groupSize : null"
|
||
@update:value="groupSize = $event ?? 0"
|
||
:min="1"
|
||
:step="1"
|
||
></NInputNumber
|
||
><span class="breakdown-group-unit">集 / 组</span>
|
||
</div>
|
||
</NFormItem>
|
||
<NFormItem path="modules" label="抽取模块" class="breakdown-modules-field">
|
||
<div class="breakdown-module-options">
|
||
<div
|
||
v-for="option in moduleOptions"
|
||
:key="option.value"
|
||
class="breakdown-module-option"
|
||
>
|
||
<NCheckbox
|
||
:checked="modules.includes(option.value)"
|
||
:disabled="operation.pending"
|
||
:aria-label="option.label"
|
||
:aria-describedby="`breakdown-module-${option.value}-help`"
|
||
@update:checked="toggleModule(option.value, $event)"
|
||
class="control-row-checkbox"
|
||
><span class="text-sm font-medium">{{
|
||
option.label
|
||
}}</span></NCheckbox
|
||
>
|
||
<p
|
||
:id="`breakdown-module-${option.value}-help`"
|
||
class="breakdown-module-description"
|
||
>
|
||
{{ option.description }}
|
||
</p>
|
||
</div>
|
||
</div>
|
||
</NFormItem>
|
||
<NButton
|
||
:disabled="
|
||
project?.status !== 'completed' ||
|
||
previewBusy ||
|
||
operation.pending ||
|
||
!!error
|
||
"
|
||
attr-type="submit"
|
||
class="breakdown-preview-button"
|
||
><LoaderCircle v-if="previewBusy" :size="14" class="animate-spin" />预览分组
|
||
</NButton>
|
||
</div>
|
||
</AppForm>
|
||
<NAlert v-if="previewError" role="alert" type="error" :show-icon="false" class="mt-4">{{
|
||
previewError
|
||
}}</NAlert>
|
||
<div v-if="preview" class="group-preview">
|
||
<div class="mb-4 flex flex-wrap items-center justify-between gap-3">
|
||
<p class="text-sm">
|
||
<strong>{{ preview.groupCount }}</strong> 个分组
|
||
<span class="mx-2 text-faint">/</span>
|
||
<strong>{{ preview.estimatedTaskCount }}</strong> 个抽取任务
|
||
</p>
|
||
<ConfirmAction
|
||
:label="records.length ? '重新拆解' : '开始拆解'"
|
||
:description="
|
||
records.length
|
||
? '这会重新运行整个 Breakdown,可能替换已保存的主体与分镜。只想恢复失败阶段时,请使用下方对应恢复操作。'
|
||
: '将按当前预览配置启动完整的 Breakdown 工作流。抽取结束后仍需完成主体整理、分镜生成与入库。'
|
||
"
|
||
:acknowledgement="records.length > 0"
|
||
primary
|
||
:disabled="!canStart"
|
||
@confirm="run('start')"
|
||
/>
|
||
</div>
|
||
<div class="flex flex-wrap gap-2">
|
||
<div v-for="group in preview.groups" :key="group.groupId" class="group-chip">
|
||
<span class="text-muted">{{ String(group.groupNo).padStart(2, '0') }}</span
|
||
><span>第 {{ group.startEpisodeNo }}–{{ group.endEpisodeNo }} 集</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p v-if="project.status === 'generating'" class="mt-4 text-xs text-danger">
|
||
剧本仍在生成,暂不允许启动拆解,避免读取到不完整的剧集。
|
||
</p>
|
||
<p v-if="records.length && !taskStopped" class="mt-4 text-xs leading-5 text-muted">
|
||
当前任务还没有明确的完成或失败记录。为避免重复执行,已暂停重新拆解;如任务已中断,请先刷新状态,再选择对应恢复操作。
|
||
</p>
|
||
</section>
|
||
<WorkflowExecutionPanel
|
||
v-if="backgroundExecution.executionId.value"
|
||
title="剧本拆解任务"
|
||
:execution="backgroundExecution.query.data.value"
|
||
:loading="backgroundExecution.query.loading.value"
|
||
:error="backgroundExecution.query.error.value"
|
||
@refresh="backgroundExecution.query.refresh"
|
||
@dismiss="backgroundExecution.dismiss"
|
||
/>
|
||
<section v-if="snapshot" class="mt-5">
|
||
<div class="mb-3 flex flex-wrap items-center justify-between gap-3">
|
||
<h2 class="text-sm font-medium">
|
||
最近可用拆解快照
|
||
<span class="ml-2 text-xs font-normal text-muted">{{
|
||
nodeLabel(records.at(-1)?.metadata?.nodeName)
|
||
}}</span>
|
||
</h2>
|
||
<StatusBadge
|
||
:status="execution?.status || 'unknown'"
|
||
:label="
|
||
execution?.status === 'completed'
|
||
? '工作流已完成'
|
||
: execution?.status === 'failed'
|
||
? '工作流失败'
|
||
: '阶段快照 · 执行状态待确认'
|
||
"
|
||
/>
|
||
</div>
|
||
<div v-if="summary" class="flex flex-wrap items-center gap-x-6 gap-y-2 text-xs text-muted">
|
||
<span
|
||
>抽取完成
|
||
<strong class="text-ink"
|
||
>{{ summary.completed }} / {{ summary.total }}</strong
|
||
></span
|
||
><span>失败 {{ summary.failed }}</span
|
||
><span>主体 {{ subjects.length }}</span
|
||
><span>分镜剧集 {{ shots.length }} / {{ plans.length }}</span>
|
||
</div>
|
||
<NProgress
|
||
v-if="summary?.total"
|
||
aria-label="已完成抽取任务"
|
||
type="line"
|
||
:show-indicator="false"
|
||
:height="4"
|
||
:percentage="
|
||
Math.min(100, Math.max(0, (summary.completed / Math.max(1, summary.total)) * 100))
|
||
"
|
||
class="mt-3"
|
||
></NProgress>
|
||
<NAlert
|
||
v-if="execution?.errorMessage"
|
||
role="alert"
|
||
type="error"
|
||
:show-icon="false"
|
||
class="mt-4"
|
||
>{{ execution.errorMessage }}</NAlert
|
||
>
|
||
<NAlert v-if="validation && !validation.valid" type="error" :show-icon="false" class="mt-4"
|
||
><p class="font-medium">分镜校验未通过</p>
|
||
<ul class="mt-2 list-inside list-disc space-y-1">
|
||
<li v-for="(issue, index) in validation.issues" :key="index">
|
||
第 {{ issue.episodeNo }} 集<span v-if="issue.beatNo">
|
||
/ Beat {{ issue.beatNo }}</span
|
||
><span v-if="issue.shotNo"> / Shot {{ issue.shotNo }}</span
|
||
>:{{ issue.message }}
|
||
</li>
|
||
</ul></NAlert
|
||
>
|
||
<div v-if="showRecovery" class="recovery-strip mt-4">
|
||
<div>
|
||
<p class="text-sm font-medium">从中断处继续</p>
|
||
<p class="mt-1 text-xs leading-5 text-muted">
|
||
抽取失败、镜头缺失、主体绑定异常分别处理。禁用表示近期 checkpoint
|
||
不具备所需数据。
|
||
</p>
|
||
</div>
|
||
<div class="flex flex-wrap gap-2">
|
||
<ConfirmAction
|
||
label="重试失败抽取"
|
||
description="只重试 character / scene / prop 抽取任务中的失败项。不能用于镜头阶段失败。"
|
||
acknowledgement
|
||
:disabled="
|
||
project?.status !== 'completed' ||
|
||
!recovery.retry ||
|
||
operation.pending ||
|
||
!!error
|
||
"
|
||
@confirm="run('retry')"
|
||
/><ConfirmAction
|
||
label="补齐缺失镜头"
|
||
description="复用已完成剧集的镜头,仅生成尚未完成的 Episode Shot,再进行校验与入库。"
|
||
acknowledgement
|
||
:disabled="
|
||
project?.status !== 'completed' ||
|
||
!recovery.shots ||
|
||
operation.pending ||
|
||
!!error
|
||
"
|
||
@confirm="run('resume-shots')"
|
||
/><ConfirmAction
|
||
label="修复分镜绑定"
|
||
description="复用已有镜头,修复 SubjectRef 与视觉 Form 绑定,再校验并保存。"
|
||
acknowledgement
|
||
:disabled="
|
||
project?.status !== 'completed' ||
|
||
!recovery.storyboard ||
|
||
operation.pending ||
|
||
!!error
|
||
"
|
||
@confirm="run('resume-storyboard')"
|
||
/>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
</WorkspaceTools>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
<NScrollbar v-if="!project?.episodes.length" class="panel-scroll panel">
|
||
<EmptyState
|
||
title="还没有可拆解的剧集"
|
||
description="先完成剧本创作。拆解会读取数据库中的正式剧集,不需要上传 checkpoint。"
|
||
><RouterLink class="button button-primary" :to="`/projects/${project?.id}/create-drama`"
|
||
>前往剧本创作<ArrowRight :size="14" /></RouterLink
|
||
></EmptyState>
|
||
</NScrollbar>
|
||
<template v-else>
|
||
<NScrollbar v-if="execution?.errorMessage || (validation && !validation.valid)" class="workspace-feedback">
|
||
<NAlert v-if="execution?.errorMessage" role="alert" type="error" :show-icon="false">{{
|
||
execution.errorMessage
|
||
}}</NAlert>
|
||
<NAlert v-if="validation && !validation.valid" role="alert" type="error" :show-icon="false">
|
||
分镜校验未通过,共 {{ validation.issues.length }} 项问题。
|
||
<NButton text @click="toolsOpen = true">查看详情与恢复操作</NButton>
|
||
</NAlert>
|
||
</NScrollbar>
|
||
<section class="breakdown-results-section">
|
||
<div class="result-toolbar tabs-toolbar">
|
||
<NTabs v-model:value="tab" class="workspace-tabs" type="line" size="small" aria-label="拆解结果"
|
||
><NTab v-for="option in moduleOptions" :key="option.value" :name="option.value"
|
||
>{{ option.label
|
||
}}<span>{{ subjects.filter(item => item.module === option.value).length }}</span></NTab
|
||
><NTab name="storyboard">分镜</NTab><NTab name="tasks">任务明细</NTab>
|
||
<template #suffix
|
||
><div class="tabs-toolbar-actions">
|
||
<ActionMenu
|
||
label="拆解更多操作"
|
||
:items="[
|
||
{ key: 'history', label: showHistory ? '收起执行记录' : '执行记录' },
|
||
{ key: 'export', label: '导出 JSON', disabled: !snapshot }
|
||
]"
|
||
@select="$event === 'history' ? (showHistory = !showHistory) : exportResult()"
|
||
/></div
|
||
></template>
|
||
</NTabs>
|
||
</div>
|
||
<div class="content-with-history panel" :class="{ 'history-hidden': !showHistory }">
|
||
<main class="min-w-0">
|
||
<!-- 所有结果标签共用有界的内容滚动;切换标签回到顶部,不继承上一列表的位置。 -->
|
||
<NScrollbar :key="tab" class="panel-scroll breakdown-results-scroll">
|
||
<template v-for="option in moduleOptions" :key="option.value"
|
||
><div v-if="tab === option.value" class="breakdown-result-pad">
|
||
<SubjectList
|
||
:project-id="project?.id"
|
||
:subjects="subjects.filter(item => item.module === option.value)"
|
||
:forms="forms"
|
||
/></div
|
||
></template>
|
||
<div v-if="tab === 'storyboard'" class="breakdown-result-pad">
|
||
<StoryboardList :plans="plans" :episodes="shots">
|
||
<template #actions>
|
||
<RouterLink :to="`/projects/${project?.id}/storyboard`" class="text-button"
|
||
>进入分镜设计<ArrowRight :size="14"
|
||
/></RouterLink>
|
||
</template>
|
||
</StoryboardList>
|
||
</div>
|
||
<div v-if="tab === 'tasks'" class="breakdown-result-pad">
|
||
<NScrollbar x-scrollable v-if="snapshot?.tasks?.length" class="table-scroll">
|
||
<NTable :bordered="false" :single-line="true" striped class="project-table"
|
||
><thead>
|
||
<tr>
|
||
<th>分组</th>
|
||
<th>模块</th>
|
||
<th>状态</th>
|
||
<th>尝试</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<template v-for="task in snapshot.tasks" :key="task.taskId"
|
||
><tr>
|
||
<td>
|
||
第 {{ task.group.startEpisodeNo }}–{{ task.group.endEpisodeNo }}
|
||
集
|
||
</td>
|
||
<td>
|
||
{{
|
||
moduleOptions.find(item => item.value === task.module)
|
||
?.label
|
||
}}
|
||
</td>
|
||
<td>
|
||
<StatusBadge
|
||
:status="task.status"
|
||
:label="
|
||
{
|
||
pending: '等待中',
|
||
running: '执行中',
|
||
completed: '完成',
|
||
failed: '失败'
|
||
}[task.status]
|
||
"
|
||
/>
|
||
</td>
|
||
<td>{{ task.attempt }}</td>
|
||
</tr>
|
||
<tr v-if="task.errorMessage">
|
||
<td colspan="4" class="text-danger">{{ task.errorMessage }}</td>
|
||
</tr></template
|
||
>
|
||
</tbody></NTable
|
||
>
|
||
</NScrollbar>
|
||
<EmptyState
|
||
v-else
|
||
title="尚无抽取任务记录"
|
||
description="启动拆解后会持续保存进度;预览只展示本次处理范围,不会直接开始执行。"
|
||
/>
|
||
</div>
|
||
</NScrollbar>
|
||
</main>
|
||
<HistoryPanel
|
||
v-if="showHistory"
|
||
:project-id="project?.id"
|
||
:checkpoints="checkpoints"
|
||
workflow="breakdown"
|
||
@close="showHistory = false"
|
||
/>
|
||
</div>
|
||
</section>
|
||
</template>
|
||
</WorkspacePage>
|
||
</template>
|
||
|
||
<style>
|
||
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
||
@reference "../../styles/styles.css";
|
||
.group-preview {
|
||
@apply mt-6 pt-5;
|
||
}
|
||
.group-chip {
|
||
@apply flex items-center gap-2.5 bg-(--app-subtle) rounded-none py-2 px-[11px] text-[11px];
|
||
}
|
||
.recovery-strip {
|
||
@apply bg-(--app-subtle) flex justify-between flex-wrap items-center gap-[15px] p-[17px] rounded-none;
|
||
}
|
||
.breakdown-settings-panel {
|
||
container: breakdown-settings / inline-size;
|
||
}
|
||
.breakdown-config {
|
||
@apply grid grid-cols-[180px_minmax(0,_1fr)_auto] items-start gap-y-4 gap-x-6;
|
||
--breakdown-label-offset: 29px;
|
||
}
|
||
.breakdown-group-field,
|
||
.breakdown-modules-field,
|
||
.breakdown-module-option {
|
||
@apply min-w-0;
|
||
}
|
||
.breakdown-group-input {
|
||
@apply w-full flex items-center gap-3;
|
||
}
|
||
.breakdown-group-number.n-input-number {
|
||
@apply flex-[0_0_120px] w-[120px];
|
||
}
|
||
.breakdown-group-unit {
|
||
@apply shrink-0 whitespace-nowrap text-muted text-sm;
|
||
}
|
||
.breakdown-modules-field {
|
||
@apply m-0 p-0 border-0;
|
||
}
|
||
.breakdown-module-options {
|
||
@apply w-full grid grid-cols-[repeat(3,_minmax(0,_1fr))] gap-y-3 gap-x-4;
|
||
}
|
||
.breakdown-module-description {
|
||
@apply mt-1 mx-0 mb-0 pl-6 text-muted text-[11px] leading-[18px] wrap-anywhere;
|
||
}
|
||
.breakdown-preview-button.n-button {
|
||
@apply self-start mt-[var(--breakdown-label-offset)] whitespace-nowrap;
|
||
}
|
||
@container breakdown-settings (max-width: 780px) {
|
||
.breakdown-config {
|
||
@apply grid-cols-[180px_minmax(0,_1fr)];
|
||
}
|
||
.breakdown-preview-button.n-button {
|
||
@apply col-[2] justify-self-end mt-0;
|
||
}
|
||
}
|
||
@container breakdown-settings (max-width: 560px) {
|
||
.breakdown-config {
|
||
@apply grid-cols-[minmax(0,_1fr)];
|
||
}
|
||
.breakdown-module-options {
|
||
@apply grid-cols-[repeat(auto-fit,_minmax(min(100%,_160px),_1fr))];
|
||
}
|
||
.breakdown-preview-button.n-button {
|
||
@apply col-[1];
|
||
}
|
||
}
|
||
.result-toolbar .n-tabs-tab__label {
|
||
@apply inline-flex gap-1.5;
|
||
}
|
||
.breakdown-results-section {
|
||
@apply flex flex-col flex-1 min-h-0 min-w-0 gap-2;
|
||
}
|
||
.breakdown-results-section > .result-toolbar {
|
||
@apply shrink-0;
|
||
}
|
||
.breakdown-results-section > .content-with-history {
|
||
@apply flex-1 h-auto min-h-0 grid-rows-[minmax(0,_1fr)];
|
||
}
|
||
.breakdown-results-scroll .n-scrollbar-content {
|
||
@apply wrap-anywhere;
|
||
}
|
||
.breakdown-result-pad {
|
||
@apply p-4;
|
||
}
|
||
.breakdown-results-section > .content-with-history.history-hidden {
|
||
@apply grid-cols-[minmax(0,_1fr)] grid-rows-[minmax(0,_1fr)];
|
||
}
|
||
@media (max-width: 800px) {
|
||
.breakdown-workspace-page .workspace-heading {
|
||
@apply py-2 px-3;
|
||
}
|
||
.breakdown-workspace-page .workspace-toolbar {
|
||
@apply min-h-0 flex-nowrap gap-2;
|
||
}
|
||
.breakdown-workspace-page .workspace-toolbar h2 {
|
||
@apply hidden;
|
||
}
|
||
.breakdown-workspace-page .toolbar-summary {
|
||
@apply min-w-0 flex-1 flex-nowrap overflow-x-auto overflow-y-hidden overscroll-x-contain;
|
||
scrollbar-width: none;
|
||
mask-image: linear-gradient(to right, #000 calc(100% - 12px), transparent);
|
||
}
|
||
.breakdown-workspace-page .toolbar-summary::-webkit-scrollbar {
|
||
display: none;
|
||
}
|
||
.breakdown-workspace-page .toolbar-summary > * {
|
||
@apply shrink-0;
|
||
}
|
||
.breakdown-workspace-page .toolbar-actions {
|
||
@apply ml-0 shrink-0;
|
||
}
|
||
.breakdown-workspace-page .toolbar-actions > * {
|
||
@apply shrink-0;
|
||
}
|
||
.breakdown-workspace-page .workspace-tools-label {
|
||
@apply hidden;
|
||
}
|
||
.breakdown-workspace-page .workspace-tools-trigger {
|
||
@apply h-8 w-8 p-0;
|
||
min-width: 32px;
|
||
}
|
||
.breakdown-workspace-page .workspace-tools-trigger .n-button__icon {
|
||
@apply m-0;
|
||
}
|
||
.breakdown-results-section .tabs-toolbar {
|
||
container-type: normal;
|
||
}
|
||
.breakdown-results-section .workspace-tabs > .n-tabs-nav {
|
||
@apply flex-nowrap;
|
||
}
|
||
.breakdown-results-section .workspace-tabs .n-tabs-nav-scroll-wrapper {
|
||
@apply min-w-0 flex-1;
|
||
flex-basis: auto;
|
||
}
|
||
.breakdown-results-section .workspace-tabs .n-tabs-nav__suffix {
|
||
@apply w-auto pl-2;
|
||
}
|
||
.breakdown-results-section .tabs-toolbar-actions {
|
||
@apply min-h-0 flex-nowrap;
|
||
}
|
||
.breakdown-results-section .content-with-history:not(.history-hidden) {
|
||
@apply relative;
|
||
grid-template-columns: minmax(0, 1fr);
|
||
grid-template-rows: minmax(0, 1fr);
|
||
}
|
||
.breakdown-results-section .content-with-history:not(.history-hidden) .history-panel {
|
||
@apply absolute inset-0 z-30;
|
||
}
|
||
}
|
||
</style>
|