fix(short-drama-agent-front): 统一全屏布局与问题处理交互
This commit is contained in:
1 parent
db91a4b871
commit
cc27d463e0
25 files changed
+838
-316
No files matched your search
@@ -60,7 +60,8 @@ function confirm() {
|
||||
class="mt-5 flex items-start gap-3 text-sm leading-6"
|
||||
>我已确认后台任务停止,当前没有同项目的生成或拆解任务在运行。</NCheckbox
|
||||
>
|
||||
<div class="dialog-footer mt-6">
|
||||
<!-- 以下是固定的取消与确认操作,使用公共底栏避免重复关闭按钮 -->
|
||||
<template #footer>
|
||||
<NButton @click="open = false">取消</NButton
|
||||
><NButton
|
||||
:disabled="disabled || loading || (acknowledgement && !acknowledged)"
|
||||
@@ -69,7 +70,7 @@ function confirm() {
|
||||
>
|
||||
确认{{ label }}</NButton
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
@@ -30,16 +30,28 @@ const percentage = computed(() => executionPercentage(props.execution?.current ?
|
||||
const result = computed(() => props.execution?.result ?? {})
|
||||
/** 拆解任务的单位和结果文案与镜头素材任务分开。 */
|
||||
const breakdownTask = computed(() => props.execution?.workflowName === 'breakdown')
|
||||
/** 执行完成不等于业务校验通过,明确保留待修复状态。 */
|
||||
const breakdownInvalid = computed(() => {
|
||||
/** 只采用后端明确返回的校验结果,缺失时保留待确认状态。 */
|
||||
const breakdownValidation = computed<boolean | null>(() => {
|
||||
const validation = result.value.storyboardShotValidation
|
||||
return (
|
||||
breakdownTask.value &&
|
||||
validation &&
|
||||
typeof validation === 'object' &&
|
||||
'valid' in validation &&
|
||||
validation.valid === false
|
||||
)
|
||||
if (!validation || typeof validation !== 'object' || !('valid' in validation)) return null
|
||||
return typeof validation.valid === 'boolean' ? validation.valid : null
|
||||
})
|
||||
/** 执行完成不等于业务校验通过,明确保留待修复状态。 */
|
||||
const breakdownInvalid = computed(() => breakdownTask.value && breakdownValidation.value === false)
|
||||
/** 后端明确标记的人工审核或待审剧集不能使用成功底色。 */
|
||||
const breakdownNeedsReview = computed(
|
||||
() =>
|
||||
result.value.storyboardNeedsManualReview === true ||
|
||||
(Array.isArray(result.value.storyboardPendingQualityEpisodeNos) &&
|
||||
result.value.storyboardPendingQualityEpisodeNos.length > 0)
|
||||
)
|
||||
/** 拆解卡片区分真实成功、待修复、运行中和结果待确认。 */
|
||||
const breakdownState = computed<'success' | 'error' | 'running' | 'unknown'>(() => {
|
||||
if (props.error || props.execution?.status === 'failed') return 'error'
|
||||
if (props.execution?.status === 'pending' || props.execution?.status === 'running') return 'running'
|
||||
if (props.execution?.status !== 'completed') return 'unknown'
|
||||
if (breakdownInvalid.value || breakdownNeedsReview.value) return 'error'
|
||||
return breakdownValidation.value === true ? 'success' : 'unknown'
|
||||
})
|
||||
/** 后端提供的进度单位,避免把抽取完成误报为整个拆解完成。 */
|
||||
const progressLabel = computed(() =>
|
||||
@@ -52,11 +64,13 @@ const progressLabel = computed(() =>
|
||||
/** 后端执行终态与业务审核结果共同决定可读状态。 */
|
||||
const statusLabel = computed(() => {
|
||||
const labels = { pending: '等待开始', running: '执行中', completed: '已完成', failed: '失败' }
|
||||
return props.execution
|
||||
? props.execution.status === 'completed' && breakdownInvalid.value
|
||||
? '执行结束 · 校验未通过'
|
||||
: labels[props.execution.status]
|
||||
: ''
|
||||
if (!props.execution) return ''
|
||||
if (breakdownTask.value && props.execution.status === 'completed') {
|
||||
if (breakdownInvalid.value) return '执行结束 · 校验未通过'
|
||||
if (breakdownNeedsReview.value) return '执行结束 · 待修订'
|
||||
if (breakdownValidation.value !== true) return '执行结束 · 结果待确认'
|
||||
}
|
||||
return labels[props.execution.status]
|
||||
})
|
||||
const finished = computed(() => ['completed', 'failed'].includes(props.execution?.status ?? ''))
|
||||
/** 是否为剧本创作任务,避免使用镜头素材的提示文案。 */
|
||||
@@ -71,16 +85,24 @@ const staleMotionPlanCount = computed(() => {
|
||||
: props.execution?.metadata?.staleMotionPlan
|
||||
return typeof count === 'number' && Number.isSafeInteger(count) && count >= 0 ? count : 0
|
||||
})
|
||||
/** 视频流程结束但含过期候选时使用警告标签,不显示全成功的绿色状态。 */
|
||||
const statusType = computed(() =>
|
||||
props.execution?.status === 'completed'
|
||||
? breakdownInvalid.value || (videoQuality.value && staleMotionPlanCount.value > 0)
|
||||
/** 业务未通过或结果未知时,不把任务执行结束展示为全成功。 */
|
||||
const statusType = computed(() => {
|
||||
if (breakdownTask.value)
|
||||
return breakdownState.value === 'success'
|
||||
? 'success'
|
||||
: breakdownState.value === 'error'
|
||||
? 'error'
|
||||
: breakdownState.value === 'unknown'
|
||||
? 'default'
|
||||
: 'warning'
|
||||
return props.execution?.status === 'completed'
|
||||
? videoQuality.value && staleMotionPlanCount.value > 0
|
||||
? 'warning'
|
||||
: 'success'
|
||||
: props.execution?.status === 'failed'
|
||||
? 'error'
|
||||
: 'warning'
|
||||
)
|
||||
})
|
||||
/** 逐镜终态从运行 metadata 或完成 result 读取,不根据历史通过猜测状态。 */
|
||||
const settledItems = computed(() => {
|
||||
const settled = props.execution?.status === 'completed' ? result.value.settled : props.execution?.metadata?.settled
|
||||
@@ -152,7 +174,13 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section v-if="execution || error" class="panel mt-4 p-5" :aria-label="title">
|
||||
<section
|
||||
v-if="execution || error"
|
||||
class="panel mt-4 p-5"
|
||||
:class="{ 'breakdown-execution-card': breakdownTask }"
|
||||
:data-task-state="breakdownTask ? breakdownState : undefined"
|
||||
:aria-label="title"
|
||||
>
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
@@ -160,10 +188,10 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
<LoaderCircle v-if="!finished" :size="14" class="animate-spin text-muted" aria-hidden="true" />
|
||||
<NTag v-if="execution" size="small" :type="statusType" :bordered="false">{{ statusLabel }}</NTag>
|
||||
</div>
|
||||
<p v-if="execution" class="mt-2 text-xs text-muted">
|
||||
<p v-if="execution && !breakdownTask" class="mt-2 text-xs text-muted">
|
||||
{{ executionStageLabel(execution.stage) }} · 更新于 {{ formatDate(execution.updatedAt) }}
|
||||
</p>
|
||||
<p v-if="scopeLabel" class="mt-1 text-xs text-muted">范围:{{ scopeLabel }}</p>
|
||||
<p v-if="scopeLabel && !breakdownTask" class="mt-1 text-xs text-muted">范围:{{ scopeLabel }}</p>
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<NButton
|
||||
@@ -179,15 +207,37 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
</div>
|
||||
|
||||
<template v-if="execution">
|
||||
<!-- 以下是拆解任务的直接可见摘要,替代折叠详情和重复进度说明 -->
|
||||
<dl v-if="breakdownTask" class="mt-4 grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<div>
|
||||
<dt class="text-xs text-muted">当前阶段</dt>
|
||||
<dd class="mt-2 text-sm">{{ executionStageLabel(execution.stage) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-xs text-muted">处理范围</dt>
|
||||
<dd class="mt-2 text-sm">{{ scopeLabel || '未提供范围' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-xs text-muted">{{ progressLabel }}</dt>
|
||||
<dd class="mt-2 text-sm">
|
||||
<template v-if="execution.total > 0">{{ execution.current }} / {{ execution.total }}</template>
|
||||
<template v-else>{{ finished ? '本次任务已结束' : '等待进度更新' }}</template>
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-xs text-muted">更新时间</dt>
|
||||
<dd class="mt-2 text-sm">{{ formatDate(execution.updatedAt) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<NProgress
|
||||
v-if="execution.total > 0"
|
||||
v-if="execution.total > 0 && (!breakdownTask || !finished)"
|
||||
type="line"
|
||||
:percentage="percentage"
|
||||
:height="5"
|
||||
:show-indicator="false"
|
||||
class="mt-4"
|
||||
/>
|
||||
<p class="mt-3 text-xs">
|
||||
<p v-if="!breakdownTask" class="mt-3 text-xs">
|
||||
<template v-if="execution.total > 0"
|
||||
>{{ progressLabel }} {{ execution.current }} / {{ execution.total }}</template
|
||||
>
|
||||
@@ -295,7 +345,7 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
}}
|
||||
</p>
|
||||
</ContextNotice>
|
||||
<details class="mt-3 text-[10px] text-muted">
|
||||
<details v-if="!breakdownTask" class="mt-3 text-[10px] text-muted">
|
||||
<summary class="cursor-pointer">任务详情</summary>
|
||||
<p class="mt-2 break-all font-mono">任务编号 · {{ execution.id }}</p>
|
||||
<!-- 以下是逐镜已结束质量任务的持久化状态模块 -->
|
||||
@@ -325,3 +375,16 @@ function isInputMode(value: unknown, inputMode: string): boolean {
|
||||
</ContextNotice>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
/* 拆解任务与设置、候选卡片使用相同底面和内边距,终态不再展示铺满宽度的进度条。 */
|
||||
.breakdown-execution-card {
|
||||
background: var(--app-subtle);
|
||||
}
|
||||
.breakdown-execution-card[data-task-state='success'] {
|
||||
background: var(--app-success-soft);
|
||||
}
|
||||
.breakdown-execution-card[data-task-state='error'] {
|
||||
background: var(--app-danger-soft);
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user