Skip to content

🎬 火宝短剧 - 基于AI的一站式短剧生成平台 《一句话生成完整短剧,从剧本到成片全自动化》 Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"

TypeScript

feat: replace Grid/Edit workbench with Filmstrip table layout

Connor9a39e0d799ef
diff --git a/web/src/composables/useEpisodeWorkbench.ts b/web/src/composables/useEpisodeWorkbench.ts
index 983c82d..642e764 100644
--- a/web/src/composables/useEpisodeWorkbench.ts
+++ b/web/src/composables/useEpisodeWorkbench.ts
@@ -1,7 +1,7 @@
import { ref, computed, onMounted, onBeforeUnmount } from 'vue'
import { useRoute } from 'vue-router'
import { useResourcePanel } from './useResourcePanel'
-import { useStoryboardGrid } from './useStoryboardGrid'
+import { useStoryboardTable } from './useStoryboardTable'
import { useFrameImageGeneration } from './useFrameImageGeneration'
import { useVideoGenerationPro } from './useVideoGenerationPro'
@@ -11,17 +11,21 @@ export function useEpisodeWorkbench() {
const episodeNumber = Number(route.params.episodeNumber)
const resource = useResourcePanel(dramaId, episodeNumber)
- const grid = useStoryboardGrid(resource.storyboards)
+ const table = useStoryboardTable(resource.storyboards)
- // imageGen expects Ref<Storyboard | null> — grid.currentStoryboard is computed ref
- const imageGen = useFrameImageGeneration(grid.currentStoryboard, dramaId)
+ // imageGen needs a current storyboard ref — use first selected or null
+ const currentStoryboard = computed(() => {
+ const selected = table.selectedStoryboards.value
+ return selected.length === 1 ? selected[0] : null
+ })
+
+ const imageGen = useFrameImageGeneration(currentStoryboard, dramaId)
- // videoGen expects Ref types
const episodeIdRef = computed(() => resource.episode.value?.id || 0)
const timelineEditorRef = ref(null)
const videoGen = useVideoGenerationPro(
- grid.currentStoryboard,
+ currentStoryboard,
dramaId,
episodeIdRef,
resource.storyboards,
@@ -43,7 +47,7 @@ export function useEpisodeWorkbench() {
dramaId,
episodeNumber,
resource,
- grid,
+ table,
imageGen,
videoGen,
}
diff --git a/web/src/composables/useStoryboardGrid.ts b/web/src/composables/useStoryboardGrid.ts
deleted file mode 100644
index f04933a..0000000
--- a/web/src/composables/useStoryboardGrid.ts
+++ /dev/null
@@ -1,67 +0,0 @@
-import { ref, computed, type Ref } from 'vue'
-import type { Storyboard } from '@/types/drama'
-
-export type ViewMode = 'grid' | 'edit'
-
-export function useStoryboardGrid(storyboards: Ref<Storyboard[]>) {
- const viewMode = ref<ViewMode>('grid')
- const selectedStoryboardId = ref<string | null>(null)
- const selectedIds = ref<Set<number>>(new Set())
-
- const safeStoryboards = computed(() => Array.isArray(storyboards.value) ? storyboards.value : [])
-
- const currentStoryboard = computed(() => {
- if (!selectedStoryboardId.value) return null
- return safeStoryboards.value.find(s => String(s.id) === selectedStoryboardId.value) || null
- })
-
- const progress = computed(() => {
- const raw = storyboards.value
- const all = Array.isArray(raw) ? raw : []
- const withImage = all.filter(s => s.image_url).length
- const withVideo = all.filter(s => (s as any).videos?.length > 0).length
- return { total: all.length, withImage, withVideo }
- })
-
- function selectStoryboard(id: string) {
- selectedStoryboardId.value = id
- viewMode.value = 'edit'
- }
-
- function backToGrid() {
- viewMode.value = 'grid'
- }
-
- function selectPrev() {
- const all = safeStoryboards.value
- const idx = all.findIndex(s => String(s.id) === selectedStoryboardId.value)
- if (idx > 0) selectedStoryboardId.value = String(all[idx - 1].id)
- }
-
- function selectNext() {
- const all = safeStoryboards.value
- const idx = all.findIndex(s => String(s.id) === selectedStoryboardId.value)
- if (idx >= 0 && idx < all.length - 1) selectedStoryboardId.value = String(all[idx + 1].id)
- }
-
- function toggleSelection(id: number) {
- if (selectedIds.value.has(id)) {
- selectedIds.value.delete(id)
- } else {
- selectedIds.value.add(id)
- }
- }
-
- return {
- viewMode,
- selectedStoryboardId,
- selectedIds,
- currentStoryboard,
- progress,
- selectStoryboard,
- backToGrid,
- selectPrev,
- selectNext,
- toggleSelection,
- }
-}
diff --git a/web/src/composables/useStoryboardTable.ts b/web/src/composables/useStoryboardTable.ts
new file mode 100644
index 0000000..83db380
--- /dev/null
+++ b/web/src/composables/useStoryboardTable.ts
@@ -0,0 +1,70 @@
+import { ref, computed, type Ref } from 'vue'
+import type { Storyboard } from '@/types/drama'
+
+export type WorkbenchTab = 'script' | 'storyboard'
+
+export function useStoryboardTable(storyboards: Ref<Storyboard[]>) {
+ const activeTab = ref<WorkbenchTab>('script')
+ const selectedIds = ref<Set<string>>(new Set())
+
+ const safeStoryboards = computed(() =>
+ Array.isArray(storyboards.value) ? storyboards.value : []
+ )
+
+ const progress = computed(() => {
+ const all = safeStoryboards.value
+ const withImage = all.filter(s => s.image_url || s.local_path).length
+ const withVideo = all.filter(s => s.video_url).length
+ const generating = all.filter(s =>
+ s.image_generation_status === 'processing' ||
+ s.image_generation_status === 'generating' ||
+ s.status === 'processing' ||
+ s.status === 'generating'
+ ).length
+ const totalDuration = all.reduce((sum, s) => sum + (s.duration || 0), 0)
+ return { total: all.length, withImage, withVideo, generating, totalDuration }
+ })
+
+ const allSelected = computed(() =>
+ safeStoryboards.value.length > 0 &&
+ safeStoryboards.value.every(s => selectedIds.value.has(s.id))
+ )
+
+ const hasSelection = computed(() => selectedIds.value.size > 0)
+
+ const selectedStoryboards = computed(() =>
+ safeStoryboards.value.filter(s => selectedIds.value.has(s.id))
+ )
+
+ function toggleSelect(id: string) {
+ const next = new Set(selectedIds.value)
+ if (next.has(id)) next.delete(id)
+ else next.add(id)
+ selectedIds.value = next
+ }
+
+ function toggleSelectAll() {
+ if (allSelected.value) {
+ selectedIds.value = new Set()
+ } else {
+ selectedIds.value = new Set(safeStoryboards.value.map(s => s.id))
+ }
+ }
+
+ function clearSelection() {
+ selectedIds.value = new Set()
+ }
+
+ return {
+ activeTab,
+ selectedIds,
+ safeStoryboards,
+ progress,
+ allSelected,
+ hasSelection,
+ selectedStoryboards,
+ toggleSelect,
+ toggleSelectAll,
+ clearSelection,
+ }
+}
diff --git a/web/src/views/drama/episode/EpisodeWorkbench.vue b/web/src/views/drama/episode/EpisodeWorkbench.vue
index 8a3633e..e6ad9c5 100644
--- a/web/src/views/drama/episode/EpisodeWorkbench.vue
+++ b/web/src/views/drama/episode/EpisodeWorkbench.vue
@@ -9,13 +9,30 @@
</Button>
<span class="wb-title">{{ resource.drama?.title }} - 第{{ episodeNumber }}集</span>
</div>
+ <div class="wb-topbar-center">
+ <button
+ class="tab-btn"
+ :class="{ 'tab-btn--active': table.activeTab === 'script' }"
+ @click="table.activeTab = 'script'"
+ >
+ <FileText :size="14" />
+ 剧本
+ </button>
+ <button
+ class="tab-btn"
+ :class="{ 'tab-btn--active': table.activeTab === 'storyboard' }"
+ @click="table.activeTab = 'storyboard'"
+ >
+ <Clapperboard :size="14" />
+ 分镜
+ </button>
+ </div>
<div class="wb-topbar-right">
- <!-- Progress -->
- <div v-if="grid.progress.total > 0" class="wb-progress">
+ <div v-if="table.progress.total > 0" class="wb-progress">
<div class="progress-track">
<div class="progress-fill" :style="{ width: progressPct + '%' }"></div>
</div>
- <span class="progress-label">{{ grid.progress.withImage }}/{{ grid.progress.total }}</span>
+ <span class="progress-label">{{ table.progress.withImage }}/{{ table.progress.total }}</span>
</div>
<Button variant="outline" size="sm" @click="agentOpen = true">
<Wand2 :size="14" />
@@ -31,10 +48,10 @@
<!-- Main content -->
<div class="wb-body">
<ResourcePanel
- :resource="resource"
- @extract="handleExtract"
- @upload-script="handleUploadScript"
- @rewrite-script="handleRewriteScript"
+ :characters="resource.characters"
+ :scenes="resource.scenes"
+ :has-characters="resource.hasCharacters"
+ :has-scenes="resource.hasScenes"
@generate-character-image="handleGenerateCharacterImage"
@batch-generate-characters="handleBatchGenerateCharacters"
@generate-scene-image="handleGenerateSceneImage"
@@ -42,50 +59,42 @@
/>
<div class="wb-main">
- <!-- Stage: script only -->
- <div v-if="resource.pipelineStage === 'script'" class="wb-empty">
- <Clapperboard :size="48" :stroke-width="1" />
- <p>镜头工作区</p>
- <p class="wb-empty-hint">完成剧本 → 提取角色场景 → 拆解分镜后,镜头将在此展示</p>
- </div>
-
- <!-- Stage: extracted, waiting for storyboard -->
- <div v-else-if="resource.pipelineStage === 'extracted'" class="wb-empty">
- <Clapperboard :size="48" :stroke-width="1" />
- <p>角色和场景已就绪,可以拆解分镜了</p>
- <Button @click="handleBreakdown">
- <Wand2 :size="14" />
- Agent 拆解分镜
- </Button>
- </div>
-
- <!-- Stage: storyboards - grid mode -->
- <StoryboardGrid
- v-else-if="grid.viewMode === 'grid'"
- :storyboards="resource.storyboards"
- :progress="grid.progress"
- @select="grid.selectStoryboard"
- @add="handleAddStoryboard"
- @batch-generate-images="handleBatchImages"
- @batch-generate-videos="handleBatchVideos"
+ <!-- Script Tab -->
+ <ScriptTab
+ v-if="table.activeTab === 'script'"
+ :script-content="resource.scriptContent"
+ :has-script="resource.hasScript"
+ :has-characters="resource.hasCharacters"
+ :has-scenes="resource.hasScenes"
+ :character-count="resource.characters.length"
+ :scene-count="resource.scenes.length"
+ @save="resource.saveScript"
+ @upload="handleUploadScript"
+ @rewrite="handleRewriteScript"
+ @extract="handleExtract"
/>
- <!-- Stage: storyboards - edit mode -->
- <StoryboardEditor
+ <!-- Storyboard Tab -->
+ <StoryboardTable
v-else
:storyboards="resource.storyboards"
- :current-storyboard="grid.currentStoryboard"
- :current-id="grid.selectedStoryboardId"
:characters="resource.characters"
:scenes="resource.scenes"
- :images="imageGen.generatedImages"
- :video-url="currentVideoUrl"
- @select="grid.selectStoryboard"
- @back="grid.backToGrid"
- @add="handleAddStoryboard"
+ :selected-ids="table.selectedIds"
+ :all-selected="table.allSelected"
+ :has-selection="table.hasSelection"
+ :progress="table.progress"
+ @toggle-select="table.toggleSelect"
+ @toggle-select-all="table.toggleSelectAll"
+ @clear-selection="table.clearSelection"
@save-field="handleSaveField"
@generate-image="handleGenerateImage"
@generate-video="handleGenerateVideo"
+ @add="handleAddStoryboard"
+ @batch-images="handleBatchImages"
+ @batch-videos="handleBatchVideos"
+ @generate-grid="handleGenerateGrid"
+ @breakdown="handleBreakdown"
/>
</div>
</div>
@@ -103,11 +112,11 @@
<script setup lang="ts">
import { computed, ref, reactive } from 'vue'
import { useRouter } from 'vue-router'
-import { ArrowLeft, ArrowRight, Wand2, Clapperboard } from 'lucide-vue-next'
+import { ArrowLeft, ArrowRight, Wand2, Clapperboard, FileText } from 'lucide-vue-next'
import { Button } from '@/components/ui/button'
import ResourcePanel from './workbench/ResourcePanel.vue'
-import StoryboardGrid from './workbench/StoryboardGrid.vue'
-import StoryboardEditor from './workbench/StoryboardEditor.vue'
+import ScriptTab from './workbench/ScriptTab.vue'
+import StoryboardTable from './workbench/StoryboardTable.vue'
import { useEpisodeWorkbench } from '@/composables/useEpisodeWorkbench'
import AgentDrawer from '@/components/agent/AgentDrawer.vue'
import type { AgentType } from '@/types/agent'
@@ -115,46 +124,40 @@ import type { AgentType } from '@/types/agent'
const router = useRouter()
const wb = useEpisodeWorkbench()
const { dramaId, episodeNumber } = wb
-// Wrap in reactive so nested refs auto-unwrap in template
const resource = reactive(wb.resource)
-const grid = reactive(wb.grid)
+const table = reactive(wb.table)
const imageGen = reactive(wb.imageGen)
const videoGen = reactive(wb.videoGen)
const agentOpen = ref(false)
const progressPct = computed(() => {
- const p = grid.progress
+ const p = table.progress
return p.total > 0 ? Math.round((p.withImage / p.total) * 100) : 0
})
-const currentVideoUrl = computed(() => {
- const videos = videoGen.generatedVideos
- const v = Array.isArray(videos) ? videos.find((v: any) => v.video_url) : null
- return v?.video_url || null
-})
-
const goBack = () => router.push(`/drama/${dramaId}`)
const goToCompose = () => router.push(`/drama/${dramaId}/episode/${episodeNumber}/compose`)
-// Action stubs (will be fully wired in later tasks)
+// Action handlers
const handleExtract = () => { /* TODO: call extract agent */ }
const handleBreakdown = () => { /* TODO: call storyboard_breaker agent */ }
const handleAddStoryboard = () => { /* TODO: call dramaAPI to add storyboard */ }
const handleBatchImages = () => { /* TODO: batch image generation */ }
const handleBatchVideos = () => { /* TODO: batch video generation */ }
-const handleSaveField = (_field: string, _value: any) => { /* TODO: save via API */ }
-const handleGenerateImage = () => { imageGen.generateFrameImage([]) }
-const handleGenerateVideo = () => { videoGen.generateVideo() }
+const handleGenerateGrid = () => { /* TODO: generate grid image from selected storyboards */ }
+const handleSaveField = (_id: string, _field: string, _value: any) => {
+ /* TODO: save via dramaAPI.updateStoryboard */
+}
+const handleGenerateImage = (_id: string) => { imageGen.generateFrameImage([]) }
+const handleGenerateVideo = (_id: string) => { videoGen.generateVideo() }
const handleUploadScript = () => { /* TODO: upload script */ }
const handleRewriteScript = () => { /* TODO: rewrite script */ }
-const handleGenerateCharacterImage = (_id: number) => { /* TODO: generate character image */ }
-const handleBatchGenerateCharacters = () => { /* TODO: batch generate characters */ }
-const handleGenerateSceneImage = (_id: number) => { /* TODO: generate scene image */ }
-const handleBatchGenerateScenes = () => { /* TODO: batch generate scenes */ }
-const handleAgentApply = (_data: { type: AgentType; content: string }) => {
- /* TODO: map agent results to workbench actions based on _data.type */
-}
+const handleGenerateCharacterImage = (_id: number) => { /* TODO */ }
+const handleBatchGenerateCharacters = () => { /* TODO */ }
+const handleGenerateSceneImage = (_id: number) => { /* TODO */ }
+const handleBatchGenerateScenes = () => { /* TODO */ }
+const handleAgentApply = (_data: { type: AgentType; content: string }) => { /* TODO */ }
</script>
<style scoped>
@@ -173,6 +176,7 @@ const handleAgentApply = (_data: { type: AgentType; content: string }) => {
padding: 8px 16px;
border-bottom: 1px solid var(--border-primary);
background: var(--bg-card);
+ gap: 12px;
}
.wb-topbar-left,
@@ -182,6 +186,40 @@ const handleAgentApply = (_data: { type: AgentType; content: string }) => {
gap: 8px;
}
+.wb-topbar-center {
+ display: flex;
+ align-items: center;
+ gap: 2px;
+ background: var(--bg-primary);
+ border-radius: 8px;
+ padding: 2px;
+}
+
+.tab-btn {
+ display: flex;
+ align-items: center;
+ gap: 5px;
+ padding: 5px 14px;
+ border: none;
+ border-radius: 6px;
+ background: transparent;
+ color: var(--text-muted);
+ font-size: 13px;
+ font-weight: 500;
+ cursor: pointer;
+ transition: all 0.15s;
+}
+
+.tab-btn:hover {
+ color: var(--text-primary);
+}
+
+.tab-btn--active {
+ background: var(--bg-card);
+ color: var(--text-primary);
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
+}
+
.wb-title {
font-size: 14px;
font-weight: 600;
@@ -201,21 +239,6 @@ const handleAgentApply = (_data: { type: AgentType; content: string }) => {
overflow: hidden;
}
-.wb-empty {
- flex: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- gap: 12px;
- color: var(--text-muted);
-}
-
-.wb-empty-hint {
- font-size: 12px;
- color: var(--text-muted);
-}
-
.wb-progress {
display: flex;
align-items: center;
diff --git a/web/src/views/drama/episode/workbench/PreviewPane.vue b/web/src/views/drama/episode/workbench/PreviewPane.vue
deleted file mode 100644
index 2b090c8..0000000
--- a/web/src/views/drama/episode/workbench/PreviewPane.vue
+++ /dev/null
@@ -1,258 +0,0 @@
-<script setup lang="ts">
-import { ref, computed, watch } from 'vue'
-import { ImageIcon, Play } from 'lucide-vue-next'
-import type { Storyboard } from '@/types/drama'
-import type { ImageGeneration } from '@/types/image'
-import { getImageUrl, getVideoUrl } from '@/utils/image'
-
-const props = defineProps<{
- storyboard: Storyboard | null
- images: ImageGeneration[]
- videoUrl: string | null
-}>()
-
-// Track which gallery image is selected; null = use storyboard's main image
-const selectedImageId = ref<number | null>(null)
-const showVideo = ref(false)
-
-// Reset selection when storyboard changes
-watch(() => props.storyboard?.id, () => {
- selectedImageId.value = null
- showVideo.value = false
-})
-
-const mainImageUrl = computed(() => {
- if (selectedImageId.value !== null) {
- const img = props.images.find(i => i.id === selectedImageId.value)
- if (img) return getImageUrl(img)
- }
- return getImageUrl(props.storyboard)
-})
-
-function selectImage(img: ImageGeneration) {
- selectedImageId.value = img.id
- showVideo.value = false
-}
-
-function toggleVideo() {
- if (props.videoUrl) {
- showVideo.value = true
- selectedImageId.value = null
- }
-}
-</script>
-
-<template>
- <div class="preview-root">
- <template v-if="storyboard">
- <!-- Main media area -->
- <div class="preview-main">
- <video
- v-if="showVideo && videoUrl"
- :src="videoUrl"
- class="preview-media"
- controls
- autoplay
- />
- <img
- v-else-if="mainImageUrl"
- :src="mainImageUrl"
- class="preview-media"
- :alt="storyboard.title || '预览'"
- />
- <div v-else class="preview-empty">
- <ImageIcon :size="36" class="preview-empty__icon" />
- <p class="preview-empty__text">暂无图片,请先生成</p>
- </div>
-
- <!-- Info overlay -->
- <div v-if="mainImageUrl || (showVideo && videoUrl)" class="preview-overlay">
- <span class="overlay-tag">#{{ storyboard.storyboard_number }}</span>
- <span v-if="storyboard.title" class="overlay-title">{{ storyboard.title }}</span>
- <span v-if="storyboard.duration" class="overlay-duration">{{ storyboard.duration }}s</span>
- </div>
- </div>
-
- <!-- Gallery row -->
- <div class="gallery-row" v-if="images.length > 0 || videoUrl">
- <!-- Image thumbnails -->
- <div
- v-for="img in images"
- :key="img.id"
- class="gallery-thumb"
- :class="{ 'gallery-thumb--active': !showVideo && selectedImageId === img.id }"
- @click="selectImage(img)"
- >
- <img v-if="getImageUrl(img)" :src="getImageUrl(img)" class="gallery-thumb__img" />
- <div v-else class="gallery-thumb__placeholder">
- <ImageIcon :size="10" />
- </div>
- </div>
-
- <!-- Video thumbnail -->
- <div
- v-if="videoUrl"
- class="gallery-thumb gallery-thumb--video"
- :class="{ 'gallery-thumb--active': showVideo }"
- @click="toggleVideo"
- >
- <Play :size="14" class="gallery-thumb__play" />
- </div>
- </div>
- </template>
-
- <!-- No storyboard selected -->
- <div v-else class="preview-empty preview-empty--full">
- <ImageIcon :size="48" class="preview-empty__icon" />
- <p class="preview-empty__text">选择分镜以预览</p>
- </div>
- </div>
-</template>
-
-<style scoped>
-.preview-root {
- flex: 1;
- min-width: 0;
- display: flex;
- flex-direction: column;
- background: #0a0a0a;
- overflow: hidden;
-}
-
-/* Main media */
-.preview-main {
- flex: 1;
- min-height: 0;
- position: relative;
- display: flex;
- align-items: center;
- justify-content: center;
- overflow: hidden;
-}
-
-.preview-media {
- max-width: 100%;
- max-height: 100%;
- object-fit: contain;
- display: block;
-}
-
-.preview-empty {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- gap: 8px;
- color: var(--text-muted, rgba(255, 255, 255, 0.3));
-}
-
-.preview-empty--full {
- flex: 1;
-}
-
-.preview-empty__icon {
- opacity: 0.5;
-}
-
-.preview-empty__text {
- font-size: 12px;
- margin: 0;
-}
-
-/* Overlay */
-.preview-overlay {
- position: absolute;
- bottom: 6px;
- left: 6px;
- display: flex;
- gap: 5px;
- align-items: center;
-}
-
-.overlay-tag {
- background: rgba(0, 0, 0, 0.75);
- color: #fff;
- font-size: 11px;
- padding: 2px 6px;
- border-radius: 4px;
- font-weight: 600;
-}
-
-.overlay-title {
- color: rgba(255, 255, 255, 0.85);
- font-size: 11px;
- text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
-}
-
-.overlay-duration {
- background: rgba(64, 158, 255, 0.8);
- color: #fff;
- font-size: 11px;
- padding: 2px 6px;
- border-radius: 4px;
-}
-
-/* Gallery row */
-.gallery-row {
- flex-shrink: 0;
- display: flex;
- align-items: center;
- gap: 4px;
- padding: 6px 8px;
- overflow-x: auto;
- border-top: 1px solid var(--border-primary, rgba(255, 255, 255, 0.06));
- background: var(--bg-secondary, rgba(0, 0, 0, 0.15));
-}
-
-.gallery-row::-webkit-scrollbar {
- height: 3px;
-}
-
-.gallery-row::-webkit-scrollbar-thumb {
- background: rgba(255, 255, 255, 0.1);
- border-radius: 2px;
-}
-
-.gallery-thumb {
- flex-shrink: 0;
- width: 72px;
- height: 46px;
- border-radius: 5px;
- overflow: hidden;
- cursor: pointer;
- border: 1.5px solid transparent;
- background: #111;
- transition: border-color 0.1s;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.gallery-thumb:hover {
- border-color: rgba(255, 255, 255, 0.2);
-}
-
-.gallery-thumb--active {
- border-color: var(--accent, #e8a243);
- box-shadow: 0 0 0 1px var(--accent, #e8a243);
-}
-
-.gallery-thumb__img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- display: block;
-}
-
-.gallery-thumb__placeholder {
- color: var(--text-muted, rgba(255, 255, 255, 0.25));
-}
-
-.gallery-thumb--video {
- background: rgba(96, 165, 250, 0.1);
-}
-
-.gallery-thumb__play {
- color: rgba(96, 165, 250, 0.8);
-}
-</style>
diff --git a/web/src/views/drama/episode/workbench/PropertiesPanel.vue b/web/src/views/drama/episode/workbench/PropertiesPanel.vue
deleted file mode 100644
index cd10216..0000000
--- a/web/src/views/drama/episode/workbench/PropertiesPanel.vue
+++ /dev/null
@@ -1,415 +0,0 @@
-<script setup lang="ts">
-import { computed } from 'vue'
-import { Button } from '@/components/ui/button'
-import { Badge } from '@/components/ui/badge'
-import { ScrollArea } from '@/components/ui/scroll-area'
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from '@/components/ui/select'
-import {
- ImageIcon,
- Video,
- MapPin,
- Users,
- Camera,
- RotateCcw,
- Move,
-} from 'lucide-vue-next'
-import type { Storyboard, Character, Scene } from '@/types/drama'
-
-const props = defineProps<{
- storyboard: Storyboard | null
- characters: Character[]
- scenes: Scene[]
-}>()
-
-const emit = defineEmits<{
- saveField: [field: string, value: any]
- generateImage: []
- generateVideo: []
- showCharacterSelector: []
- showSceneSelector: []
-}>()
-
-const shotTypeOptions = ['远景', '全景', '中景', '近景', '特写']
-const angleOptions = ['平视', '仰视', '俯视', '侧面']
-const movementOptions = ['固定镜头', '推镜', '拉镜', '跟镜']
-
-const sceneDisplay = computed(() => {
- if (!props.storyboard?.scene) return null
- const s = props.storyboard.scene
- return `${s.location || ''}${s.time ? ' · ' + s.time : ''}`
-})
-
-const storyboardCharacters = computed(() => {
- if (!props.storyboard?.character_ids?.length) return []
- return props.characters.filter(c =>
- props.storyboard!.character_ids!.includes(c.id)
- )
-})
-
-function onFieldChange(field: string, event: Event) {
- const target = event.target as HTMLTextAreaElement | HTMLInputElement
- emit('saveField', field, target.value)
-}
-
-function onSelectChange(field: string, value: string) {
- emit('saveField', field, value)
-}
-</script>
-
-<template>
- <div class="props-root">
- <ScrollArea v-if="storyboard" class="props-scroll">
- <div class="props-content">
- <!-- Scene -->
- <div class="props-section">
- <div class="props-label">
- <MapPin :size="12" />
- 场景
- </div>
- <div
- class="props-scene-display"
- @click="emit('showSceneSelector')"
- >
- <span v-if="sceneDisplay" class="scene-text">{{ sceneDisplay }}</span>
- <span v-else class="scene-placeholder">选择场景...</span>
- </div>
- </div>
-
- <!-- Characters -->
- <div class="props-section">
- <div class="props-label">
- <Users :size="12" />
- 角色
- </div>
- <div class="props-characters" @click="emit('showCharacterSelector')">
- <Badge
- v-for="char in storyboardCharacters"
- :key="char.id"
- class="char-badge"
- >
- {{ char.name }}
- </Badge>
- <span v-if="!storyboardCharacters.length" class="scene-placeholder">
- 点击添加角色...
- </span>
- </div>
- </div>
-
- <!-- Shot parameters -->
- <div class="props-section">
- <div class="props-label">
- <Camera :size="12" />
- 镜头
- </div>
- <div class="props-row">
- <Select
- :model-value="storyboard.shot_type || ''"
- @update:model-value="(v: string) => onSelectChange('shot_type', v)"
- >
- <SelectTrigger class="props-select-trigger">
- <SelectValue placeholder="景别" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem v-for="opt in shotTypeOptions" :key="opt" :value="opt">
- {{ opt }}
- </SelectItem>
- </SelectContent>
- </Select>
- </div>
- <div class="props-row">
- <Select
- :model-value="storyboard.angle || ''"
- @update:model-value="(v: string) => onSelectChange('angle', v)"
- >
- <SelectTrigger class="props-select-trigger">
- <SelectValue placeholder="角度" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem v-for="opt in angleOptions" :key="opt" :value="opt">
- {{ opt }}
- </SelectItem>
- </SelectContent>
- </Select>
- </div>
- <div class="props-row">
- <Select
- :model-value="storyboard.movement || ''"
- @update:model-value="(v: string) => onSelectChange('movement', v)"
- >
- <SelectTrigger class="props-select-trigger">
- <SelectValue placeholder="运镜" />
- </SelectTrigger>
- <SelectContent>
- <SelectItem v-for="opt in movementOptions" :key="opt" :value="opt">
- {{ opt }}
- </SelectItem>
- </SelectContent>
- </Select>
- </div>
- </div>
-
- <!-- Description -->
- <div class="props-section">
- <div class="props-label">描述</div>
- <textarea
- class="props-textarea"
- :value="storyboard.description || ''"
- placeholder="镜头描述..."
- rows="2"
- @change="onFieldChange('description', $event)"
- />
- </div>
-
- <!-- Dialogue -->
- <div class="props-section">
- <div class="props-label">台词</div>
- <textarea
- class="props-textarea"
- :value="storyboard.dialogue || ''"
- placeholder="角色台词..."
- rows="2"
- @change="onFieldChange('dialogue', $event)"
- />
- </div>
-
- <!-- Action -->
- <div class="props-section">
- <div class="props-label">动作</div>
- <textarea
- class="props-textarea"
- :value="storyboard.action || ''"
- placeholder="角色动作..."
- rows="2"
- @change="onFieldChange('action', $event)"
- />
- </div>
-
- <!-- Image Prompt -->
- <div class="props-section">
- <div class="props-label">
- <ImageIcon :size="12" />
- 图片 Prompt
- </div>
- <textarea
- class="props-textarea props-textarea--tall"
- :value="storyboard.image_prompt || ''"
- placeholder="图片生成提示词..."
- rows="3"
- @change="onFieldChange('image_prompt', $event)"
- />
- </div>
-
- <!-- Video Prompt -->
- <div class="props-section">
- <div class="props-label">
- <Video :size="12" />
- 视频 Prompt
- </div>
- <textarea
- class="props-textarea props-textarea--tall"
- :value="storyboard.video_prompt || ''"
- placeholder="视频生成提示词..."
- rows="3"
- @change="onFieldChange('video_prompt', $event)"
- />
- </div>
-
- <!-- Generate buttons -->
- <div class="props-actions">
- <Button
- variant="outline"
- size="sm"
- class="props-gen-btn"
- @click="emit('generateImage')"
- >
- <ImageIcon :size="14" />
- 生成图片
- </Button>
- <Button
- variant="outline"
- size="sm"
- class="props-gen-btn"
- @click="emit('generateVideo')"
- >
- <Video :size="14" />
- 生成视频
- </Button>
- </div>
- </div>
- </ScrollArea>
-
- <!-- Empty state -->
- <div v-else class="props-empty">
- <p>选择分镜以编辑属性</p>
- </div>
- </div>
-</template>
-
-<style scoped>
-.props-root {
- width: 260px;
- flex-shrink: 0;
- border-left: 1px solid var(--border-primary, rgba(255, 255, 255, 0.06));
- background: var(--bg-secondary, rgba(0, 0, 0, 0.15));
- display: flex;
- flex-direction: column;
- overflow: hidden;
-}
-
-.props-scroll {
- flex: 1;
- min-height: 0;
-}
-
-.props-content {
- padding: 10px 12px;
- display: flex;
- flex-direction: column;
- gap: 12px;
-}
-
-.props-section {
- display: flex;
- flex-direction: column;
- gap: 4px;
-}
-
-.props-label {
- font-size: 11px;
- font-weight: 600;
- color: var(--text-secondary, rgba(255, 255, 255, 0.55));
- display: flex;
- align-items: center;
- gap: 4px;
- text-transform: uppercase;
- letter-spacing: 0.3px;
-}
-
-.props-row {
- margin-top: 2px;
-}
-
-.props-select-trigger {
- height: 28px !important;
- font-size: 12px !important;
- background: var(--bg-primary, rgba(0, 0, 0, 0.2)) !important;
- border-color: var(--border-primary, rgba(255, 255, 255, 0.08)) !important;
-}
-
-/* Scene display */
-.props-scene-display {
- padding: 5px 8px;
- border-radius: 6px;
- background: var(--bg-primary, rgba(0, 0, 0, 0.2));
- border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
- cursor: pointer;
- font-size: 12px;
- transition: border-color 0.15s;
-}
-
-.props-scene-display:hover {
- border-color: rgba(255, 255, 255, 0.18);
-}
-
-.scene-text {
- color: var(--text-primary, rgba(255, 255, 255, 0.9));
-}
-
-.scene-placeholder {
- color: var(--text-muted, rgba(255, 255, 255, 0.3));
- font-size: 12px;
-}
-
-/* Characters */
-.props-characters {
- display: flex;
- flex-wrap: wrap;
- gap: 4px;
- padding: 5px 8px;
- border-radius: 6px;
- background: var(--bg-primary, rgba(0, 0, 0, 0.2));
- border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
- cursor: pointer;
- min-height: 30px;
- align-items: center;
- transition: border-color 0.15s;
-}
-
-.props-characters:hover {
- border-color: rgba(255, 255, 255, 0.18);
-}
-
-.char-badge {
- font-size: 10px !important;
- padding: 1px 7px !important;
- height: auto !important;
- border-radius: 9999px !important;
- background: rgba(232, 162, 67, 0.15) !important;
- color: rgba(232, 162, 67, 0.9) !important;
- border: none !important;
-}
-
-/* Textareas */
-.props-textarea {
- width: 100%;
- font-size: 12px;
- line-height: 1.5;
- padding: 6px 8px;
- border-radius: 6px;
- border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
- background: var(--bg-primary, rgba(0, 0, 0, 0.2));
- color: var(--text-primary, rgba(255, 255, 255, 0.9));
- resize: vertical;
- font-family: inherit;
- transition: border-color 0.15s;
-}
-
-.props-textarea::placeholder {
- color: var(--text-muted, rgba(255, 255, 255, 0.3));
-}
-
-.props-textarea:focus {
- outline: none;
- border-color: var(--accent, #e8a243);
-}
-
-.props-textarea--tall {
- min-height: 60px;
-}
-
-/* Generate buttons */
-.props-actions {
- display: flex;
- flex-direction: column;
- gap: 6px;
- padding-top: 4px;
-}
-
-.props-gen-btn {
- width: 100%;
- font-size: 12px !important;
- height: 32px !important;
- justify-content: center;
- gap: 6px;
-}
-
-/* Empty state */
-.props-empty {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
- color: var(--text-muted, rgba(255, 255, 255, 0.3));
- font-size: 12px;
-}
-
-.props-empty p {
- margin: 0;
-}
-</style>
diff --git a/web/src/views/drama/episode/workbench/ResourcePanel.vue b/web/src/views/drama/episode/workbench/ResourcePanel.vue
index 0c01522..ae57dcb 100644
--- a/web/src/views/drama/episode/workbench/ResourcePanel.vue
+++ b/web/src/views/drama/episode/workbench/ResourcePanel.vue
@@ -1,62 +1,145 @@
<script setup lang="ts">
-import ScriptBlock from './ScriptBlock.vue'
+import { ref } from 'vue'
+import { User, MapPin } from 'lucide-vue-next'
+import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
import CharacterBlock from './CharacterBlock.vue'
import SceneBlock from './SceneBlock.vue'
-import type { useResourcePanel } from '@/composables/useResourcePanel'
+import type { Character, Scene } from '@/types/drama'
-const props = defineProps<{
- resource: ReturnType<typeof useResourcePanel>
+defineProps<{
+ characters: Character[]
+ scenes: Scene[]
+ hasCharacters: boolean
+ hasScenes: boolean
}>()
defineEmits<{
- extract: []
- uploadScript: []
- rewriteScript: []
generateCharacterImage: [id: number]
batchGenerateCharacters: []
generateSceneImage: [id: number]
batchGenerateScenes: []
}>()
+
+type PanelBlock = 'characters' | 'scenes' | null
+const activeBlock = ref<PanelBlock>(null)
+
+function toggleBlock(block: PanelBlock) {
+ activeBlock.value = activeBlock.value === block ? null : block
+}
</script>
<template>
- <aside class="resource-panel">
- <ScriptBlock
- :script-content="resource.scriptContent"
- :expanded="resource.expandedBlock === 'script'"
- :has-content="resource.hasScript"
- @toggle="resource.toggleBlock('script')"
- @save="resource.saveScript"
- @extract="$emit('extract')"
- @upload="$emit('uploadScript')"
- @rewrite="$emit('rewriteScript')"
- />
- <CharacterBlock
- :characters="resource.characters"
- :expanded="resource.expandedBlock === 'characters'"
- :has-content="resource.hasCharacters"
- @toggle="resource.toggleBlock('characters')"
- @generate-image="$emit('generateCharacterImage', $event)"
- @batch-generate="$emit('batchGenerateCharacters')"
- />
- <SceneBlock
- :scenes="resource.scenes"
- :expanded="resource.expandedBlock === 'scenes'"
- :has-content="resource.hasScenes"
- @toggle="resource.toggleBlock('scenes')"
- @generate-image="$emit('generateSceneImage', $event)"
- @batch-generate="$emit('batchGenerateScenes')"
- />
+ <aside class="resource-rail">
+ <!-- Icon rail -->
+ <div class="rail-icons">
+ <Tooltip>
+ <TooltipTrigger as-child>
+ <button
+ class="rail-icon-btn"
+ :class="{ active: activeBlock === 'characters' }"
+ @click="toggleBlock('characters')"
+ >
+ <User :size="18" />
+ <span v-if="hasCharacters" class="rail-dot" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent side="right">角色</TooltipContent>
+ </Tooltip>
+ <Tooltip>
+ <TooltipTrigger as-child>
+ <button
+ class="rail-icon-btn"
+ :class="{ active: activeBlock === 'scenes' }"
+ @click="toggleBlock('scenes')"
+ >
+ <MapPin :size="18" />
+ <span v-if="hasScenes" class="rail-dot" />
+ </button>
+ </TooltipTrigger>
+ <TooltipContent side="right">场景</TooltipContent>
+ </Tooltip>
+ </div>
+
+ <!-- Expanded panel -->
+ <div v-if="activeBlock" class="rail-panel">
+ <CharacterBlock
+ v-if="activeBlock === 'characters'"
+ :characters="characters"
+ :expanded="true"
+ :has-content="hasCharacters"
+ @toggle="toggleBlock(null)"
+ @generate-image="$emit('generateCharacterImage', $event)"
+ @batch-generate="$emit('batchGenerateCharacters')"
+ />
+ <SceneBlock
+ v-if="activeBlock === 'scenes'"
+ :scenes="scenes"
+ :expanded="true"
+ :has-content="hasScenes"
+ @toggle="toggleBlock(null)"
+ @generate-image="$emit('generateSceneImage', $event)"
+ @batch-generate="$emit('batchGenerateScenes')"
+ />
+ </div>
</aside>
</template>
<style scoped>
-.resource-panel {
+.resource-rail {
display: flex;
- flex-direction: column;
+ flex-shrink: 0;
height: 100%;
- background: var(--bg-card);
border-right: 1px solid var(--border-primary);
+ background: var(--bg-card);
+}
+
+.rail-icons {
+ width: 44px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ padding: 8px 0;
+ gap: 4px;
+}
+
+.rail-icon-btn {
+ position: relative;
+ width: 36px;
+ height: 36px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border: none;
+ border-radius: 8px;
+ background: transparent;
+ color: var(--text-muted);
+ cursor: pointer;
+ transition: all 0.15s;
+}
+
+.rail-icon-btn:hover {
+ background: var(--bg-card-hover);
+ color: var(--text-primary);
+}
+
+.rail-icon-btn.active {
+ background: rgba(232, 162, 67, 0.1);
+ color: var(--accent, #e8a243);
+}
+
+.rail-dot {
+ position: absolute;
+ top: 6px;
+ right: 6px;
+ width: 6px;
+ height: 6px;
+ border-radius: 50%;
+ background: var(--accent, #e8a243);
+}
+
+.rail-panel {
+ width: 260px;
overflow-y: auto;
+ border-left: 1px solid var(--border-primary);
}
</style>
diff --git a/web/src/views/drama/episode/workbench/ScriptTab.vue b/web/src/views/drama/episode/workbench/ScriptTab.vue
new file mode 100644
index 0000000..f1e793f
--- /dev/null
+++ b/web/src/views/drama/episode/workbench/ScriptTab.vue
@@ -0,0 +1,233 @@
+<script setup lang="ts">
+import { ref, watch, computed } from 'vue'
+import { Button } from '@/components/ui/button'
+import { Badge } from '@/components/ui/badge'
+import {
+ Upload,
+ Wand2,
+ FileText,
+ Save,
+ Users,
+ MapPin,
+} from 'lucide-vue-next'
+
+const props = defineProps<{
+ scriptContent: string
+ hasScript: boolean
+ hasCharacters: boolean
+ hasScenes: boolean
+ characterCount: number
+ sceneCount: number
+}>()
+
+const emit = defineEmits<{
+ save: [content: string]
+ upload: []
+ rewrite: []
+ extract: []
+}>()
+
+const localContent = ref(props.scriptContent)
+const isDirty = ref(false)
+
+watch(
+ () => props.scriptContent,
+ (val) => {
+ localContent.value = val
+ isDirty.value = false
+ },
+)
+
+function onInput(e: Event) {
+ localContent.value = (e.target as HTMLTextAreaElement).value
+ isDirty.value = localContent.value !== props.scriptContent
+}
+
+function handleSave() {
+ emit('save', localContent.value)
+ isDirty.value = false
+}
+
+const wordCount = computed(() => {
+ return localContent.value.replace(/\s/g, '').length
+})
+
+const pipelineHint = computed(() => {
+ if (!props.hasScript) return '上传或粘贴剧本内容开始制作'
+ if (!props.hasCharacters && !props.hasScenes) return '剧本就绪,可以改写为格式化剧本或提取角色场景'
+ return '角色场景已提取,可以切换到分镜 Tab 拆解分镜'
+})
+</script>
+
+<template>
+ <div class="script-tab">
+ <!-- Toolbar -->
+ <div class="script-toolbar">
+ <div class="script-toolbar-left">
+ <span class="script-toolbar-title">剧本</span>
+ <Badge v-if="hasScript" variant="secondary" class="word-badge">{{ wordCount.toLocaleString() }}字</Badge>
+ <Badge v-if="hasCharacters" class="resource-badge resource-badge--char">
+ <Users :size="10" />
+ {{ characterCount }}
+ </Badge>
+ <Badge v-if="hasScenes" class="resource-badge resource-badge--scene">
+ <MapPin :size="10" />
+ {{ sceneCount }}
+ </Badge>
+ </div>
+ <div class="script-toolbar-right">
+ <Button variant="ghost" size="sm" class="tb-btn" @click="emit('upload')">
+ <Upload :size="13" />
+ 上传
+ </Button>
+ <Button variant="ghost" size="sm" class="tb-btn" :disabled="!hasScript" @click="emit('rewrite')">
+ <Wand2 :size="13" />
+ AI 改写
+ </Button>
+ <Button variant="ghost" size="sm" class="tb-btn" :disabled="!hasScript" @click="emit('extract')">
+ <FileText :size="13" />
+ 提取角色&场景
+ </Button>
+ <Button v-if="isDirty" size="sm" class="tb-btn tb-btn--save" @click="handleSave">
+ <Save :size="13" />
+ 保存
+ </Button>
+ </div>
+ </div>
+
+ <!-- Editor -->
+ <div class="script-editor">
+ <textarea
+ class="script-textarea"
+ :value="localContent"
+ :placeholder="pipelineHint"
+ @input="onInput"
+ />
+ </div>
+
+ <!-- Pipeline hint -->
+ <div class="script-hint">
+ {{ pipelineHint }}
+ </div>
+ </div>
+</template>
+
+<style scoped>
+.script-tab {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ overflow: hidden;
+}
+
+.script-toolbar {
+ flex-shrink: 0;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 6px 12px;
+ border-bottom: 1px solid var(--border-primary);
+ gap: 8px;
+ flex-wrap: wrap;
+}
+
+.script-toolbar-left {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+}
+
+.script-toolbar-title {
+ font-size: 13px;
+ font-weight: 600;
+ color: var(--text-primary);
+}
+
+.word-badge {
+ font-size: 10px !important;
+ padding: 1px 7px !important;
+ height: auto !important;
+}
+
+.resource-badge {
+ font-size: 10px !important;
+ padding: 1px 7px !important;
+ height: auto !important;
+ border-radius: 9999px !important;
+ border: none !important;
+ display: inline-flex;
+ align-items: center;
+ gap: 3px;
+}
+
+.resource-badge--char {
+ background: rgba(232, 162, 67, 0.15) !important;
+ color: rgba(232, 162, 67, 0.9) !important;
+}
+
+.resource-badge--scene {
+ background: rgba(96, 165, 250, 0.15) !important;
+ color: rgba(96, 165, 250, 0.9) !important;
+}
+
+.script-toolbar-right {
+ display: flex;
+ align-items: center;
+ gap: 2px;
+}
+
+.tb-btn {
+ font-size: 11px !important;
+ height: 28px !important;
+ padding: 0 8px !important;
+ color: var(--text-secondary) !important;
+}
+
+.tb-btn:hover {
+ color: var(--text-primary) !important;
+}
+
+.tb-btn--save {
+ color: var(--text-inverse) !important;
+ background: var(--accent) !important;
+}
+
+.script-editor {
+ flex: 1;
+ min-height: 0;
+ padding: 12px;
+}
+
+.script-textarea {
+ width: 100%;
+ height: 100%;
+ padding: 16px;
+ font-size: 13px;
+ line-height: 1.8;
+ color: var(--text-primary);
+ background: var(--bg-card);
+ border: 1px solid var(--border-primary);
+ border-radius: 8px;
+ resize: none;
+ outline: none;
+ font-family: inherit;
+ transition: border-color 0.15s;
+}
+
+.script-textarea:focus {
+ border-color: var(--accent);
+}
+
+.script-textarea::placeholder {
+ color: var(--text-muted);
+}
+
+.script-hint {
+ flex-shrink: 0;
+ padding: 6px 12px;
+ border-top: 1px solid var(--border-primary);
+ font-size: 11px;
+ color: var(--text-muted);
+ background: var(--bg-card);
+}
+</style>
diff --git a/web/src/views/drama/episode/workbench/StoryboardCard.vue b/web/src/views/drama/episode/workbench/StoryboardCard.vue
deleted file mode 100644
index b66e011..0000000
--- a/web/src/views/drama/episode/workbench/StoryboardCard.vue
+++ /dev/null
@@ -1,255 +0,0 @@
-<script setup lang="ts">
-import { computed } from 'vue'
-import { Loader2 } from 'lucide-vue-next'
-import type { Storyboard } from '@/types/drama'
-import { getImageUrl } from '@/utils/image'
-
-const props = defineProps<{
- storyboard: Storyboard
- index: number
-}>()
-
-const emit = defineEmits<{
- select: [id: string]
-}>()
-
-const hasImage = computed(() => !!props.storyboard.image_url || !!props.storyboard.local_path)
-const hasVideo = computed(() => !!props.storyboard.video_url)
-const isGenerating = computed(() =>
- props.storyboard.image_generation_status === 'processing' ||
- props.storyboard.image_generation_status === 'generating' ||
- props.storyboard.status === 'processing' ||
- props.storyboard.status === 'generating'
-)
-
-const thumbnailUrl = computed(() => getImageUrl(props.storyboard))
-
-const borderClass = computed(() => {
- if (isGenerating.value) return 'card--generating'
- if (hasImage.value && hasVideo.value) return 'card--complete'
- if (hasImage.value) return 'card--has-image'
- return 'card--pending'
-})
-
-const statusText = computed(() => {
- if (isGenerating.value) return '生成中'
- if (hasImage.value && hasVideo.value) return '完成'
- if (hasImage.value) return '有图'
- return '待处理'
-})
-</script>
-
-<template>
- <div
- class="storyboard-card"
- :class="borderClass"
- @click="emit('select', storyboard.id)"
- >
- <!-- Thumbnail area -->
- <div class="card-thumb">
- <img
- v-if="hasImage && thumbnailUrl"
- :src="thumbnailUrl"
- :alt="storyboard.title || `镜头 ${index + 1}`"
- class="card-thumb__img"
- />
- <div v-else-if="isGenerating" class="card-thumb__loader">
- <Loader2 :size="20" class="animate-spin" />
- </div>
- <div v-else class="card-thumb__placeholder">
- 待生成
- </div>
-
- <!-- Number overlay top-left -->
- <span class="card-number">#{{ index + 1 }}</span>
-
- <!-- Status badge top-right -->
- <span class="card-status" :class="borderClass">
- <template v-if="hasImage && hasVideo">&#127916;&#10003;</template>
- <template v-else-if="isGenerating">
- <Loader2 :size="10" class="animate-spin" />
- </template>
- <template v-else>{{ statusText }}</template>
- </span>
- </div>
-
- <!-- Info area -->
- <div class="card-info">
- <div class="card-info__row">
- <span class="card-title">{{ storyboard.title || `镜头 ${index + 1}` }}</span>
- <span v-if="storyboard.location" class="card-sep">&middot;</span>
- <span v-if="storyboard.location" class="card-location">{{ storyboard.location }}</span>
- </div>
- <div class="card-info__row card-info__row--sub">
- <span v-if="storyboard.shot_type" class="card-meta">{{ storyboard.shot_type }}</span>
- <span v-if="storyboard.shot_type && storyboard.movement" class="card-sep">&middot;</span>
- <span v-if="storyboard.movement" class="card-meta">{{ storyboard.movement }}</span>
- </div>
- </div>
- </div>
-</template>
-
-<style scoped>
-.storyboard-card {
- display: flex;
- flex-direction: column;
- border-radius: var(--radius-md, 8px);
- border: 1.5px solid rgba(255, 255, 255, 0.08);
- background: var(--bg-card, rgba(255, 255, 255, 0.04));
- cursor: pointer;
- overflow: hidden;
- transition: all 0.2s ease;
-}
-
-.storyboard-card:hover {
- border-color: rgba(255, 255, 255, 0.18);
- box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
- transform: translateY(-1px);
-}
-
-/* Border color variants */
-.card--pending {
- border-color: rgba(255, 255, 255, 0.08);
-}
-
-.card--generating {
- border-color: rgba(96, 165, 250, 0.4);
-}
-
-.card--has-image {
- border-color: rgba(232, 162, 67, 0.3);
-}
-
-.card--complete {
- border-color: rgba(94, 230, 176, 0.3);
-}
-
-/* Thumbnail */
-.card-thumb {
- position: relative;
- width: 100%;
- height: 80px;
- background: var(--bg-primary, rgba(0, 0, 0, 0.2));
- overflow: hidden;
-}
-
-.card-thumb__img {
- width: 100%;
- height: 100%;
- object-fit: cover;
-}
-
-.card-thumb__loader {
- display: flex;
- align-items: center;
- justify-content: center;
- height: 100%;
- color: rgba(96, 165, 250, 0.7);
-}
-
-.card-thumb__placeholder {
- display: flex;
- align-items: center;
- justify-content: center;
- height: 100%;
- font-size: 11px;
- color: var(--text-muted, rgba(255, 255, 255, 0.35));
-}
-
-/* Overlays */
-.card-number {
- position: absolute;
- top: 4px;
- left: 4px;
- font-size: 10px;
- font-weight: 600;
- color: rgba(255, 255, 255, 0.85);
- background: rgba(0, 0, 0, 0.5);
- padding: 1px 5px;
- border-radius: 4px;
- line-height: 1.4;
-}
-
-.card-status {
- position: absolute;
- top: 4px;
- right: 4px;
- font-size: 9px;
- font-weight: 500;
- padding: 1px 5px;
- border-radius: 4px;
- line-height: 1.4;
- display: inline-flex;
- align-items: center;
- gap: 2px;
-}
-
-.card-status.card--pending {
- background: rgba(255, 255, 255, 0.1);
- color: rgba(255, 255, 255, 0.5);
-}
-
-.card-status.card--generating {
- background: rgba(96, 165, 250, 0.2);
- color: rgba(96, 165, 250, 0.9);
-}
-
-.card-status.card--has-image {
- background: rgba(232, 162, 67, 0.2);
- color: rgba(232, 162, 67, 0.9);
-}
-
-.card-status.card--complete {
- background: rgba(94, 230, 176, 0.2);
- color: rgba(94, 230, 176, 0.9);
-}
-
-/* Info */
-.card-info {
- padding: 6px 8px;
- display: flex;
- flex-direction: column;
- gap: 2px;
-}
-
-.card-info__row {
- display: flex;
- align-items: center;
- gap: 4px;
- min-width: 0;
- overflow: hidden;
-}
-
-.card-info__row--sub {
- font-size: 10px;
- color: var(--text-muted, rgba(255, 255, 255, 0.35));
-}
-
-.card-title {
- font-size: 11px;
- font-weight: 500;
- color: var(--text-primary, rgba(255, 255, 255, 0.9));
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-.card-sep {
- color: var(--text-muted, rgba(255, 255, 255, 0.25));
- flex-shrink: 0;
-}
-
-.card-location {
- font-size: 10px;
- color: var(--text-secondary, rgba(255, 255, 255, 0.55));
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-.card-meta {
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-</style>
diff --git a/web/src/views/drama/episode/workbench/StoryboardEditor.vue b/web/src/views/drama/episode/workbench/StoryboardEditor.vue
deleted file mode 100644
index cd8e412..0000000
--- a/web/src/views/drama/episode/workbench/StoryboardEditor.vue
+++ /dev/null
@@ -1,121 +0,0 @@
-<script setup lang="ts">
-import { Button } from '@/components/ui/button'
-import { ArrowLeft } from 'lucide-vue-next'
-import type { Storyboard, Character, Scene } from '@/types/drama'
-import type { ImageGeneration } from '@/types/image'
-import StoryboardStrip from './StoryboardStrip.vue'
-import PreviewPane from './PreviewPane.vue'
-import PropertiesPanel from './PropertiesPanel.vue'
-
-defineProps<{
- storyboards: Storyboard[]
- currentStoryboard: Storyboard | null
- currentId: string | null
- characters: Character[]
- scenes: Scene[]
- images: ImageGeneration[]
- videoUrl: string | null
-}>()
-
-const emit = defineEmits<{
- select: [id: string]
- back: []
- add: []
- saveField: [field: string, value: any]
- generateImage: []
- generateVideo: []
- showCharacterSelector: []
- showSceneSelector: []
-}>()
-</script>
-
-<template>
- <div class="editor-root">
- <!-- Back button bar -->
- <div class="editor-topbar">
- <Button variant="ghost" size="sm" class="back-btn" @click="emit('back')">
- <ArrowLeft :size="14" />
- 返回网格
- </Button>
- <span v-if="currentStoryboard" class="topbar-title">
- #{{ currentStoryboard.storyboard_number }}
- {{ currentStoryboard.title || '' }}
- </span>
- </div>
-
- <!-- Main three-column layout -->
- <div class="editor-body">
- <StoryboardStrip
- :storyboards="storyboards"
- :current-id="currentId"
- @select="emit('select', $event)"
- @add="emit('add')"
- />
-
- <PreviewPane
- :storyboard="currentStoryboard"
- :images="images"
- :video-url="videoUrl"
- />
-
- <PropertiesPanel
- :storyboard="currentStoryboard"
- :characters="characters"
- :scenes="scenes"
- @save-field="(f: string, v: any) => emit('saveField', f, v)"
- @generate-image="emit('generateImage')"
- @generate-video="emit('generateVideo')"
- @show-character-selector="emit('showCharacterSelector')"
- @show-scene-selector="emit('showSceneSelector')"
- />
- </div>
- </div>
-</template>
-
-<style scoped>
-.editor-root {
- display: flex;
- flex-direction: column;
- height: 100%;
- overflow: hidden;
-}
-
-.editor-topbar {
- flex-shrink: 0;
- display: flex;
- align-items: center;
- gap: 10px;
- padding: 4px 10px;
- border-bottom: 1px solid var(--border-primary, rgba(255, 255, 255, 0.06));
- background: var(--bg-secondary, rgba(0, 0, 0, 0.15));
- height: 36px;
-}
-
-.back-btn {
- font-size: 12px !important;
- height: 26px !important;
- padding: 0 8px !important;
- gap: 4px;
- color: var(--text-secondary, rgba(255, 255, 255, 0.55)) !important;
-}
-
-.back-btn:hover {
- color: var(--text-primary, rgba(255, 255, 255, 0.9)) !important;
-}
-
-.topbar-title {
- font-size: 12px;
- font-weight: 500;
- color: var(--text-primary, rgba(255, 255, 255, 0.9));
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-.editor-body {
- flex: 1;
- min-height: 0;
- display: flex;
- flex-direction: row;
-}
-</style>
diff --git a/web/src/views/drama/episode/workbench/StoryboardGrid.vue b/web/src/views/drama/episode/workbench/StoryboardGrid.vue
deleted file mode 100644
index 5e91630..0000000
--- a/web/src/views/drama/episode/workbench/StoryboardGrid.vue
+++ /dev/null
@@ -1,222 +0,0 @@
-<script setup lang="ts">
-import { computed } from 'vue'
-import { Button } from '@/components/ui/button'
-import { Badge } from '@/components/ui/badge'
-import { Plus, Image, Video, Wand2 } from 'lucide-vue-next'
-import type { Storyboard } from '@/types/drama'
-import StoryboardCard from './StoryboardCard.vue'
-
-const props = defineProps<{
- storyboards: Storyboard[]
- progress: { total: number; withImage: number; withVideo: number }
-}>()
-
-const emit = defineEmits<{
- select: [id: string]
- add: []
- batchGenerateImages: []
- batchGenerateVideos: []
-}>()
-
-const generatingCount = computed(() =>
- props.storyboards.filter(s =>
- s.image_generation_status === 'processing' ||
- s.image_generation_status === 'generating' ||
- s.status === 'processing' ||
- s.status === 'generating'
- ).length
-)
-
-const pendingCount = computed(() =>
- props.progress.total - props.progress.withImage - generatingCount.value
-)
-</script>
-
-<template>
- <div class="storyboard-grid">
- <!-- Toolbar -->
- <div class="grid-toolbar">
- <div class="toolbar-left">
- <span class="toolbar-title">镜头 ({{ progress.total }})</span>
- <div class="toolbar-badges">
- <Badge v-if="progress.withVideo > 0" class="badge badge--complete">
- 完成 {{ progress.withVideo }}
- </Badge>
- <Badge v-if="progress.withImage - progress.withVideo > 0" class="badge badge--image">
- 有图 {{ progress.withImage - progress.withVideo }}
- </Badge>
- <Badge v-if="generatingCount > 0" class="badge badge--generating">
- 生成中 {{ generatingCount }}
- </Badge>
- <Badge v-if="pendingCount > 0" class="badge badge--pending">
- 待处理 {{ pendingCount }}
- </Badge>
- </div>
- </div>
- <div class="toolbar-actions">
- <Button variant="ghost" size="sm" class="toolbar-btn" @click="emit('add')">
- <Plus :size="14" />
- 添加
- </Button>
- <Button variant="ghost" size="sm" class="toolbar-btn" @click="emit('batchGenerateImages')">
- <Image :size="14" />
- 批量生成图片
- </Button>
- <Button variant="ghost" size="sm" class="toolbar-btn" @click="emit('batchGenerateVideos')">
- <Video :size="14" />
- 批量生成视频
- </Button>
- </div>
- </div>
-
- <!-- Grid -->
- <div v-if="storyboards.length > 0" class="grid-container">
- <StoryboardCard
- v-for="(sb, idx) in storyboards"
- :key="sb.id"
- :storyboard="sb"
- :index="idx"
- @select="emit('select', $event)"
- />
- </div>
-
- <!-- Empty state -->
- <div v-else class="grid-empty">
- <div class="grid-empty__content">
- <Wand2 :size="32" class="grid-empty__icon" />
- <p class="grid-empty__text">暂无分镜,点击下方按钮开始创作</p>
- <Button variant="outline" size="sm" class="grid-empty__btn" @click="emit('add')">
- <Wand2 :size="14" />
- Agent 拆解分镜
- </Button>
- </div>
- </div>
- </div>
-</template>
-
-<style scoped>
-.storyboard-grid {
- display: flex;
- flex-direction: column;
- height: 100%;
- overflow: hidden;
-}
-
-/* Toolbar */
-.grid-toolbar {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 8px 12px;
- border-bottom: 1px solid var(--border-primary, rgba(255, 255, 255, 0.06));
- flex-shrink: 0;
- gap: 8px;
- flex-wrap: wrap;
-}
-
-.toolbar-left {
- display: flex;
- align-items: center;
- gap: 8px;
- flex-wrap: wrap;
-}
-
-.toolbar-title {
- font-size: 13px;
- font-weight: 600;
- color: var(--text-primary, rgba(255, 255, 255, 0.9));
- white-space: nowrap;
-}
-
-.toolbar-badges {
- display: flex;
- align-items: center;
- gap: 4px;
- flex-wrap: wrap;
-}
-
-.badge {
- font-size: 10px !important;
- padding: 1px 7px !important;
- height: auto !important;
- border-radius: 9999px !important;
- font-weight: 500 !important;
- border: none !important;
-}
-
-.badge--complete {
- background: rgba(94, 230, 176, 0.15) !important;
- color: rgba(94, 230, 176, 0.9) !important;
-}
-
-.badge--image {
- background: rgba(232, 162, 67, 0.15) !important;
- color: rgba(232, 162, 67, 0.9) !important;
-}
-
-.badge--generating {
- background: rgba(96, 165, 250, 0.15) !important;
- color: rgba(96, 165, 250, 0.9) !important;
-}
-
-.badge--pending {
- background: rgba(255, 255, 255, 0.06) !important;
- color: rgba(255, 255, 255, 0.45) !important;
-}
-
-.toolbar-actions {
- display: flex;
- align-items: center;
- gap: 2px;
-}
-
-.toolbar-btn {
- font-size: 11px !important;
- height: 28px !important;
- padding: 0 8px !important;
- color: var(--text-secondary, rgba(255, 255, 255, 0.55)) !important;
-}
-
-.toolbar-btn:hover {
- color: var(--text-primary, rgba(255, 255, 255, 0.9)) !important;
-}
-
-/* Grid */
-.grid-container {
- display: grid;
- grid-template-columns: repeat(5, 1fr);
- gap: 8px;
- padding: 10px 12px;
- overflow-y: auto;
- flex: 1;
-}
-
-/* Empty state */
-.grid-empty {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.grid-empty__content {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 12px;
-}
-
-.grid-empty__icon {
- color: var(--text-muted, rgba(255, 255, 255, 0.25));
-}
-
-.grid-empty__text {
- font-size: 13px;
- color: var(--text-muted, rgba(255, 255, 255, 0.35));
-}
-
-.grid-empty__btn {
- font-size: 12px !important;
- color: var(--text-secondary, rgba(255, 255, 255, 0.55)) !important;
-}
-</style>
diff --git a/web/src/views/drama/episode/workbench/StoryboardStrip.vue b/web/src/views/drama/episode/workbench/StoryboardStrip.vue
deleted file mode 100644
index 1c54a6b..0000000
--- a/web/src/views/drama/episode/workbench/StoryboardStrip.vue
+++ /dev/null
@@ -1,151 +0,0 @@
-<script setup lang="ts">
-import { Plus } from 'lucide-vue-next'
-import { ScrollArea } from '@/components/ui/scroll-area'
-import { Button } from '@/components/ui/button'
-import type { Storyboard } from '@/types/drama'
-import { getImageUrl } from '@/utils/image'
-
-defineProps<{
- storyboards: Storyboard[]
- currentId: string | null
-}>()
-
-const emit = defineEmits<{
- select: [id: string]
- add: []
-}>()
-
-function thumbnailFor(sb: Storyboard): string {
- return getImageUrl(sb)
-}
-</script>
-
-<template>
- <div class="strip-root">
- <ScrollArea class="strip-scroll">
- <div class="strip-list">
- <div
- v-for="(sb, idx) in storyboards"
- :key="sb.id"
- class="strip-item"
- :class="{ 'strip-item--active': sb.id === currentId }"
- @click="emit('select', sb.id)"
- >
- <div class="strip-thumb">
- <img
- v-if="thumbnailFor(sb)"
- :src="thumbnailFor(sb)"
- :alt="`#${idx + 1}`"
- class="strip-thumb__img"
- />
- <div v-else class="strip-thumb__empty">
- {{ idx + 1 }}
- </div>
- </div>
- <span class="strip-num">#{{ idx + 1 }}</span>
- </div>
- </div>
- </ScrollArea>
-
- <div class="strip-footer">
- <Button variant="ghost" size="sm" class="strip-add-btn" @click="emit('add')">
- <Plus :size="14" />
- </Button>
- </div>
- </div>
-</template>
-
-<style scoped>
-.strip-root {
- width: 80px;
- flex-shrink: 0;
- display: flex;
- flex-direction: column;
- border-right: 1px solid var(--border-primary, rgba(255, 255, 255, 0.06));
- background: var(--bg-secondary, rgba(0, 0, 0, 0.15));
-}
-
-.strip-scroll {
- flex: 1;
- min-height: 0;
-}
-
-.strip-list {
- display: flex;
- flex-direction: column;
- gap: 4px;
- padding: 6px 8px;
-}
-
-.strip-item {
- position: relative;
- width: 64px;
- cursor: pointer;
- border-radius: 6px;
- border: 1.5px solid transparent;
- overflow: hidden;
- transition: border-color 0.15s ease;
-}
-
-.strip-item:hover {
- border-color: rgba(255, 255, 255, 0.15);
-}
-
-.strip-item--active {
- border-color: var(--accent, #e8a243);
- box-shadow: 0 0 0 1px var(--accent, #e8a243);
-}
-
-.strip-thumb {
- width: 100%;
- aspect-ratio: 16 / 9;
- background: var(--bg-primary, rgba(0, 0, 0, 0.2));
- overflow: hidden;
-}
-
-.strip-thumb__img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- display: block;
-}
-
-.strip-thumb__empty {
- width: 100%;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 12px;
- font-weight: 600;
- color: var(--text-muted, rgba(255, 255, 255, 0.3));
-}
-
-.strip-num {
- display: block;
- text-align: center;
- font-size: 9px;
- font-weight: 500;
- color: var(--text-secondary, rgba(255, 255, 255, 0.55));
- padding: 2px 0;
-}
-
-.strip-footer {
- flex-shrink: 0;
- padding: 6px;
- border-top: 1px solid var(--border-primary, rgba(255, 255, 255, 0.06));
- display: flex;
- justify-content: center;
-}
-
-.strip-add-btn {
- width: 32px !important;
- height: 32px !important;
- padding: 0 !important;
- color: var(--text-secondary, rgba(255, 255, 255, 0.55)) !important;
-}
-
-.strip-add-btn:hover {
- color: var(--text-primary, rgba(255, 255, 255, 0.9)) !important;
-}
-</style>
diff --git a/web/src/views/drama/episode/workbench/StoryboardTable.vue b/web/src/views/drama/episode/workbench/StoryboardTable.vue
new file mode 100644
index 0000000..8d8e187
--- /dev/null
+++ b/web/src/views/drama/episode/workbench/StoryboardTable.vue
@@ -0,0 +1,224 @@
+<script setup lang="ts">
+import { computed } from 'vue'
+import { Checkbox } from '@/components/ui/checkbox'
+import { Wand2 } from 'lucide-vue-next'
+import { Button } from '@/components/ui/button'
+import type { Storyboard, Character, Scene } from '@/types/drama'
+import TableToolbar from './TableToolbar.vue'
+import StoryboardTableRow from './StoryboardTableRow.vue'
+
+const props = defineProps<{
+ storyboards: Storyboard[]
+ characters: Character[]
+ scenes: Scene[]
+ selectedIds: Set<string>
+ allSelected: boolean
+ hasSelection: boolean
+ progress: {
+ total: number
+ withImage: number
+ withVideo: number
+ generating: number
+ totalDuration: number
+ }
+}>()
+
+const emit = defineEmits<{
+ toggleSelect: [id: string]
+ toggleSelectAll: []
+ clearSelection: []
+ saveField: [id: string, field: string, value: any]
+ generateImage: [id: string]
+ generateVideo: [id: string]
+ add: []
+ batchImages: []
+ batchVideos: []
+ generateGrid: []
+ breakdown: []
+}>()
+
+const durationDisplay = computed(() => {
+ const secs = props.progress.totalDuration
+ const min = Math.floor(secs / 60)
+ const sec = secs % 60
+ return `${min}:${String(sec).padStart(2, '0')}`
+})
+</script>
+
+<template>
+ <div class="storyboard-table-root">
+ <template v-if="storyboards.length > 0">
+ <TableToolbar
+ :total="progress.total"
+ :with-image="progress.withImage"
+ :with-video="progress.withVideo"
+ :generating="progress.generating"
+ :has-selection="hasSelection"
+ :selection-count="selectedIds.size"
+ @add="emit('add')"
+ @batch-images="emit('batchImages')"
+ @batch-videos="emit('batchVideos')"
+ @generate-grid="emit('generateGrid')"
+ @clear-selection="emit('clearSelection')"
+ />
+
+ <div class="table-scroll">
+ <table class="sb-table">
+ <thead>
+ <tr class="table-header">
+ <th class="th th--checkbox">
+ <Checkbox :checked="allSelected" @update:checked="emit('toggleSelectAll')" />
+ </th>
+ <th class="th th--seq">#</th>
+ <th class="th th--thumb">缩略图</th>
+ <th class="th">场景</th>
+ <th class="th">景别</th>
+ <th class="th">描述</th>
+ <th class="th">视频提示词</th>
+ <th class="th">角色</th>
+ <th class="th">对白</th>
+ <th class="th">状态</th>
+ <th class="th th--actions">操作</th>
+ </tr>
+ </thead>
+ <tbody>
+ <StoryboardTableRow
+ v-for="(sb, idx) in storyboards"
+ :key="sb.id"
+ :storyboard="sb"
+ :index="idx"
+ :selected="selectedIds.has(sb.id)"
+ :characters="characters"
+ :scenes="scenes"
+ @toggle-select="emit('toggleSelect', $event)"
+ @save-field="(id: string, field: string, value: any) => emit('saveField', id, field, value)"
+ @generate-image="emit('generateImage', $event)"
+ @generate-video="emit('generateVideo', $event)"
+ />
+ </tbody>
+ </table>
+ </div>
+
+ <!-- Status bar -->
+ <div class="status-bar">
+ <span>共 {{ progress.total }} 镜头</span>
+ <span class="status-sep">|</span>
+ <span>有图 {{ progress.withImage }}</span>
+ <span class="status-sep">|</span>
+ <span>有视频 {{ progress.withVideo }}</span>
+ <span class="status-sep">|</span>
+ <span>预计 {{ durationDisplay }}</span>
+ </div>
+ </template>
+
+ <!-- Empty state -->
+ <div v-else class="table-empty">
+ <Wand2 :size="32" class="table-empty__icon" />
+ <p class="table-empty__text">暂无分镜</p>
+ <p class="table-empty__hint">请先在「剧本」页完成改写和角色场景提取,然后拆解分镜</p>
+ <Button variant="outline" size="sm" @click="emit('breakdown')">
+ <Wand2 :size="14" />
+ Agent 拆解分镜
+ </Button>
+ </div>
+ </div>
+</template>
+
+<style scoped>
+.storyboard-table-root {
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ overflow: hidden;
+}
+
+.table-scroll {
+ flex: 1;
+ overflow: auto;
+}
+
+.sb-table {
+ width: 100%;
+ border-collapse: collapse;
+ table-layout: auto;
+}
+
+.table-header {
+ position: sticky;
+ top: 0;
+ z-index: 10;
+ background: var(--bg-card, rgba(255, 255, 255, 0.04));
+ border-bottom: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
+}
+
+.th {
+ padding: 6px 8px;
+ font-size: 11px;
+ font-weight: 600;
+ color: var(--text-secondary);
+ text-align: left;
+ white-space: nowrap;
+ text-transform: uppercase;
+ letter-spacing: 0.3px;
+}
+
+.th--checkbox {
+ width: 32px;
+ text-align: center;
+}
+
+.th--seq {
+ width: 52px;
+}
+
+.th--thumb {
+ width: 168px;
+}
+
+.th--actions {
+ width: 72px;
+}
+
+/* Status bar */
+.status-bar {
+ flex-shrink: 0;
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 6px 12px;
+ border-top: 1px solid var(--border-primary, rgba(255, 255, 255, 0.06));
+ font-size: 11px;
+ color: var(--text-muted);
+ background: var(--bg-card);
+}
+
+.status-sep {
+ color: var(--border-primary);
+}
+
+/* Empty state */
+.table-empty {
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 12px;
+}
+
+.table-empty__icon {
+ color: var(--text-muted);
+}
+
+.table-empty__text {
+ font-size: 14px;
+ color: var(--text-secondary);
+ margin: 0;
+}
+
+.table-empty__hint {
+ font-size: 12px;
+ color: var(--text-muted);
+ margin: 0;
+}
+</style>
diff --git a/web/src/views/drama/episode/workbench/StoryboardTableRow.vue b/web/src/views/drama/episode/workbench/StoryboardTableRow.vue
new file mode 100644
index 0000000..cdee5da
--- /dev/null
+++ b/web/src/views/drama/episode/workbench/StoryboardTableRow.vue
@@ -0,0 +1,451 @@
+<script setup lang="ts">
+import { ref, computed, nextTick } from 'vue'
+import { Badge } from '@/components/ui/badge'
+import { Button } from '@/components/ui/button'
+import { Checkbox } from '@/components/ui/checkbox'
+import {
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from '@/components/ui/select'
+import { ImageIcon, Video, Loader2 } from 'lucide-vue-next'
+import type { Storyboard, Character, Scene } from '@/types/drama'
+import { getImageUrl } from '@/utils/image'
+
+const props = defineProps<{
+ storyboard: Storyboard
+ index: number
+ selected: boolean
+ characters: Character[]
+ scenes: Scene[]
+}>()
+
+const emit = defineEmits<{
+ toggleSelect: [id: string]
+ saveField: [id: string, field: string, value: any]
+ generateImage: [id: string]
+ generateVideo: [id: string]
+}>()
+
+const shotTypeOptions = ['远景', '全景', '中景', '近景', '特写']
+
+const editingField = ref<string | null>(null)
+const editValue = ref('')
+
+const thumbnailUrl = computed(() => getImageUrl(props.storyboard))
+
+const hasImage = computed(() => !!props.storyboard.image_url || !!props.storyboard.local_path)
+const hasVideo = computed(() => !!props.storyboard.video_url)
+const isGenerating = computed(() =>
+ props.storyboard.image_generation_status === 'processing' ||
+ props.storyboard.image_generation_status === 'generating' ||
+ props.storyboard.status === 'processing' ||
+ props.storyboard.status === 'generating'
+)
+
+const statusText = computed(() => {
+ if (isGenerating.value) return '生成中'
+ if (hasVideo.value) return '有视频'
+ if (hasImage.value) return '有图'
+ return '待处理'
+})
+
+const statusClass = computed(() => {
+ if (isGenerating.value) return 'status--generating'
+ if (hasVideo.value) return 'status--complete'
+ if (hasImage.value) return 'status--image'
+ return 'status--pending'
+})
+
+const sceneDisplay = computed(() => {
+ const s = props.storyboard.scene
+ if (!s) return ''
+ return `${s.location || ''}${s.time ? ' · ' + s.time : ''}`
+})
+
+const storyboardCharacters = computed(() => {
+ if (!props.storyboard.character_ids?.length) return []
+ return props.characters.filter(c =>
+ props.storyboard.character_ids!.includes(c.id)
+ )
+})
+
+const sequenceNumber = computed(() => {
+ const num = props.storyboard.storyboard_number || props.index + 1
+ return String(num).padStart(2, '0')
+})
+
+function startEdit(field: string, currentValue: string) {
+ editingField.value = field
+ editValue.value = currentValue || ''
+ nextTick(() => {
+ const el = document.querySelector('.inline-textarea:focus') as HTMLTextAreaElement
+ el?.focus()
+ })
+}
+
+function commitEdit(field: string) {
+ if (editingField.value === field) {
+ emit('saveField', props.storyboard.id, field, editValue.value)
+ editingField.value = null
+ }
+}
+
+function onSelectChange(field: string, value: string) {
+ emit('saveField', props.storyboard.id, field, value)
+}
+</script>
+
+<template>
+ <tr class="table-row" :class="{ 'table-row--selected': selected }">
+ <!-- Checkbox -->
+ <td class="cell cell--checkbox">
+ <Checkbox
+ :checked="selected"
+ @update:checked="emit('toggleSelect', storyboard.id)"
+ />
+ </td>
+
+ <!-- Sequence number -->
+ <td class="cell cell--seq">
+ <span class="seq-num">#{{ sequenceNumber }}</span>
+ </td>
+
+ <!-- Thumbnail -->
+ <td class="cell cell--thumb">
+ <div class="thumb-wrapper">
+ <img v-if="thumbnailUrl" :src="thumbnailUrl" class="thumb-img" />
+ <div v-else-if="isGenerating" class="thumb-placeholder">
+ <Loader2 :size="16" class="animate-spin" />
+ </div>
+ <div v-else class="thumb-placeholder">
+ <ImageIcon :size="16" />
+ </div>
+ </div>
+ </td>
+
+ <!-- Scene -->
+ <td class="cell cell--scene">
+ <Select
+ :model-value="storyboard.scene_id || ''"
+ @update:model-value="(v: string) => onSelectChange('scene_id', v)"
+ >
+ <SelectTrigger class="inline-select">
+ <SelectValue :placeholder="sceneDisplay || '选择场景'" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem v-for="s in scenes" :key="s.id" :value="s.id">
+ {{ s.location }}{{ s.time ? ' · ' + s.time : '' }}
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ </td>
+
+ <!-- Shot type -->
+ <td class="cell cell--shot">
+ <Select
+ :model-value="storyboard.shot_type || ''"
+ @update:model-value="(v: string) => onSelectChange('shot_type', v)"
+ >
+ <SelectTrigger class="inline-select">
+ <SelectValue placeholder="景别" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem v-for="opt in shotTypeOptions" :key="opt" :value="opt">
+ {{ opt }}
+ </SelectItem>
+ </SelectContent>
+ </Select>
+ </td>
+
+ <!-- Description -->
+ <td class="cell cell--text" @dblclick="startEdit('description', storyboard.description || '')">
+ <textarea
+ v-if="editingField === 'description'"
+ v-model="editValue"
+ class="inline-textarea"
+ rows="2"
+ @blur="commitEdit('description')"
+ @keydown.ctrl.enter="commitEdit('description')"
+ />
+ <span v-else class="cell-text" :class="{ 'cell-text--empty': !storyboard.description }">
+ {{ storyboard.description || '双击编辑...' }}
+ </span>
+ </td>
+
+ <!-- Video prompt -->
+ <td class="cell cell--text cell--prompt" @dblclick="startEdit('video_prompt', storyboard.video_prompt || '')">
+ <textarea
+ v-if="editingField === 'video_prompt'"
+ v-model="editValue"
+ class="inline-textarea"
+ rows="3"
+ @blur="commitEdit('video_prompt')"
+ @keydown.ctrl.enter="commitEdit('video_prompt')"
+ />
+ <span v-else class="cell-text" :class="{ 'cell-text--empty': !storyboard.video_prompt }">
+ {{ storyboard.video_prompt || '双击编辑...' }}
+ </span>
+ </td>
+
+ <!-- Characters -->
+ <td class="cell cell--chars">
+ <div class="char-tags">
+ <Badge v-for="char in storyboardCharacters" :key="char.id" class="char-tag">
+ {{ char.name }}
+ </Badge>
+ <span v-if="!storyboardCharacters.length" class="cell-text--empty">-</span>
+ </div>
+ </td>
+
+ <!-- Dialogue -->
+ <td class="cell cell--text" @dblclick="startEdit('dialogue', storyboard.dialogue || '')">
+ <textarea
+ v-if="editingField === 'dialogue'"
+ v-model="editValue"
+ class="inline-textarea"
+ rows="2"
+ @blur="commitEdit('dialogue')"
+ @keydown.ctrl.enter="commitEdit('dialogue')"
+ />
+ <span v-else class="cell-text" :class="{ 'cell-text--empty': !storyboard.dialogue }">
+ {{ storyboard.dialogue || '双击编辑...' }}
+ </span>
+ </td>
+
+ <!-- Status -->
+ <td class="cell cell--status">
+ <Badge class="status-badge" :class="statusClass">
+ <Loader2 v-if="isGenerating" :size="10" class="animate-spin" />
+ {{ statusText }}
+ </Badge>
+ </td>
+
+ <!-- Actions (visible on hover) -->
+ <td class="cell cell--actions">
+ <div class="row-actions">
+ <Button
+ variant="ghost"
+ size="icon"
+ class="action-btn"
+ title="生成图片"
+ @click="emit('generateImage', storyboard.id)"
+ >
+ <ImageIcon :size="14" />
+ </Button>
+ <Button
+ variant="ghost"
+ size="icon"
+ class="action-btn"
+ title="生成视频"
+ @click="emit('generateVideo', storyboard.id)"
+ >
+ <Video :size="14" />
+ </Button>
+ </div>
+ </td>
+ </tr>
+</template>
+
+<style scoped>
+.table-row {
+ border-bottom: 1px solid var(--border-primary, rgba(255, 255, 255, 0.06));
+ transition: background 0.1s;
+}
+
+.table-row:hover {
+ background: rgba(255, 255, 255, 0.02);
+}
+
+.table-row--selected {
+ background: rgba(232, 162, 67, 0.06);
+}
+
+.cell {
+ padding: 6px 8px;
+ vertical-align: middle;
+ font-size: 12px;
+ color: var(--text-primary);
+}
+
+.cell--checkbox {
+ width: 32px;
+ text-align: center;
+}
+
+.cell--seq {
+ width: 52px;
+}
+
+.seq-num {
+ font-size: 11px;
+ font-weight: 600;
+ color: var(--text-secondary);
+ font-family: monospace;
+}
+
+.cell--thumb {
+ width: 168px;
+ padding: 4px 8px;
+}
+
+.thumb-wrapper {
+ width: 160px;
+ height: 90px;
+ border-radius: 6px;
+ overflow: hidden;
+ background: rgba(0, 0, 0, 0.2);
+ border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.06));
+}
+
+.thumb-img {
+ width: 100%;
+ height: 100%;
+ object-fit: cover;
+}
+
+.thumb-placeholder {
+ width: 100%;
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ color: var(--text-muted);
+}
+
+.cell--scene {
+ width: 140px;
+}
+
+.cell--shot {
+ width: 80px;
+}
+
+.cell--text {
+ min-width: 120px;
+ max-width: 200px;
+}
+
+.cell--prompt {
+ min-width: 200px;
+ max-width: 300px;
+}
+
+.cell-text {
+ display: -webkit-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+ line-height: 1.5;
+ cursor: default;
+}
+
+.cell-text--empty {
+ color: var(--text-muted, rgba(255, 255, 255, 0.3));
+ font-style: italic;
+}
+
+.inline-select {
+ height: 28px !important;
+ font-size: 11px !important;
+ background: transparent !important;
+ border-color: var(--border-primary) !important;
+}
+
+.inline-textarea {
+ width: 100%;
+ font-size: 12px;
+ line-height: 1.5;
+ padding: 4px 6px;
+ border-radius: 4px;
+ border: 1px solid var(--accent, #e8a243);
+ background: var(--bg-primary);
+ color: var(--text-primary);
+ resize: vertical;
+ font-family: inherit;
+ outline: none;
+}
+
+.cell--chars {
+ min-width: 100px;
+}
+
+.char-tags {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 3px;
+}
+
+.char-tag {
+ font-size: 10px !important;
+ padding: 1px 6px !important;
+ height: auto !important;
+ border-radius: 9999px !important;
+ background: rgba(232, 162, 67, 0.15) !important;
+ color: rgba(232, 162, 67, 0.9) !important;
+ border: none !important;
+}
+
+.cell--status {
+ width: 72px;
+}
+
+.status-badge {
+ font-size: 10px !important;
+ padding: 1px 7px !important;
+ height: auto !important;
+ border-radius: 9999px !important;
+ border: none !important;
+ display: inline-flex;
+ align-items: center;
+ gap: 3px;
+}
+
+.status--pending {
+ background: rgba(255, 255, 255, 0.06) !important;
+ color: rgba(255, 255, 255, 0.45) !important;
+}
+
+.status--generating {
+ background: rgba(96, 165, 250, 0.15) !important;
+ color: rgba(96, 165, 250, 0.9) !important;
+}
+
+.status--image {
+ background: rgba(232, 162, 67, 0.15) !important;
+ color: rgba(232, 162, 67, 0.9) !important;
+}
+
+.status--complete {
+ background: rgba(94, 230, 176, 0.15) !important;
+ color: rgba(94, 230, 176, 0.9) !important;
+}
+
+.cell--actions {
+ width: 72px;
+}
+
+.row-actions {
+ display: flex;
+ gap: 2px;
+ opacity: 0;
+ transition: opacity 0.15s;
+}
+
+.table-row:hover .row-actions {
+ opacity: 1;
+}
+
+.action-btn {
+ width: 28px !important;
+ height: 28px !important;
+ padding: 0 !important;
+ color: var(--text-muted) !important;
+}
+
+.action-btn:hover {
+ color: var(--accent) !important;
+}
+</style>
diff --git a/web/src/views/drama/episode/workbench/TableToolbar.vue b/web/src/views/drama/episode/workbench/TableToolbar.vue
new file mode 100644
index 0000000..a3cd693
--- /dev/null
+++ b/web/src/views/drama/episode/workbench/TableToolbar.vue
@@ -0,0 +1,165 @@
+<script setup lang="ts">
+import { Button } from '@/components/ui/button'
+import { Badge } from '@/components/ui/badge'
+import { Plus, Image, Video, Grid3X3, X } from 'lucide-vue-next'
+
+defineProps<{
+ total: number
+ withImage: number
+ withVideo: number
+ generating: number
+ hasSelection: boolean
+ selectionCount: number
+}>()
+
+defineEmits<{
+ add: []
+ batchImages: []
+ batchVideos: []
+ generateGrid: []
+ clearSelection: []
+}>()
+</script>
+
+<template>
+ <div class="table-toolbar">
+ <div class="toolbar-left">
+ <span class="toolbar-title">镜头 ({{ total }})</span>
+ <div class="toolbar-badges">
+ <Badge v-if="withVideo > 0" class="badge badge--complete">完成 {{ withVideo }}</Badge>
+ <Badge v-if="withImage - withVideo > 0" class="badge badge--image">有图 {{ withImage - withVideo }}</Badge>
+ <Badge v-if="generating > 0" class="badge badge--generating">生成中 {{ generating }}</Badge>
+ <Badge v-if="total - withImage - generating > 0" class="badge badge--pending">
+ 待处理 {{ total - withImage - generating }}
+ </Badge>
+ </div>
+ </div>
+ <div class="toolbar-actions">
+ <!-- Selection mode actions -->
+ <template v-if="hasSelection">
+ <span class="selection-count">已选 {{ selectionCount }}</span>
+ <Button variant="ghost" size="sm" class="toolbar-btn" @click="$emit('generateGrid')">
+ <Grid3X3 :size="14" />
+ 生成宫格图
+ </Button>
+ <Button variant="ghost" size="sm" class="toolbar-btn" @click="$emit('batchImages')">
+ <Image :size="14" />
+ 批量生成图片
+ </Button>
+ <Button variant="ghost" size="sm" class="toolbar-btn" @click="$emit('batchVideos')">
+ <Video :size="14" />
+ 批量生成视频
+ </Button>
+ <Button variant="ghost" size="icon" class="toolbar-btn toolbar-btn--clear" @click="$emit('clearSelection')">
+ <X :size="14" />
+ </Button>
+ </template>
+ <!-- Normal mode actions -->
+ <template v-else>
+ <Button variant="ghost" size="sm" class="toolbar-btn" @click="$emit('add')">
+ <Plus :size="14" />
+ 添加
+ </Button>
+ <Button variant="ghost" size="sm" class="toolbar-btn" @click="$emit('batchImages')">
+ <Image :size="14" />
+ 批量生成图片
+ </Button>
+ <Button variant="ghost" size="sm" class="toolbar-btn" @click="$emit('batchVideos')">
+ <Video :size="14" />
+ 批量生成视频
+ </Button>
+ </template>
+ </div>
+ </div>
+</template>
+
+<style scoped>
+.table-toolbar {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ padding: 6px 12px;
+ border-bottom: 1px solid var(--border-primary, rgba(255, 255, 255, 0.06));
+ flex-shrink: 0;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+
+.toolbar-left {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+
+.toolbar-title {
+ font-size: 13px;
+ font-weight: 600;
+ color: var(--text-primary);
+ white-space: nowrap;
+}
+
+.toolbar-badges {
+ display: flex;
+ align-items: center;
+ gap: 4px;
+}
+
+.badge {
+ font-size: 10px !important;
+ padding: 1px 7px !important;
+ height: auto !important;
+ border-radius: 9999px !important;
+ font-weight: 500 !important;
+ border: none !important;
+}
+
+.badge--complete {
+ background: rgba(94, 230, 176, 0.15) !important;
+ color: rgba(94, 230, 176, 0.9) !important;
+}
+
+.badge--image {
+ background: rgba(232, 162, 67, 0.15) !important;
+ color: rgba(232, 162, 67, 0.9) !important;
+}
+
+.badge--generating {
+ background: rgba(96, 165, 250, 0.15) !important;
+ color: rgba(96, 165, 250, 0.9) !important;
+}
+
+.badge--pending {
+ background: rgba(255, 255, 255, 0.06) !important;
+ color: rgba(255, 255, 255, 0.45) !important;
+}
+
+.toolbar-actions {
+ display: flex;
+ align-items: center;
+ gap: 2px;
+}
+
+.selection-count {
+ font-size: 12px;
+ font-weight: 500;
+ color: var(--accent, #e8a243);
+ margin-right: 4px;
+}
+
+.toolbar-btn {
+ font-size: 11px !important;
+ height: 28px !important;
+ padding: 0 8px !important;
+ color: var(--text-secondary) !important;
+}
+
+.toolbar-btn:hover {
+ color: var(--text-primary) !important;
+}
+
+.toolbar-btn--clear {
+ width: 28px !important;
+ padding: 0 !important;
+}
+</style>