525 lines
29 KiB
Vue
525 lines
29 KiB
Vue
<script setup lang="ts">
|
||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||
import { useRouter } from 'vue-router'
|
||
import * as api from '../api'
|
||
import { store } from '../store'
|
||
import { EVENT_LEVELS, eventLabel, eventLevelKey, fmtAgo, fmtMoney, fmtTime, opt, pct, statusClass, statusLabel } from '../format'
|
||
import {
|
||
capsOf, capabilityHint, defaultFor, deliveryResolutions, isMock, loadModels, modelsOf,
|
||
parseRef, refOf, resolutionChoices, fpsChoices
|
||
} from '../models'
|
||
import { stageNote } from '../pipeline'
|
||
import { fromAsset, isAudio as audioOf, isImage as imageOf } from '../media'
|
||
import { notify } from '../project'
|
||
import WorkflowBar from '../components/WorkflowBar.vue'
|
||
import MediaThumb from '../components/MediaThumb.vue'
|
||
import AutoRefresh from '../components/AutoRefresh.vue'
|
||
import FSelect from '../components/FSelect.vue'
|
||
|
||
const router = useRouter()
|
||
const projects = ref<any[]>([])
|
||
const events = ref<any[]>([])
|
||
const loading = ref(true)
|
||
const error = ref('')
|
||
const keyword = ref('')
|
||
const statusFilter = ref('')
|
||
const creating = ref(false)
|
||
/** 全局动态过滤(DB-4):级别 + 关键字,只看异常时不必在 40 条流水里翻 */
|
||
const eventLevel = ref('')
|
||
const eventKeyword = ref('')
|
||
|
||
const form = reactive({
|
||
name: '', description: '', genre: '', target_duration: 120, aspect_ratio: '16:9',
|
||
resolution: '720p', fps: 24, style_guide: '', global_negative_prompt: '',
|
||
default_provider: '', default_model: '', default_transition: 'cut'
|
||
})
|
||
|
||
const statuses = computed<string[]>(() => store.meta?.project_statuses || [])
|
||
/** 视频模型决定可用档位:新建时就按注册表给默认值,不再让用户手填 provider 字符串 */
|
||
const videoModels = computed(() => modelsOf('video'))
|
||
const videoRef = computed({
|
||
get: () => (form.default_provider ? `${form.default_provider}|${form.default_model}` : ''),
|
||
set: (v: string) => {
|
||
const [provider, model] = parseRef(v)
|
||
form.default_provider = provider
|
||
form.default_model = model
|
||
const caps = capsOf(provider, model)
|
||
if (caps.fps > 0) form.fps = caps.fps
|
||
// 档位不在模型能力里才回落,且只回落到「原生能出」的最高档:
|
||
// 放大交付档(1080p)是合法选项,不能一换模型就被静默踢回 720p。
|
||
const deliverable = deliveryResolutions(provider, model)
|
||
if (deliverable.length && !deliverable.includes(form.resolution)) {
|
||
const native = caps.resolutions.length ? caps.resolutions : deliverable
|
||
form.resolution = native[native.length - 1]
|
||
}
|
||
}
|
||
})
|
||
/* 新建项目必须落到注册表里真实存在的模型:留空虽然会被后端回落成平台默认,
|
||
但表单按空 provider 查能力时会报「注册表里还没有这个模型」,用户以为保存后必然派发失败。
|
||
这里直接预置平台默认模型(优先真实通道,演练环境才回落 mock),少一个选项也少一次误判。 */
|
||
const preferredVideoModel = computed(() => defaultFor('video', false) || defaultFor('video'))
|
||
watch(preferredVideoModel, (row) => {
|
||
if (!row || form.default_provider) return
|
||
videoRef.value = refOf(row)
|
||
}, { immediate: true })
|
||
|
||
const videoCaps = computed(() => capsOf(form.default_provider, form.default_model || null))
|
||
const resOptions = computed(() => resolutionChoices(form.default_provider, form.default_model || null))
|
||
const fpsOptions = computed(() => fpsChoices(form.default_provider, form.default_model || null))
|
||
const modelWarnings = computed(() => capabilityHint(
|
||
form.default_provider, form.default_model || null, form.resolution, form.fps, form.aspect_ratio))
|
||
const durationRule = computed(() => {
|
||
const { minDuration, maxDuration } = videoCaps.value
|
||
if (!minDuration && !maxDuration) return '模型未声明单镜时长区间'
|
||
return `总时长按镜头累加;单镜需在 ${minDuration}–${maxDuration} 秒内`
|
||
})
|
||
const filtered = computed(() => {
|
||
const q = keyword.value.trim().toLowerCase()
|
||
return projects.value.filter((p) => {
|
||
if (statusFilter.value && p.status !== statusFilter.value) return false
|
||
if (!q) return true
|
||
return `${p.name} ${p.description} ${p.genre}`.toLowerCase().includes(q)
|
||
})
|
||
})
|
||
const shownEvents = computed(() => {
|
||
const needle = eventKeyword.value.trim().toLowerCase()
|
||
return events.value.filter((e: any) => {
|
||
if (eventLevel.value && eventLevelKey(e.level) !== eventLevel.value) return false
|
||
if (!needle) return true
|
||
return `${e.message || ''} ${e.action || ''} ${eventLabel(e.action)}`.toLowerCase().includes(needle)
|
||
})
|
||
})
|
||
const levelCounts = computed(() => {
|
||
const counts: Record<string, number> = {}
|
||
for (const e of events.value) {
|
||
const key = eventLevelKey(e.level)
|
||
counts[key] = (counts[key] || 0) + 1
|
||
}
|
||
return counts
|
||
})
|
||
|
||
const totals = computed(() => ({
|
||
all: projects.value.length,
|
||
active: projects.value.filter((p) => ['generating', 'reviewing', 'composing', 'storyboard', 'binding'].includes(p.status)).length,
|
||
delivered: projects.value.filter((p) => p.status === 'delivered').length,
|
||
cost: projects.value.reduce((sum, p) => sum + Number(p.stats?.cost?.total_cost || 0), 0),
|
||
// 币种来自成本台账本身(/api/meta 里没有 currency 这个字段)
|
||
currency: projects.value.find((p) => p.stats?.cost?.currency)?.stats?.cost?.currency || 'CNY'
|
||
}))
|
||
|
||
/* ── 新建项目时直接勾选要引入的资源库母版 ─────────────────────────────
|
||
资源库里的人物定妆图 / 场景母图 / 角色声线是跨项目复用的,但以前必须先建项目、
|
||
再跳到资源库页面逐条「引入到项目」,新项目的第一镜总是零素材起步。
|
||
这里勾好后随创建请求一起提交(platform_assets),后端逐条引入并回报失败原因。 */
|
||
type LibType = 'human' | 'scene' | 'voice'
|
||
const LIB_TYPES: { value: LibType; label: string }[] = [
|
||
{ value: 'human', label: '人物' }, { value: 'scene', label: '场景' }, { value: 'voice', label: '声线' }
|
||
]
|
||
const libOpen = ref(false)
|
||
const libType = ref<LibType>('human')
|
||
const libQuery = ref('')
|
||
const libRows = ref<Record<LibType, any[]>>({ human: [], scene: [], voice: [] })
|
||
const libLoading = ref(false)
|
||
const libError = ref('')
|
||
const libLoaded = ref<Record<LibType, boolean>>({ human: false, scene: false, voice: false })
|
||
/** 选中项保存完整行:切到别的分类后,已选人物还要能显示名字与缩略图 */
|
||
const picked = ref<Record<string, any>>({})
|
||
const libKey = (row: any) => `${row.owner_type}:${row.asset_id ?? row.id}`
|
||
const pickedRows = computed(() => Object.values(picked.value))
|
||
const pickedCount = computed(() => pickedRows.value.length)
|
||
const pickedByType = computed(() => {
|
||
const grouped: Record<string, any[]> = { human: [], scene: [], voice: [] }
|
||
for (const row of pickedRows.value) (grouped[row.owner_type] ||= []).push(row)
|
||
return grouped
|
||
})
|
||
const libShown = computed(() => {
|
||
const needle = libQuery.value.trim().toLowerCase()
|
||
return (libRows.value[libType.value] || []).filter((row: any) => {
|
||
if (!needle) return true
|
||
const media = (row.assets || []).map((m: any) => m.kind).join(' ')
|
||
return `${row.name} ${row.code || ''} ${(row.tags || []).join(' ')} ${media}`
|
||
.toLowerCase().includes(needle)
|
||
})
|
||
})
|
||
const coverOf = (row: any) => (row?.assets || []).find((m: any) => imageOf(m)) || null
|
||
const audioOfRow = (row: any) => (row?.assets || []).find((m: any) => audioOf(m)) || null
|
||
const subLabel = (row: any) => row.owner_type === 'human'
|
||
? [row.role, row.default_voice_name && `声线:${row.default_voice_name}`].filter(Boolean).join(' · ')
|
||
: (row.owner_type === 'scene' ? (row.time_of_day || row.lighting || row.description || '')
|
||
: [row.gender, row.language, row.provider].filter(Boolean).join(' · '))
|
||
|
||
async function loadLibrary(force = false) {
|
||
const kind = libType.value
|
||
if (libLoading.value || (libLoaded.value[kind] && !force)) return
|
||
libLoading.value = true
|
||
libError.value = ''
|
||
try {
|
||
const data = await api.get('/api/platform/assets', { owner_type: kind, status: 'active', sort: 'updated', page_size: 0 })
|
||
libRows.value = { ...libRows.value, [kind]: data.items || [] }
|
||
libLoaded.value = { ...libLoaded.value, [kind]: true }
|
||
} catch (exc: any) {
|
||
libError.value = exc.message
|
||
} finally {
|
||
libLoading.value = false
|
||
}
|
||
}
|
||
|
||
function toggleLibrary() {
|
||
libOpen.value = !libOpen.value
|
||
if (libOpen.value) loadLibrary()
|
||
}
|
||
|
||
function pickType(kind: LibType) {
|
||
libType.value = kind
|
||
loadLibrary()
|
||
}
|
||
|
||
function togglePick(row: any) {
|
||
const key = libKey(row)
|
||
const next = { ...picked.value }
|
||
if (next[key]) delete next[key]
|
||
else next[key] = { owner_type: row.owner_type, asset_id: row.id, name: row.name,
|
||
type_label: row.type_label, role: row.role, gender: row.gender }
|
||
picked.value = next
|
||
}
|
||
|
||
function resetLibrary() {
|
||
picked.value = {}
|
||
libOpen.value = false
|
||
libQuery.value = ''
|
||
}
|
||
|
||
async function load() {
|
||
error.value = ''
|
||
loadModels()
|
||
try {
|
||
const [list, evs] = await Promise.all([
|
||
api.get('/api/projects', { status: statusFilter.value, q: keyword.value }),
|
||
api.get('/api/events', { limit: 40 })
|
||
])
|
||
projects.value = list.projects || []
|
||
events.value = evs.events || []
|
||
} catch (exc: any) {
|
||
error.value = exc.message
|
||
} finally {
|
||
loading.value = false
|
||
}
|
||
}
|
||
|
||
async function submit() {
|
||
if (!form.name.trim()) { error.value = '请填写项目名称'; return }
|
||
if (videoCaps.value.known && videoCaps.value.mock) {
|
||
error.value = '当前选的是 mock 演练通道,正式项目请选择真实视频模型'
|
||
return
|
||
}
|
||
try {
|
||
const assets = pickedRows.value.map((row: any) => ({ owner_type: row.owner_type, asset_id: row.asset_id }))
|
||
const created = await api.post('/api/projects', { ...form, platform_assets: assets })
|
||
const failures: any[] = created?.import_failures || []
|
||
const imported: any[] = created?.imported_assets || []
|
||
creating.value = false
|
||
resetLibrary()
|
||
if (failures.length) {
|
||
notify(`已引入 ${imported.length} 个资源,${failures.length} 个失败:`
|
||
+ failures.slice(0, 2).map((f: any) => f.detail).join(';')
|
||
+ (failures.length > 2 ? ' …' : ''))
|
||
} else if (imported.length) {
|
||
notify(`已引入资源库母版 ${imported.length} 个,可直接绑定到镜头`)
|
||
}
|
||
await router.push(`/projects/${created.id}/overview`)
|
||
} catch (exc: any) {
|
||
error.value = exc.message
|
||
}
|
||
}
|
||
|
||
async function removeProject(p: any) {
|
||
if (!confirm(`确认删除项目《${p.name}》?该操作不可恢复。`)) return
|
||
try {
|
||
await api.del(`/api/projects/${p.id}`, { purge_files: true })
|
||
await load()
|
||
} catch (exc: any) { error.value = exc.message }
|
||
}
|
||
|
||
/* 规范 §4 / R6:筛选即时生效,不放「筛选」按钮(与「队列自动刷新不加按钮」同源)。
|
||
输入停顿 300ms 再回源,避免每敲一个字打一次接口。 */
|
||
let searchTimer: number | undefined
|
||
watch([keyword, statusFilter], () => {
|
||
window.clearTimeout(searchTimer)
|
||
searchTimer = window.setTimeout(load, 300)
|
||
})
|
||
|
||
onMounted(load)
|
||
</script>
|
||
|
||
<template>
|
||
<div>
|
||
<header>
|
||
<div>
|
||
<small class="eyebrow">01 / PROJECTS</small>
|
||
<h1>项目总览</h1>
|
||
</div>
|
||
<div class="row">
|
||
<AutoRefresh :every="20000" :paused="creating" @refresh="load()" />
|
||
<button class="primary" @click="creating = !creating">{{ creating ? '收起' : '+ 新建长视频项目' }}</button>
|
||
</div>
|
||
</header>
|
||
|
||
<p v-if="error" class="error" style="margin-bottom:14px">{{ error }}</p>
|
||
|
||
<form v-if="creating" class="panel" style="margin-bottom:18px" @submit.prevent="submit">
|
||
<div class="between" style="margin-bottom:12px">
|
||
<h3 style="margin:0" title="流程第 ① 步:创建视频项目">新建长视频项目</h3>
|
||
</div>
|
||
<div class="frow">
|
||
<label class="fld"><span>项目名称 <b class="req">*</b></span><input v-model="form.name" placeholder="例如:星海纪元 · 第一集" /></label>
|
||
<label class="fld"><span>题材</span><input v-model="form.genre" placeholder="科幻 / 悬疑 / 都市" /></label>
|
||
<label class="fld"><span>目标总时长(秒)</span><input v-model.number="form.target_duration" type="number" min="1" :title="durationRule" /></label>
|
||
<label class="fld"><span>默认转场</span><FSelect v-model="form.default_transition"><option v-for="o in store.meta?.options?.transition || []" :value="o.value">{{ o.label }}</option></FSelect></label>
|
||
</div>
|
||
<div class="frow">
|
||
<label class="fld"><span>默认视频模型</span><FSelect v-model="videoRef" :title="`生成模式 ${videoCaps.modes.map((m) => opt('mode', m)).join(' / ') || '未声明'};后续可在项目设置里改`">
|
||
<option v-for="row in videoModels" :key="row.id" :value="refOf(row)">
|
||
{{ row.display_name || `${row.provider} · ${row.model}` }}{{ row.available ? '' : '(未就绪)' }}{{ isMock(row) ? '(演练通道)' : '' }}
|
||
</option>
|
||
</FSelect></label>
|
||
<label class="fld"><span>画幅</span><FSelect v-model="form.aspect_ratio"><option v-for="o in store.meta?.options?.aspect_ratio || []" :value="o.value">{{ o.label }}</option></FSelect></label>
|
||
<label class="fld"><span>分辨率</span><FSelect v-model="form.resolution"><option v-for="o in resOptions" :value="o.value">{{ o.label }}</option></FSelect></label>
|
||
<label class="fld"><span>帧率</span><FSelect v-model.number="form.fps"><option v-for="f in fpsOptions" :value="f">{{ f }} fps</option></FSelect></label>
|
||
<label class="fld"><span>全局负面提示词</span><input v-model="form.global_negative_prompt" placeholder="文字水印,画面抖动,肢体畸变" /></label>
|
||
</div>
|
||
<div class="frow">
|
||
<label class="field"><span class="lbl">项目简介</span><textarea v-model="form.description" rows="2"></textarea></label>
|
||
<label class="field"><span class="lbl">全局风格指南(拼接到每个镜头提示词)</span><textarea v-model="form.style_guide" rows="2" placeholder="赛博朋克国风,冷色调,电影质感"></textarea></label>
|
||
</div>
|
||
<div class="libpick">
|
||
<div class="row libtogglebar">
|
||
<button title="可选:把资源库里现成的人物定妆图、场景母图、角色声线直接带进新项目。引入的是母版当前版本的副本:人物会连带默认声线与定妆图,场景带母图,声线带音色样本;之后资源库里升级版本不会自动改写项目内的资产。" type="button" class="btn-add" @click="toggleLibrary">
|
||
{{ libOpen ? '收起资源库' : (pickedCount ? `已选 ${pickedCount} 个资源` : '+ 从资源库引入人物 / 场景 / 声线') }}
|
||
</button>
|
||
<span v-if="pickedCount" class="tag ok">创建时自动引入 {{ pickedCount }} 个母版</span>
|
||
</div>
|
||
<div v-if="libOpen" class="libbox">
|
||
<div class="lib-bar">
|
||
<span v-for="t in LIB_TYPES" :key="t.value" class="chip libchip" :class="{ on: libType === t.value }"
|
||
@click="pickType(t.value)">{{ t.label }}<em v-if="pickedByType[t.value]?.length"> {{ pickedByType[t.value].length }}</em></span>
|
||
<label class="fld grow"><span>搜索</span><input v-model="libQuery" placeholder="名称 / 编号 / 标签" /></label>
|
||
<button type="button" class="outline tiny" :disabled="libLoading" @click="loadLibrary(true)">刷新</button>
|
||
</div>
|
||
<p v-if="libError" class="error">{{ libError }}</p>
|
||
<div v-else-if="libLoading && !libShown.length" class="muted libempty">正在读取资源库…</div>
|
||
<div v-else-if="!libShown.length" class="muted libempty">
|
||
资源库里还没有{{ LIB_TYPES.find((t) => t.value === libType)?.label }}母版。可以先建项目,之后到「资源库」页面引入。
|
||
</div>
|
||
<div v-else class="lib-grid">
|
||
<button v-for="row in libShown" :key="row.owner_type + row.id" type="button" class="libcard"
|
||
:class="{ on: !!picked[`${row.owner_type}:${row.id}`] }" @click="togglePick(row)">
|
||
<span class="libthumb">
|
||
<MediaThumb v-if="coverOf(row)" :item="fromAsset(coverOf(row))" size="xs" width="52px" :radius="6" />
|
||
<b v-else class="libicon">{{ audioOfRow(row) ? '♪' : '◻' }}</b>
|
||
</span>
|
||
<span class="libmeta">
|
||
<b>{{ row.name }}</b>
|
||
<small class="muted">{{ subLabel(row) || row.type_label }}</small>
|
||
<small class="muted">{{ (row.assets || []).length }} 个素材<template v-if="row.usage_count"> · 已用于 {{ row.usage_count }} 个项目</template></small>
|
||
</span>
|
||
<span class="libcheck">{{ picked[`${row.owner_type}:${row.id}`] ? '✓' : '' }}</span>
|
||
</button>
|
||
</div>
|
||
<div v-if="pickedCount" class="libpicked">
|
||
<small class="eyebrow">将引入</small>
|
||
<span v-for="row in pickedRows" :key="'p' + row.owner_type + row.asset_id" class="chip on libchip">
|
||
{{ row.type_label }}·{{ row.name }}<button class="chip-x" type="button" :title="`不再引入 ${row.name}`" aria-label="不再引入该资源" @click.stop="togglePick(row)">×</button>
|
||
</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="chipbar capsline">
|
||
<span class="chip">可用档位 {{ videoCaps.resolutions.join(' / ') || '未声明' }}</span>
|
||
<span class="chip">帧率 {{ videoCaps.fps || '未声明' }}fps</span>
|
||
<span class="chip">单镜 {{ videoCaps.minDuration || '?' }}–{{ videoCaps.maxDuration || '?' }} 秒</span>
|
||
<span class="chip">参考图上限 {{ videoCaps.maxReferenceImages || '未声明' }}</span>
|
||
</div>
|
||
<p v-for="(w, i) in modelWarnings" :key="'w' + i" class="error">{{ w }}</p>
|
||
<div class="actions">
|
||
<button class="primary" type="submit">创建并进入项目</button>
|
||
<button class="outline" type="button" @click="creating = false">取消</button>
|
||
</div>
|
||
</form>
|
||
|
||
<div class="stats">
|
||
<div class="stat"><small>项目总数</small><b>{{ totals.all }}</b></div>
|
||
<div class="stat"><small>制作中</small><b>{{ totals.active }}</b></div>
|
||
<div class="stat"><small>已交付</small><b>{{ totals.delivered }}</b></div>
|
||
<div class="stat"><small>累计成本</small><b>{{ fmtMoney(totals.cost, totals.currency) }}</b></div>
|
||
</div>
|
||
|
||
<section class="panel">
|
||
<div class="panel-head">
|
||
<div><small class="eyebrow">PIPELINE</small><h2>项目列表</h2></div>
|
||
<div class="ctlbar searchbar">
|
||
<label class="fld grow"><span>搜索</span><input v-model="keyword" aria-label="搜索项目" placeholder="名称 / 简介 / 题材" /></label>
|
||
<label class="fld narrow"><span>状态</span><FSelect v-model="statusFilter" aria-label="项目状态筛选">
|
||
<option value="">全部状态</option>
|
||
<option v-for="s in statuses" :value="s">{{ statusLabel(s) }}</option>
|
||
</FSelect></label>
|
||
</div>
|
||
</div>
|
||
|
||
<div v-if="loading" class="loading"><span class="spin"></span> 正在读取项目…</div>
|
||
<div v-else-if="!filtered.length" class="empty">还没有项目。点击右上角「新建长视频项目」开始。</div>
|
||
<div v-else class="tablebox dash-table">
|
||
<table class="tbl">
|
||
<thead>
|
||
<tr><th>项目</th><th>状态</th><th>流程节点</th><th class="r">镜头</th><th class="r">进度</th><th class="r">时长</th><th class="r">成本</th><th class="r">操作</th></tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr v-for="p in filtered" :key="p.id">
|
||
<td class="wrap">
|
||
<div class="proj-cell">
|
||
<div class="proj-cover">
|
||
<MediaThumb v-if="p.cover_url" :src="p.cover_url" size="xs" width="72px" :radius="6"
|
||
:title="`${p.name} 首帧`" />
|
||
<span v-else class="cover-none" :title="p.shot_count ? '已有镜头,但还没有生成任何画面' : '还没有导入分镜'">
|
||
{{ p.shot_count ? '▷' : '+' }}
|
||
</span>
|
||
</div>
|
||
<div class="grow">
|
||
<router-link class="link" :to="`/projects/${p.id}/overview`"><b>{{ p.name }}</b></router-link>
|
||
<div class="muted">{{ p.aspect_ratio }} · {{ p.resolution }} · {{ p.fps }}fps<span v-if="p.genre"> · {{ p.genre }}</span></div>
|
||
</div>
|
||
</div>
|
||
</td>
|
||
<td><span :class="statusClass(p.status)">{{ statusLabel(p.status) }}</span></td>
|
||
<td class="wrap">{{ stageNote(p) }}</td>
|
||
<td class="r">{{ p.stats?.shots || 0 }}<span class="muted"> / 合格 {{ p.stats?.shots_approved || 0 }}</span></td>
|
||
<td class="r" style="min-width:96px">
|
||
<div class="bar"><i :style="{ width: Math.round((p.stats?.progress_ratio || 0) * 100) + '%' }"></i></div>
|
||
<small class="muted">{{ pct(p.stats?.progress_ratio) }}</small>
|
||
</td>
|
||
<td class="r mono">{{ (p.stats?.planned_duration || 0).toFixed(0) }}s</td>
|
||
<td class="r mono">{{ fmtMoney(p.stats?.cost?.total_cost) }}</td>
|
||
<td class="r">
|
||
<div class="row" style="justify-content:flex-end">
|
||
<router-link class="link" :to="`/projects/${p.id}/overview`">进入 →</router-link>
|
||
<button class="btn-del" title="删除这个项目" @click="removeProject(p)">删除</button>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
<div v-if="!loading && filtered.length" class="project-cards">
|
||
<article v-for="p in filtered" :key="'card-' + p.id" class="project-card">
|
||
<div class="card-top">
|
||
<MediaThumb v-if="p.cover_url" :src="p.cover_url" size="xs" width="56px" :radius="6"
|
||
:title="`${p.name} 首帧`" />
|
||
<router-link class="link" :to="`/projects/${p.id}/overview`"><b>{{ p.name }}</b></router-link>
|
||
<span :class="statusClass(p.status)">{{ statusLabel(p.status) }}</span>
|
||
</div>
|
||
<div class="muted">{{ p.aspect_ratio }} · {{ p.resolution }} · {{ p.fps }}fps<span v-if="p.genre"> · {{ p.genre }}</span></div>
|
||
<div class="card-stage"><span>流程节点</span><b>{{ stageNote(p) }}</b></div>
|
||
<div class="card-kpis">
|
||
<span>镜头 <b>{{ p.stats?.shots || 0 }}</b> / 合格 {{ p.stats?.shots_approved || 0 }}</span>
|
||
<span>时长 <b>{{ (p.stats?.planned_duration || 0).toFixed(0) }}s</b></span>
|
||
<span>进度 <b>{{ pct(p.stats?.progress_ratio) }}</b></span>
|
||
<span>成本 <b>{{ fmtMoney(p.stats?.cost?.total_cost) }}</b></span>
|
||
</div>
|
||
<div class="bar"><i :style="{ width: Math.round((p.stats?.progress_ratio || 0) * 100) + '%' }"></i></div>
|
||
<div class="actions">
|
||
<router-link class="outline tiny" :to="`/projects/${p.id}/overview`">进入项目 →</router-link>
|
||
<button class="btn-del" title="删除这个项目" @click="removeProject(p)">删除</button>
|
||
</div>
|
||
</article>
|
||
</div>
|
||
</section>
|
||
|
||
<div class="dash-side">
|
||
<section class="panel">
|
||
<div class="panel-head"><div><small class="eyebrow">STAGE FLOW</small><h2 title="平台按 12 个节点推进:创建项目 → 导入分镜 → 绑定资产 → 生成任务清单 → 检查素材 → 队列调度 → 调用模型 → 保存产物 → 质量检查 → 人工审核 → 时间线合成 → 导出成片。被驳回的镜头会回到「修改提示词 → 重新生成」。">流程节点</h2></div></div>
|
||
<div class="divider"></div>
|
||
<div class="small-label" style="margin-top:0">示例项目流程<span class="val">{{ filtered[0]?.name || '暂无项目' }}</span></div>
|
||
<WorkflowBar v-if="filtered[0]?.workflow" :workflow="filtered[0].workflow" compact />
|
||
<p v-else class="empty">创建项目后可在这里看到实时节点进度。</p>
|
||
</section>
|
||
|
||
<section class="panel">
|
||
<div class="panel-head"><div><small class="eyebrow">EVENTS</small><h2>全局动态</h2></div></div>
|
||
<div class="event-filter">
|
||
<span v-for="lv in EVENT_LEVELS" :key="lv.value" class="chip"
|
||
:class="{ on: eventLevel === lv.value }" @click="eventLevel = lv.value">
|
||
{{ lv.label }}<em v-if="lv.value && levelCounts[lv.value]"> {{ levelCounts[lv.value] }}</em>
|
||
</span>
|
||
<label class="fld grow"><span>搜索</span><input v-model="eventKeyword" class="event-search" aria-label="搜索事件" placeholder="事件内容 / 动作" /></label>
|
||
</div>
|
||
<div class="log">
|
||
<div v-for="e in shownEvents" :key="e.id" class="logrow" :class="eventLevelKey(e.level)">
|
||
<time :title="fmtTime(e.created_at)">{{ fmtAgo(e.created_at) }}</time>
|
||
<span class="who mono" :title="e.action">{{ eventLabel(e.action) }}</span>
|
||
<p>{{ e.message }}<span v-if="e.project_id" class="muted"> · 项目#{{ e.project_id }}</span></p>
|
||
</div>
|
||
<div v-if="!events.length" class="muted">暂无事件</div>
|
||
<div v-else-if="!shownEvents.length" class="muted">当前筛选条件下没有事件。
|
||
<button class="outline tiny" @click="eventLevel = ''; eventKeyword = ''">清除筛选</button></div>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<style scoped>
|
||
/* 新建项目时的资源库选择器:卡片式多选,缩略图 + 名称 + 摘要,避免「只有一个下拉框却看不见素材」 */
|
||
.libpick { margin: 2px 0 12px; }
|
||
.libtogglebar { gap: 10px; align-items: center; }
|
||
.libbox { margin-top: 10px; padding: 12px; border: 1px solid var(--c-bg-emphasis); border-radius: 10px;
|
||
background: var(--c-bg-panel); }
|
||
.lib-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
|
||
.lib-bar .fld.grow { max-width: 260px; }
|
||
.libchip em { color: var(--c-accent); font-style: normal; }
|
||
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 8px;
|
||
max-height: 268px; overflow: auto; padding-right: 2px; }
|
||
.libcard { display: flex; align-items: center; gap: 9px; padding: 8px; text-align: left; cursor: pointer;
|
||
border: 1px solid var(--c-line); border-radius: 9px; background: var(--c-bg-card); color: inherit; }
|
||
.libcard:hover { border-color: var(--c-line-strong); }
|
||
.libcard.on { border-color: var(--c-accent); box-shadow: 0 0 0 1px var(--c-accent) inset; }
|
||
.libthumb { flex: 0 0 auto; width: 52px; height: 40px; display: grid; place-items: center; overflow: hidden;
|
||
border-radius: 6px; background: var(--c-bg-emphasis); }
|
||
.libicon { color: var(--c-text-muted); font-size: 17px; }
|
||
.libmeta { min-width: 0; display: grid; gap: 1px; flex: 1 1 auto; }
|
||
.libmeta b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||
.libmeta small { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||
.libcheck { flex: 0 0 auto; width: 18px; color: var(--c-accent); font-weight: 700; }
|
||
.libpicked { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
|
||
.libpicked .eyebrow { margin-right: 2px; }
|
||
.libempty { padding: 14px 2px; font-size: 11px; }
|
||
.dash-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; align-items: start; }
|
||
.dash-table .tbl { min-width: 940px; }
|
||
@media (max-width:1080px) { .dash-side { grid-template-columns: minmax(0, 1fr); } }
|
||
.dash-table td { white-space: nowrap; }
|
||
.dash-table td.wrap { white-space: normal; }
|
||
.dash-table .bar { margin-bottom: 3px; }
|
||
.proj-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
|
||
.proj-cover { flex: 0 0 auto; width: 72px; }
|
||
.cover-none { display: grid; place-items: center; width: 72px; height: 41px;
|
||
border: 1px dashed var(--c-line-strong); border-radius: 6px;
|
||
color: var(--c-text-muted); background: var(--c-bg-panel); font-size: 14px; }
|
||
/* 布局(一行 / 等高 / 间距)来自 style.css 的 .ctlbar 体系,这里只留皮肤 */
|
||
.event-filter .chip em { color: var(--c-accent); font-style: normal; }
|
||
.project-cards { display: none; }
|
||
@media (max-width: 560px) {
|
||
.dash-table { display: none; }
|
||
.project-cards { display: grid; gap: 9px; }
|
||
.project-card { padding: 12px; border: 1px solid var(--c-bg-emphasis); border-radius: 10px; background: var(--c-bg-card); }
|
||
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
|
||
.card-top .link { flex: 1 1 auto; }
|
||
.card-top .link { color: var(--c-text); font-size: 12px; }
|
||
.card-stage { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 10px 0 8px; }
|
||
.card-stage span { color: var(--c-text-muted); font-size: 10px; }
|
||
.card-stage b { color: var(--c-text-2); font-size: 11px; text-align: right; }
|
||
.card-kpis { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px 12px; margin-bottom: 8px; color: var(--c-text-muted); font-size: 10px; }
|
||
.card-kpis b { color: var(--c-text-2); }
|
||
.project-card .actions { margin-top: 10px; }
|
||
.project-card .actions .outline { text-decoration: none; }
|
||
}
|
||
</style>
|