fix(short-drama-agent-front): 优化项目操作与形态图库

This commit is contained in:
GJ committed 2026-11-06 23:02:33 +08:00
1 parent 27ee9fd4ff
commit dbf97e6f98
11 files changed
+175 -109

No files matched your search

@@ -12,7 +12,7 @@ import ActionMenu from '../../components/ui/ActionMenu.vue'
import DetailDisclosure from '../../components/ui/DetailDisclosure.vue'
import WorkspaceTools from '../../components/ui/WorkspaceTools.vue'
import { NButton, NCheckbox, NInput, NInputNumber, NPopover, NScrollbar, NSelect, NTag } from 'naive-ui'
import { computed, onScopeDispose, ref, watch, type Directive } from 'vue'
import { computed, onScopeDispose, ref, useTemplateRef, watch, type Directive } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import {
Search,
@@ -138,6 +138,8 @@ const statusFilterOptions: Array<{ label: string; value: ImageStatusFilter }> =
{ label: '全部状态', value: 'all' },
{ label: '缺少主图', value: 'missing' }
]
/** 当前卡片容器,用于在筛选移除卡片后重新计算位置。 */
const galleryGrid = useTemplateRef<HTMLElement>('galleryGrid')
/** 保存每张卡片的尺寸观察器,切换回网格时及时释放。 */
const masonryCardObservers = new WeakMap<HTMLElement, ResizeObserver>()
@@ -243,6 +245,14 @@ const filtered = computed(() =>
.includes(search.value.trim().toLowerCase())
)
)
/** 筛选或数据更新可能只移除卡片,保留的卡片尺寸不变也需要重新排位。 */
watch(
[filtered, layout],
() => {
if (galleryGrid.value) syncMasonryLayout(galleryGrid.value)
},
{ flush: 'post' }
)
watch(
() => [route.query.subjectRef, route.query.subjectFormId, route.query.sourceShotId],
() => {
@@ -626,7 +636,13 @@ const rules = { concurrency: integerRule('批量并发'), limit: integerRule('
><ContextNotice v-if="running" role="status" type="info" :show-icon="false" class="mt-4">
部分形态正在生成。任务完成后可再次批量生图。
</ContextNotice>
<div v-if="filtered.length" class="form-image-grid" :class="{ 'form-image-masonry': layout === 'masonry' }">
<!-- 以下是筛选结果,网格与瀑布流共用同一组卡片。 -->
<div
v-if="filtered.length"
ref="galleryGrid"
class="form-image-grid"
:class="{ 'form-image-masonry': layout === 'masonry' }"
>
<article
v-for="form in filtered"
v-masonry-card="layout === 'masonry'"