feat: 优化分镜时长状态区响应式布局与局部加载反馈
This commit is contained in:
1 parent
5794906870
commit
1c8ff7428f
1 file changed
+37
-6
@@ -86,15 +86,26 @@ const durationAudit = ref<StoryboardDurationAudit | null>(null)
|
|||||||
const durationBudget = ref<ProjectDurationBudgetSummary | null>(null)
|
const durationBudget = ref<ProjectDurationBudgetSummary | null>(null)
|
||||||
const currentDurationBudget = computed(() => durationBudget.value?.episodes?.find(item => item.episodeNo === episodeNo.value) ?? null)
|
const currentDurationBudget = computed(() => durationBudget.value?.episodes?.find(item => item.episodeNo === episodeNo.value) ?? null)
|
||||||
const durationAuditError = ref('')
|
const durationAuditError = ref('')
|
||||||
|
/** 仅在只读预算请求进行中展示局部加载状态。 */
|
||||||
|
const durationLoading = ref(false)
|
||||||
|
const durationStatusLabel = computed(() => {
|
||||||
|
const audit = currentDurationBudget.value?.audit
|
||||||
|
if (!audit || audit.status === 'auto') return null
|
||||||
|
if (audit.status === 'over_budget') return '超出预算'
|
||||||
|
if (audit.status === 'under_budget') return '低于预算'
|
||||||
|
return '符合预算'
|
||||||
|
})
|
||||||
/** 请求代次保证重生成刷新与切换项目时,迟到响应不会覆盖新数据。 */
|
/** 请求代次保证重生成刷新与切换项目时,迟到响应不会覆盖新数据。 */
|
||||||
let durationRequestVersion = 0
|
let durationRequestVersion = 0
|
||||||
async function refreshDuration(projectId: string) {
|
async function refreshDuration(projectId: string) {
|
||||||
const version = ++durationRequestVersion
|
const version = ++durationRequestVersion
|
||||||
|
durationLoading.value = true
|
||||||
const [audit, budget] = await Promise.allSettled([
|
const [audit, budget] = await Promise.allSettled([
|
||||||
storyboardApi.durationAudit(projectId),
|
storyboardApi.durationAudit(projectId),
|
||||||
projectsApi.durationBudget(projectId)
|
projectsApi.durationBudget(projectId)
|
||||||
])
|
])
|
||||||
if (version !== durationRequestVersion || id.value !== projectId) return
|
if (version !== durationRequestVersion || id.value !== projectId) return
|
||||||
|
durationLoading.value = false
|
||||||
if (audit.status === 'fulfilled') durationAudit.value = audit.value
|
if (audit.status === 'fulfilled') durationAudit.value = audit.value
|
||||||
if (budget.status === 'fulfilled' && Array.isArray(budget.value?.episodes)) durationBudget.value = budget.value
|
if (budget.status === 'fulfilled' && Array.isArray(budget.value?.episodes)) durationBudget.value = budget.value
|
||||||
durationAuditError.value = audit.status === 'rejected' || budget.status === 'rejected'
|
durationAuditError.value = audit.status === 'rejected' || budget.status === 'rejected'
|
||||||
@@ -107,6 +118,7 @@ watch(
|
|||||||
++durationRequestVersion
|
++durationRequestVersion
|
||||||
durationAudit.value = null
|
durationAudit.value = null
|
||||||
durationBudget.value = null
|
durationBudget.value = null
|
||||||
|
durationLoading.value = false
|
||||||
durationAuditError.value = ''
|
durationAuditError.value = ''
|
||||||
if (projectId) void refreshDuration(projectId)
|
if (projectId) void refreshDuration(projectId)
|
||||||
},
|
},
|
||||||
@@ -242,12 +254,25 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
class="select-control"
|
class="select-control"
|
||||||
></NSelect>
|
></NSelect>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="currentDurationBudget" class="toolbar-metrics storyboard-duration-summary text-xs">
|
<!-- 当前剧集时长汇总仅占一行;窄屏自动换行,不挤压操作按钮。 -->
|
||||||
<span v-if="currentDurationBudget.targetDurationSeconds !== null">目标 {{ currentDurationBudget.targetDurationSeconds }}秒</span>
|
<div v-if="currentDurationBudget || durationLoading" class="storyboard-duration-summary" aria-label="本集时长预算">
|
||||||
<span v-else>时长自动规划</span>
|
<span v-if="durationLoading" class="text-muted" role="status">时长数据更新中…</span>
|
||||||
<span v-if="currentDurationBudget.plannedSeconds !== null">Beat {{ currentDurationBudget.plannedSeconds }}秒</span>
|
<template v-if="currentDurationBudget">
|
||||||
<span v-if="currentDurationBudget.shotCount > 0 && currentDurationBudget.shotSeconds !== null">Shot {{ currentDurationBudget.shotSeconds }}秒</span>
|
<span v-if="currentDurationBudget.targetDurationSeconds !== null">目标 {{ currentDurationBudget.targetDurationSeconds }} 秒</span>
|
||||||
<span v-if="currentDurationBudget.audit && currentDurationBudget.audit.status !== 'auto'" :class="currentDurationBudget.audit.needsReview ? 'text-warning' : 'text-muted'">{{ currentDurationBudget.audit.needsReview ? '偏差需关注' : '偏差正常' }} · {{ currentDurationBudget.audit.deviationSeconds !== null && currentDurationBudget.audit.deviationSeconds > 0 ? '+' : '' }}{{ currentDurationBudget.audit.deviationSeconds ?? 0 }}秒(±{{ currentDurationBudget.audit.toleranceSeconds ?? 0 }}秒)</span>
|
<span v-else>自动规划时长</span>
|
||||||
|
<span v-if="currentDurationBudget.plannedSeconds !== null">Beat {{ currentDurationBudget.plannedSeconds }} 秒</span>
|
||||||
|
<span v-if="currentDurationBudget.shotCount > 0 && currentDurationBudget.shotSeconds !== null">Shot {{ currentDurationBudget.shotSeconds }} 秒</span>
|
||||||
|
<span
|
||||||
|
v-if="durationStatusLabel"
|
||||||
|
:class="currentDurationBudget.audit?.needsReview ? 'text-warning' : 'text-muted'"
|
||||||
|
>
|
||||||
|
{{ durationStatusLabel }}
|
||||||
|
<template v-if="currentDurationBudget.audit?.deviationSeconds !== null && currentDurationBudget.audit?.deviationSeconds !== undefined">
|
||||||
|
{{ currentDurationBudget.audit.deviationSeconds > 0 ? '+' : '' }}{{ currentDurationBudget.audit.deviationSeconds }} 秒
|
||||||
|
(±{{ currentDurationBudget.audit.toleranceSeconds ?? 0 }} 秒)
|
||||||
|
</template>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="toolbar-metrics">
|
<div class="toolbar-metrics">
|
||||||
<span v-for="item in coverage" :key="item.title"
|
<span v-for="item in coverage" :key="item.title"
|
||||||
@@ -633,6 +658,12 @@ const rules = { concurrency: integerRule('批量并发'), maxRepairAttempts: int
|
|||||||
<style>
|
<style>
|
||||||
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
||||||
@reference "../../styles/styles.css";
|
@reference "../../styles/styles.css";
|
||||||
|
.storyboard-duration-summary {
|
||||||
|
@apply flex flex-wrap items-center gap-x-3 gap-y-1 min-w-0 text-xs;
|
||||||
|
}
|
||||||
|
.storyboard-duration-summary > span {
|
||||||
|
@apply whitespace-nowrap;
|
||||||
|
}
|
||||||
.storyboard-controls {
|
.storyboard-controls {
|
||||||
@apply grid grid-cols-[minmax(180px,_1fr)_100px_145px_auto] gap-[18px] items-end;
|
@apply grid grid-cols-[minmax(180px,_1fr)_100px_145px_auto] gap-[18px] items-end;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user