feat: 同步质量校验修复并精简工作台操作

This commit is contained in:
GouJ committed 2026-09-03 19:38:57 +08:00
1 parent 771b66cafc
commit 13bb6dc83b
47 files changed
+2244 -260

No files matched your search

@@ -8,6 +8,7 @@ import { projectContextKey, type useProjectData } from '../projects/context'
import type { ProjectDetail } from '../projects/types'
import type { Checkpoint } from '../workflows/types'
import type { BreakdownModule, EpisodePlan } from './types'
import { selectMenu } from '../../testing/naive'
let wrapper: VueWrapper | undefined
afterEach(() => {
@@ -195,6 +196,8 @@ describe('拆解页内容滚动', () => {
it.each(['人物', '场景', '道具'])('%s 使用共用固定斑马纹样式,搜索后保持列表条目结构', async label => {
mountPage()
await selectTab(label)
expect(wrapper!.find('.history-panel').exists()).toBe(false)
await selectMenu('拆解更多操作', '执行记录')
const list = wrapper!.get('.subject-record-list')
expect(list.classes()).toContain('record-list')
expect(list.findAll(':scope > article')).toHaveLength(30)
@@ -364,6 +367,7 @@ describe('拆解页内容滚动', () => {
])('%s 的末项始终放在独立结果滚动容器内', async (label, lastItem) => {
mountPage()
await selectTab(label)
await selectMenu('拆解更多操作', '执行记录')
expect(wrapper!.find('.workspace-scroll').exists()).toBe(false)
const results = wrapper!.get('.breakdown-results-scroll .n-scrollbar-container')
expect(results.text()).toContain(lastItem)
@@ -378,6 +382,7 @@ describe('拆解页内容滚动', () => {
const fetcher = vi.fn<typeof fetch>()
vi.stubGlobal('fetch', fetcher)
const provided = mountPage()
await selectMenu('拆解更多操作', '执行记录')
const results = wrapper!.get<HTMLElement>('.breakdown-results-scroll .n-scrollbar-container').element
const history = wrapper!.get<HTMLElement>('.history-panel .n-scrollbar-container').element
results.scrollTop = 900
+19 -8
View File
@@ -1,8 +1,9 @@
<script setup lang="ts">
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 { Download, Layers, LoaderCircle, ArrowRight } from '@lucide/vue'
import { Layers, LoaderCircle, ArrowRight } from '@lucide/vue'
import { EmptyState, StatusBadge, WorkspaceTools } from '../../components/ui'
import { useProjectContext } from '../projects/context'
import { breakdownApi } from './api'
@@ -25,6 +26,7 @@ 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: '故事空间与环境特征' },
@@ -398,14 +400,18 @@ function exportResult() {
><NTab name="storyboard">分镜</NTab><NTab name="tasks">任务明细</NTab>
<template #suffix
><div class="tabs-toolbar-actions">
<NButton :disabled="!snapshot" @click="exportResult" text size="small"
><Download :size="14" />导出 JSON
</NButton>
</div></template
>
<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">
<div class="content-with-history panel" :class="{ 'history-hidden': !showHistory }">
<main class="min-w-0">
<!-- 所有结果标签共用有界的内容滚动;切换标签回到顶部,不继承上一列表的位置。 -->
<NScrollbar :key="tab" class="panel-scroll breakdown-results-scroll">
@@ -480,7 +486,12 @@ function exportResult() {
</div>
</NScrollbar>
</main>
<HistoryPanel :project-id="project?.id" :checkpoints="checkpoints" workflow="breakdown" />
<HistoryPanel
v-if="showHistory"
:project-id="project?.id"
:checkpoints="checkpoints"
workflow="breakdown"
/>
</div>
</section>
</template>
@@ -1,13 +1,19 @@
<script setup lang="ts">
import { NCollapse, NCollapseItem, NInput, NTag } from 'naive-ui'
import { NButton, NCollapse, NCollapseItem, NInput, NTag } from 'naive-ui'
import { computed, ref } from 'vue'
import { Search, ChevronDown } from '@lucide/vue'
import { Search } from '@lucide/vue'
import { EmptyState } from '../../../components/ui'
import type { SubjectCandidate, SubjectForm } from '../types'
/** 主体列表按稳定 ref 展示;形态以 profileId 关联。 */
const props = defineProps<{ subjects: SubjectCandidate[]; forms: SubjectForm[]; projectId?: string }>()
const search = ref('')
/** 长篇主体经历默认展示摘要,展开不丢失原始正文。 */
const expanded = ref(new Set<string>())
function toggleDescription(id: string) {
if (expanded.value.has(id)) expanded.value.delete(id)
else expanded.value.add(id)
}
const filtered = computed(() =>
props.subjects.filter(item =>
`${item.name} ${item.ref} ${item.aliases?.join(' ') ?? ''}`
@@ -43,7 +49,23 @@ const filtered = computed(() =>
>别名:{{ subject.aliases.join('、') }}</span
>
</div>
<p class="text-sm leading-7">{{ subject.description }}</p>
<p
class="text-sm leading-7"
:class="{
'line-clamp-3': (subject.description?.length ?? 0) > 160 && !expanded.has(subject.profileId)
}"
>
{{ subject.description }}
</p>
<NButton
v-if="(subject.description?.length ?? 0) > 160"
text
size="small"
class="mt-2"
:aria-expanded="expanded.has(subject.profileId)"
@click="toggleDescription(subject.profileId)"
>{{ expanded.has(subject.profileId) ? '收起介绍' : '展开完整介绍' }}</NButton
>
<RouterLink
v-if="projectId"
:to="{ path: `/projects/${projectId}/subject-identity`, query: { subjectRef: subject.ref } }"
@@ -59,7 +81,7 @@ const filtered = computed(() =>
<NCollapse class="subject-details mt-4"
><NCollapseItem name="details"
><template #header
><ChevronDown :size="14" />外观描述与形态
>外观描述与形态
<span class="ml-1 text-muted">{{
forms.filter(form => form.profileId === subject.profileId).length
}}</span></template
@@ -77,7 +99,12 @@ const filtered = computed(() =>
}}<NTag v-if="form.isDefault" size="small" :bordered="false">默认</NTag>
</p>
<p class="mt-2 text-sm leading-6 text-muted">{{ form.description }}</p>
<p class="mt-2 text-xs leading-6 text-muted">{{ form.appearancePrompt }}</p>
<p
v-if="form.appearancePrompt?.trim() !== form.description?.trim()"
class="mt-2 text-xs leading-6 text-muted"
>
{{ form.appearancePrompt }}
</p>
</div></NCollapseItem
></NCollapse
>