Files
short-drama-agent-front/src/features/production/components/KeyframeExecutionStatus.vue
T

52 lines
2.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup lang="ts">
import { computed } from 'vue'
import { NButton } from 'naive-ui'
import WorkspaceSectionHeading from '../../../components/ui/WorkspaceSectionHeading.vue'
import { executionStageLabel } from '../../workflows/execution'
import type { WorkflowExecution } from '../../workflows/execution.types'
import { userFacingText } from '../../../lib/user-facing-text'
import { formatDate } from '../../../lib/format'
/** 单次视觉审核执行状态,完成和质量通过分别表达。 */
const props = withDefaults(
defineProps<{
/** 正式执行记录。 */ execution: WorkflowExecution
/** 只读刷新状态。 */ loading: boolean
/** 历史记录与当前观察使用不同标题。 */ title?: string
/** 历史列表统一刷新,不对每行重复放置按钮。 */ refreshable?: boolean
}>(),
{ title: '当前审核执行', refreshable: true }
)
/** 仅触发只读刷新。 */
const emit = defineEmits<{ refresh: [] }>()
/** 执行记录仅表达处理状态,当前质量由候选的正式接口独立展示。 */
const label = computed(() => {
if (props.execution.status === 'failed') return '执行失败,质量请查看当前结论'
if (props.execution.status === 'completed') return '执行完成,质量请查看当前结论'
return props.execution.status === 'pending'
? '等待审核'
: props.execution.status === 'running'
? '审核进行中'
: '状态待确认'
})
</script>
<template>
<!-- 以下是正式执行与实际质量结论模块,不用满格绿色进度暗示通过 -->
<section class="mt-4 space-y-2 text-sm" role="status">
<WorkspaceSectionHeading :title="title"
><template #actions
><NButton v-if="refreshable" :loading="loading" @click="emit('refresh')">刷新进度</NButton></template
></WorkspaceSectionHeading
>
<p>{{ label }} · {{ executionStageLabel(execution.stage) }}</p>
<p v-if="execution.total > 0">审核计划进度:{{ execution.current }} / {{ execution.total }}</p>
<p v-else>尚无可确认的步骤进度。</p>
<p class="wrap-anywhere text-xs text-muted">更新于 {{ formatDate(execution.updatedAt) }}</p>
<p v-if="typeof execution.result?.summary === 'string'">
历史执行摘要:{{ userFacingText(execution.result.summary) }}
</p>
<p v-if="execution.error">{{ userFacingText(execution.error) }}</p>
</section>
</template>