586 lines
27 KiB
Vue
586 lines
27 KiB
Vue
<script setup lang="ts">
|
||
import { userFacingText } from '../../../lib/user-facing-text'
|
||
import { videoOperationAllowed } from '../video-permissions'
|
||
import FeedbackMessage from '../../../components/ui/FeedbackMessage.vue'
|
||
|
||
import ContextNotice from '../../../components/ui/ContextNotice.vue'
|
||
|
||
import AppForm from '../../../components/ui/AppForm.vue'
|
||
import { NFormItem } from 'naive-ui'
|
||
import { integerRule, sizeRules } from '../../../lib/form-rules'
|
||
import { computed, ref, watch } from 'vue'
|
||
import { NButton, NCheckbox, NCollapse, NCollapseItem, NInput, NInputNumber, NRadioButton, NRadioGroup } from 'naive-ui'
|
||
import { AppDialog } from '../../../components/ui'
|
||
import { useKeyframeVision } from '../keyframe-vision'
|
||
import { allowedTextLines, validQualityInput } from '../quality'
|
||
import type { QualityAction, QualityInput, QualityTarget } from '../quality.types'
|
||
import { useEffectiveKeyframeQuality } from '../effective-keyframe-quality'
|
||
import { useQuality } from '../useQuality'
|
||
import QualityResult from './QualityResult.vue'
|
||
import KeyframeValidationHistory from './KeyframeValidationHistory.vue'
|
||
import WorkflowExecutionPanel from '../../workflows/WorkflowExecutionPanel.vue'
|
||
import GenerationModelControls from '../../generation-config/components/GenerationModelControls.vue'
|
||
import { generationConfigApi } from '../../generation-config/api'
|
||
import type { GenerationOptions } from '../../generation-config/types'
|
||
import { useQuery } from '../../../composables/useQuery'
|
||
import ModelCapabilities from './ModelCapabilities.vue'
|
||
import { productionApi } from '../api'
|
||
import type { ShotVideo } from '../types'
|
||
|
||
/** 单素材与当前集质量生成共用一个按需打开的面板,默认小批量且不自动调用模型。 */
|
||
const props = defineProps<{
|
||
/** 当前项目 */
|
||
projectId: string
|
||
/** 固定质量目标 */
|
||
target: QualityTarget | null
|
||
/** 上游状态阻断 */
|
||
disabled: boolean
|
||
/** 当前候选的公开权限,更新后撤销费用确认。 */
|
||
video?: ShotVideo | null
|
||
/** 明确修复入口的初始动作,不代替费用确认。 */
|
||
initialAction?: 'validate' | 'repair'
|
||
}>()
|
||
/** 质量面板的open状态,随目标更新。 */
|
||
const open = defineModel<boolean>('open', { default: false })
|
||
/** 通知外部刷新、定位与后台任务开始。 */
|
||
const emit = defineEmits<{ changed: []; locate: [shotId: string]; started: [executionId: string] }>()
|
||
const { key, session, operation, execution, blocked, run } = useQuality(
|
||
props,
|
||
() => open.value,
|
||
() => {
|
||
emit('changed')
|
||
void videoQuery.refresh()
|
||
void currentQuality.refresh()
|
||
},
|
||
id => emit('started', id)
|
||
)
|
||
/** 打开首帧质量弹窗时读取正式审核状态。 */
|
||
const visionKey = computed(() =>
|
||
open.value && props.target?.kind === 'keyframe'
|
||
? JSON.stringify([props.target.shotId, props.target.assetId, props.projectId])
|
||
: ''
|
||
)
|
||
const vision = useKeyframeVision(visionKey)
|
||
/** 当前候选质量独立回读,不以本会话或后台回执作为当前结论。 */
|
||
const currentQuality = useEffectiveKeyframeQuality(visionKey, vision)
|
||
/** 人工审核完成后同步当前质量和外层资产。 */
|
||
function onReviewed() {
|
||
void currentQuality.refresh()
|
||
emit('changed')
|
||
}
|
||
/** 有原参数时继续;没有原参数时保留只读核查。 */
|
||
const visionBlocked = computed(() => !!visionKey.value && vision.blocked.value)
|
||
/** 质量弹窗重新读取所选候选自身的权限,不以会话历史代替后端事实。 */
|
||
const videoKey = computed(() =>
|
||
open.value && props.target?.kind === 'video'
|
||
? JSON.stringify([props.target.shotId, props.target.assetId, props.projectId])
|
||
: ''
|
||
)
|
||
/** 按正式镜头和候选 ID 查询公开权限。 */
|
||
const videoQuery = useQuery(videoKey, async (value, signal) => {
|
||
if (!value) return null
|
||
const [shotId, assetId] = JSON.parse(value) as [string, string]
|
||
const items = await productionApi.listVideos(shotId, signal)
|
||
const item = items.find(video => video.id === assetId && video.shotId === shotId)
|
||
if (!item) throw new Error('当前视频不存在,请刷新候选。')
|
||
return item
|
||
})
|
||
/**
|
||
* 独立读取和外层最新资产均不得明确拒绝本候选操作。
|
||
* @param requested 请求的质量操作
|
||
* @returns 当前是否可以进入费用确认后的提交
|
||
*/
|
||
function canUseVideoAction(requested: 'validate' | 'repair') {
|
||
return (
|
||
!videoQuery.loading.value &&
|
||
!videoQuery.error.value &&
|
||
(!props.video || videoOperationAllowed(props.video, requested)) &&
|
||
videoOperationAllowed(videoQuery.data.value, requested)
|
||
)
|
||
}
|
||
/** 质量目标与当前候选操作权限共同控制提交。 */
|
||
const videoAllowed = computed(
|
||
() => props.target?.kind !== 'video' || canUseVideoAction(action.value === 'repair' ? 'repair' : 'validate')
|
||
)
|
||
/** 模型目录只读查询,随当前项目和弹窗状态取消过期请求。 */
|
||
const modelKey = computed(() =>
|
||
open.value && props.target?.kind === 'batch' && props.projectId ? props.projectId : ''
|
||
)
|
||
/** 模型与项目画幅读取,不自动写入配置。 */
|
||
const modelQuery = useQuery(modelKey, async (projectId, signal) =>
|
||
projectId
|
||
? {
|
||
catalog: await generationConfigApi.catalog(signal),
|
||
profile: await generationConfigApi.profile(projectId, signal)
|
||
}
|
||
: null
|
||
)
|
||
/** 本次明确选择的图片供应方。 */
|
||
const provider = ref('')
|
||
/** 本次生成与修复共用参数。 */
|
||
const generationOptions = ref<GenerationOptions>({})
|
||
/** 后台任务期间表单也保持锁定。 */
|
||
const pending = computed(() => operation.value.pending || execution.active.value)
|
||
/** 历史中的独立授权请求期间锁定关闭。 */
|
||
const authorizationPending = ref(false)
|
||
/** 候选历史授权表单通过统一底栏明确提交。 */
|
||
const visionHistoryRef = ref<InstanceType<typeof KeyframeValidationHistory> | null>(null)
|
||
/** 当前目标的单镜头范围。 */
|
||
const singleShot = computed(() => props.target?.kind === 'batch' && !!props.target.shotId)
|
||
/** 质量面板的formRef状态,随目标更新。 */
|
||
const formRef = ref<InstanceType<typeof AppForm> | null>(null)
|
||
/** 质量面板的action状态,随目标更新。 */
|
||
const action = ref<QualityAction>('validate')
|
||
/** 质量面板的attempts状态,随目标更新。 */
|
||
const attempts = ref<number | null>(1)
|
||
/** 质量面板的concurrency状态,随目标更新。 */
|
||
const concurrency = ref<number | null>(1)
|
||
/** 质量面板的limit状态,随目标更新。 */
|
||
const limit = ref<number | null>(1)
|
||
/** 质量面板的force状态,随目标更新。 */
|
||
const force = ref(false)
|
||
/** 质量面板的width状态,随目标更新。 */
|
||
const width = ref<number | null>(null)
|
||
/** 质量面板的height状态,随目标更新。 */
|
||
const height = ref<number | null>(null)
|
||
/** 质量面板的texts状态,随目标更新。 */
|
||
const texts = ref('')
|
||
/** 质量面板的acknowledged状态,随目标更新。 */
|
||
const acknowledged = ref(false)
|
||
/** 统一底栏只确认当前实际操作范围,授权操作不重复要求两次确认。 */
|
||
const footerAcknowledged = computed({
|
||
get: () =>
|
||
visionHistoryRef.value?.authorizationAvailable
|
||
? visionHistoryRef.value.authorizationAcknowledged
|
||
: acknowledged.value,
|
||
set: (value: boolean) => {
|
||
if (visionHistoryRef.value?.authorizationAvailable) visionHistoryRef.value.setAuthorizationAcknowledged(value)
|
||
else acknowledged.value = value
|
||
}
|
||
})
|
||
/** 质量面板的videoRepair状态,随目标更新。 */
|
||
const videoRepair = computed(() => props.target?.kind === 'video' && action.value === 'repair')
|
||
/** 质量面板的input状态,随目标更新。 */
|
||
const input = computed<QualityInput>(() => ({
|
||
concurrency: action.value === 'batch' ? (concurrency.value ?? 0) : 1,
|
||
limit: action.value === 'batch' && !singleShot.value ? (limit.value ?? 0) : 1,
|
||
...(props.target?.kind === 'batch' && props.target.shotId ? { shotId: props.target.shotId } : {}),
|
||
...(action.value === 'batch' && provider.value
|
||
? { provider: provider.value, generationOptions: { ...generationOptions.value } }
|
||
: {}),
|
||
maxRepairAttempts: action.value === 'validate' ? 0 : (attempts.value ?? -1),
|
||
force: force.value,
|
||
episodeNo: props.target?.kind === 'batch' ? props.target.episodeNo : 1,
|
||
allowedTexts: allowedTextLines(texts.value),
|
||
...(action.value === 'validate' || width.value === null ? {} : { width: width.value }),
|
||
...(action.value === 'validate' || height.value === null ? {} : { height: height.value })
|
||
}))
|
||
/** 批量生图必须读到真实配置并显式选定启用模型,不能回退到未确认的全局默认。 */
|
||
const modelReady = computed(
|
||
() =>
|
||
props.target?.kind !== 'batch' ||
|
||
(!modelQuery.loading.value &&
|
||
!modelQuery.error.value &&
|
||
!!modelQuery.data.value?.profile &&
|
||
modelQuery.data.value.catalog.images.some(model => model.provider === provider.value && model.enabled))
|
||
)
|
||
/** 参数及模型均有效时才允许进入费用确认后的提交。 */
|
||
const valid = computed(
|
||
() =>
|
||
modelReady.value && validQualityInput(input.value) && (!videoRepair.value || input.value.maxRepairAttempts > 0)
|
||
)
|
||
/** 质量面板的generating状态,随目标更新。 */
|
||
const generating = computed(() => action.value !== 'validate')
|
||
/** 质量面板的label状态,随目标更新。 */
|
||
const label = computed(() =>
|
||
action.value === 'batch'
|
||
? '开始质量生成'
|
||
: action.value === 'repair'
|
||
? videoRepair.value
|
||
? '创建视频修复候选'
|
||
: '校验并修复'
|
||
: '开始视觉校验'
|
||
)
|
||
/** 质量面板的maxImages状态,随目标更新。 */
|
||
const maxImages = computed(() =>
|
||
action.value === 'batch'
|
||
? input.value.limit * (1 + input.value.maxRepairAttempts)
|
||
: action.value === 'repair'
|
||
? input.value.maxRepairAttempts
|
||
: 0
|
||
)
|
||
/** 质量面板的maxValidations状态,随目标更新。 */
|
||
const maxValidations = computed(() =>
|
||
action.value === 'batch' ? maxImages.value : action.value === 'repair' ? input.value.maxRepairAttempts + 1 : 1
|
||
)
|
||
/** 质量面板的saved状态,随目标更新。 */
|
||
const saved = computed(() => (props.target?.kind === 'video' ? (session.value.videoValidation ?? null) : null))
|
||
/** 修复与校验均使用所选候选后端权限,持久化失败可直接修复。 */
|
||
const repairAvailable = computed(() => videoAllowed.value)
|
||
/** 外层候选版本或权限变化后撤销已确认费用。 */
|
||
watch([() => props.video, () => videoQuery.data.value], () => {
|
||
acknowledged.value = false
|
||
})
|
||
/** 优先选择后端允许的操作,两个权限均关闭时保持按钮禁用。 */
|
||
watch(
|
||
() => videoQuery.data.value,
|
||
video => {
|
||
if (video && !video.canValidate && video.canRepair) action.value = 'repair'
|
||
}
|
||
)
|
||
|
||
/** 目标和费用范围变化均撤销确认;关闭不取消已经发送到后端的长请求。 */
|
||
watch(
|
||
[key, open],
|
||
() => {
|
||
action.value = props.target?.kind === 'batch' ? 'batch' : (props.initialAction ?? 'validate')
|
||
attempts.value = props.target?.kind === 'video' ? 2 : 1
|
||
concurrency.value = 1
|
||
limit.value = 1
|
||
force.value = false
|
||
width.value = null
|
||
height.value = null
|
||
texts.value = ''
|
||
provider.value = ''
|
||
generationOptions.value = {}
|
||
acknowledged.value = false
|
||
},
|
||
{ immediate: true }
|
||
)
|
||
/** 参数变化撤销付费确认。 */
|
||
watch([input, action], () => {
|
||
acknowledged.value = false
|
||
})
|
||
/** 模型目录加载后使用项目已保存的供应方与参数,切镜头重置单次覆盖。 */
|
||
watch(
|
||
[() => modelQuery.data.value, key],
|
||
([data]) => {
|
||
if (!data?.profile || props.target?.kind !== 'batch') return
|
||
const selected = data.catalog.images.find(item => item.provider === data.profile!.imageProvider && item.enabled)
|
||
if (!selected) return
|
||
provider.value = selected.provider
|
||
generationOptions.value = { ...selected.defaults, ...data.profile.imageOptions }
|
||
},
|
||
{ flush: 'post' }
|
||
)
|
||
/** 付费入口保留明确确认,不因菜单选择或查看历史自动提交。 */
|
||
async function submit() {
|
||
if (
|
||
!acknowledged.value ||
|
||
!valid.value ||
|
||
blocked.value ||
|
||
visionBlocked.value ||
|
||
!repairAvailable.value ||
|
||
!!vision.state.value.resumable
|
||
)
|
||
return
|
||
acknowledged.value = false
|
||
await run(action.value, input.value)
|
||
if (visionKey.value) void vision.history.refresh()
|
||
}
|
||
|
||
/** 只用已确认的原任务身份继续;不会退回普通审核。 */
|
||
async function submitResume() {
|
||
const resume = vision.resume.value
|
||
if (!resume || !acknowledged.value || blocked.value || visionBlocked.value || action.value !== 'validate') return
|
||
acknowledged.value = false
|
||
await run('validate', input.value, resume)
|
||
if (visionKey.value) void vision.history.refresh()
|
||
}
|
||
/** 质量面板的formModel状态,随目标更新。 */
|
||
const formModel = computed(() => ({
|
||
attempts: attempts.value,
|
||
concurrency: concurrency.value,
|
||
limit: limit.value,
|
||
width: width.value,
|
||
height: height.value,
|
||
texts: texts.value
|
||
}))
|
||
/** 质量面板的rules状态,随目标更新。 */
|
||
const rules = computed(() => ({
|
||
attempts: integerRule('修复次数', videoRepair.value ? 1 : 0),
|
||
concurrency: integerRule('批量并发'),
|
||
limit: integerRule('本批镜头上限'),
|
||
...sizeRules(() => formModel.value)
|
||
}))
|
||
/** 更多参数折叠状态。 */
|
||
const optionsExpanded = ref<string[]>(['options'])
|
||
</script>
|
||
|
||
<template>
|
||
<!-- 以下是质量操作与显式费用确认模块 -->
|
||
<AppDialog
|
||
v-model:open="open"
|
||
:title="`质量检查 · ${target?.title ?? ''}`"
|
||
:busy="pending || authorizationPending"
|
||
wide
|
||
>
|
||
<ContextNotice
|
||
v-if="target?.kind === 'video' && (videoQuery.error.value || videoQuery.data.value?.staleReason)"
|
||
type="warning"
|
||
:show-icon="false"
|
||
>
|
||
{{ userFacingText(videoQuery.error.value || videoQuery.data.value?.staleReason) }}
|
||
</ContextNotice>
|
||
<AppForm
|
||
ref="formRef"
|
||
:model="formModel"
|
||
:rules="rules"
|
||
:disabled="pending"
|
||
:reset-key="`${open}:${key}:${action}`"
|
||
validate-on-change
|
||
@invalid="optionsExpanded = ['options']"
|
||
@submit="submit"
|
||
>
|
||
<NRadioGroup
|
||
v-if="target && target.kind !== 'batch' && !visionHistoryRef?.authorizationAvailable"
|
||
v-model:value="action"
|
||
:disabled="pending"
|
||
class="mt-4"
|
||
aria-label="素材质量操作"
|
||
>
|
||
<NRadioButton value="validate" :disabled="target?.kind === 'video' && !canUseVideoAction('validate')"
|
||
>视觉校验</NRadioButton
|
||
><NRadioButton value="repair" :disabled="target?.kind === 'video' && !canUseVideoAction('repair')">{{
|
||
target?.kind === 'video' ? '生成修复候选' : '校验并修复'
|
||
}}</NRadioButton>
|
||
</NRadioGroup>
|
||
<ContextNotice v-if="target?.kind === 'video'" type="info" :show-icon="false" class="mt-4"
|
||
>仅检查画面、动作和道具。修复候选复检通过后自动设为主视频。</ContextNotice
|
||
>
|
||
<div v-if="generating" class="quality-fields mt-4">
|
||
<NFormItem path="attempts" :label="videoRepair ? '修复链次数上限' : '每镜最多修复'"
|
||
><NInputNumber
|
||
v-model:value="attempts"
|
||
:disabled="pending"
|
||
:min="videoRepair ? 1 : 0"
|
||
:step="1"
|
||
:input-props="{ 'aria-label': '每镜最多修复次数' }"
|
||
/></NFormItem>
|
||
<NFormItem v-if="target?.kind === 'batch' && !singleShot" path="limit" label="本批镜头上限"
|
||
><NInputNumber
|
||
v-model:value="limit"
|
||
:disabled="pending"
|
||
:min="1"
|
||
:step="1"
|
||
:input-props="{ 'aria-label': '质量生成镜头上限' }"
|
||
/></NFormItem>
|
||
</div>
|
||
<NCheckbox v-if="target?.kind === 'batch'" v-model:checked="force" :disabled="pending" class="mt-4"
|
||
>重做当前范围已有有效首帧(通过后替换主图)</NCheckbox
|
||
>
|
||
<p v-if="target?.kind === 'batch'" class="mt-3 text-xs text-muted">
|
||
仅第 {{ target.episodeNo }} 集{{ singleShot ? `,指定镜头 ${target.shotId}` : '' }},最多
|
||
{{ singleShot ? 1 : (limit ?? '—') }} 镜;非重做模式处理符合条件的过期和缺失首帧。
|
||
</p>
|
||
<p v-if="videoRepair" class="mt-3 text-xs text-muted">按上次检查的问题修复一个视频。生成后请手动复检。</p>
|
||
<ContextNotice v-if="!repairAvailable" type="warning" :show-icon="false" class="mt-3"
|
||
>当前候选暂时不能执行这项检查,请查看原因或刷新任务状态。</ContextNotice
|
||
>
|
||
<NCollapse
|
||
v-if="!videoRepair && !visionHistoryRef?.authorizationAvailable"
|
||
v-model:expanded-names="optionsExpanded"
|
||
display-directive="show"
|
||
class="mt-4"
|
||
>
|
||
<NCollapseItem name="options" title="更多参数与模型限制">
|
||
<div class="quality-fields">
|
||
<NFormItem v-if="target?.kind === 'batch'" path="concurrency" label="批量并发"
|
||
><NInputNumber
|
||
v-model:value="concurrency"
|
||
:disabled="pending"
|
||
:min="1"
|
||
:step="1"
|
||
:input-props="{ 'aria-label': '质量生成并发' }"
|
||
/></NFormItem>
|
||
<NFormItem v-if="generating" path="width" label="宽度(可选)"
|
||
><NInputNumber
|
||
v-model:value="width"
|
||
:disabled="pending"
|
||
:min="1"
|
||
:input-props="{ 'aria-label': '质量生成宽度' }"
|
||
/></NFormItem>
|
||
<NFormItem v-if="generating" path="height" label="高度(可选)"
|
||
><NInputNumber
|
||
v-model:value="height"
|
||
:disabled="pending"
|
||
:min="1"
|
||
:input-props="{ 'aria-label': '质量生成高度' }"
|
||
/></NFormItem>
|
||
</div>
|
||
<NFormItem class="mt-4 block" path="texts" label="额外允许的画面文字(一行一项,可留空)"
|
||
><NInput
|
||
:value="texts"
|
||
@update:value="texts = $event"
|
||
:disabled="pending || !!vision.state.value.resumable"
|
||
type="textarea"
|
||
:autosize="{ minRows: 2, maxRows: 5 }"
|
||
:input-props="{ 'aria-label': '额外允许的画面文字' }"
|
||
/></NFormItem>
|
||
<!-- 以下是复用现有模型目录的单次质量生成配置模块 -->
|
||
<GenerationModelControls
|
||
v-if="target?.kind === 'batch' && modelQuery.data.value?.profile"
|
||
v-model:provider="provider"
|
||
v-model:options="generationOptions"
|
||
type="image"
|
||
:catalog="modelQuery.data.value.catalog"
|
||
:aspect-ratio="modelQuery.data.value.profile.aspectRatio"
|
||
:disabled="pending"
|
||
/>
|
||
<ContextNotice v-if="modelQuery.error.value" type="error" :show-icon="false">{{
|
||
modelQuery.error.value
|
||
}}</ContextNotice>
|
||
<ContextNotice
|
||
v-if="target?.kind === 'batch' && !modelReady && !modelQuery.error.value"
|
||
type="warning"
|
||
:show-icon="false"
|
||
>
|
||
{{
|
||
modelQuery.loading.value
|
||
? '正在读取项目模型配置,请稍候。'
|
||
: '请先保存有效的项目图片模型配置,再选择本次模型。'
|
||
}}
|
||
</ContextNotice>
|
||
<ModelCapabilities
|
||
:shot-id="target?.shotId"
|
||
:provider="target?.kind === 'batch' ? provider : undefined"
|
||
/>
|
||
</NCollapseItem>
|
||
</NCollapse>
|
||
<ContextNotice
|
||
v-if="!visionHistoryRef?.authorizationAvailable"
|
||
type="warning"
|
||
:show-icon="false"
|
||
class="mt-4"
|
||
>
|
||
<template v-if="videoRepair">最多生成 1 个候选,可能收费。付费复检通过后才会设为主视频。</template>
|
||
<template v-else-if="target?.kind === 'video'"
|
||
>本次会检查视频画面,可能使用多个识图模型并产生费用。</template
|
||
>
|
||
<template v-else-if="valid"
|
||
>本次最多调用 {{ maxImages }} 次生图、{{ maxValidations }} 次视觉校验,均可能产生费用。</template
|
||
>
|
||
<template v-if="generating && !videoRepair"
|
||
>修复/质量生成通过后可能替换主首帧;失败候选仍会保留,已有视频不会自动更新。</template
|
||
>
|
||
<template v-else-if="!generating">{{
|
||
target?.kind === 'video'
|
||
? '如果当前是修复候选,校验通过将替换当前主视频。'
|
||
: '仅校验,不修改主资产。'
|
||
}}</template>
|
||
</ContextNotice>
|
||
</AppForm>
|
||
<p v-if="pending" role="status" class="mt-3 text-xs text-muted">{{ operation.label }}进行中,请勿重复提交。</p>
|
||
<FeedbackMessage v-if="session.error" :message="session.error" />
|
||
<!-- 以下是持久化任务进度与原目标最终回执模块 -->
|
||
<WorkflowExecutionPanel
|
||
v-if="execution.executionId.value"
|
||
title="首帧质量后台任务"
|
||
:execution="execution.query.data.value"
|
||
:loading="execution.query.loading.value"
|
||
:error="execution.query.error.value"
|
||
@refresh="execution.query.refresh"
|
||
@dismiss="execution.dismiss"
|
||
/>
|
||
<p v-if="vision.state.value.resumable && !vision.resume.value" class="mt-3 text-xs text-muted">
|
||
原审核缺少可核对的请求版本,暂不能安全继续。
|
||
</p>
|
||
<KeyframeValidationHistory
|
||
ref="visionHistoryRef"
|
||
v-if="open && target?.kind === 'keyframe'"
|
||
:project-id="projectId"
|
||
:shot-id="target.shotId"
|
||
:key="target.assetId"
|
||
:keyframe-id="target.assetId"
|
||
:observation="vision"
|
||
:disabled="disabled || pending"
|
||
initial-open
|
||
@reviewed="onReviewed"
|
||
@busy="authorizationPending = $event"
|
||
/>
|
||
<QualityResult
|
||
v-if="session.receipt"
|
||
:receipt="session.receipt"
|
||
:current-status="currentQuality.status.value"
|
||
@locate="emit('locate', $event)"
|
||
/>
|
||
<NCollapse v-else-if="saved" class="mt-4" :default-expanded-names="['saved']"
|
||
><NCollapseItem name="saved" :title="`本会话最近校验 · ${saved.passed ? '通过' : '未通过'}`"
|
||
><p>{{ saved.summary }}</p>
|
||
<p v-for="(issue, index) in saved.issues" :key="index" class="mt-2 text-danger">
|
||
{{ userFacingText(issue.description) }}
|
||
</p>
|
||
<p class="mt-3 text-xs text-muted">此为历史抽样结论,不保证当前上游素材仍然一致。</p></NCollapseItem
|
||
></NCollapse
|
||
>
|
||
<p v-if="target?.kind !== 'batch'" class="mt-3 text-xs text-muted">可导出结果或查看首帧检查历史。</p>
|
||
<!-- 以下是底栏左侧费用确认与右侧操作按钮模块 -->
|
||
<template #footer>
|
||
<div class="quality-dialog-footer">
|
||
<NCheckbox
|
||
v-model:checked="footerAcknowledged"
|
||
:disabled="pending || authorizationPending"
|
||
class="quality-dialog-acknowledgement"
|
||
>{{
|
||
visionHistoryRef?.authorizationAvailable
|
||
? '我已确认授权、费用与本次处理范围,且同项目没有其他生成任务。'
|
||
: '我已确认费用、处理范围,且同项目没有其他生成任务。'
|
||
}}</NCheckbox
|
||
>
|
||
<div class="quality-dialog-actions">
|
||
<NButton :disabled="pending || authorizationPending" @click="open = false">关闭</NButton>
|
||
<NButton
|
||
v-if="visionHistoryRef?.authorizationAvailable"
|
||
type="primary"
|
||
:loading="authorizationPending"
|
||
:disabled="blocked || !visionHistoryRef.authorizationReady"
|
||
@click="visionHistoryRef.submitAuthorization()"
|
||
>{{ visionHistoryRef.authorizationLabel }}</NButton
|
||
>
|
||
<NButton
|
||
v-else-if="vision.state.value.resumable"
|
||
type="primary"
|
||
:loading="pending"
|
||
:disabled="
|
||
blocked || visionBlocked || !acknowledged || !vision.resume.value || action !== 'validate'
|
||
"
|
||
@click="submitResume"
|
||
>继续原审核</NButton
|
||
>
|
||
<NButton
|
||
v-else
|
||
type="primary"
|
||
:loading="pending"
|
||
:disabled="blocked || visionBlocked || !acknowledged || !repairAvailable"
|
||
@click="formRef?.validate(submit)"
|
||
>{{ label }}</NButton
|
||
>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</AppDialog>
|
||
</template>
|
||
|
||
<style>
|
||
/* 本组件专属布局与 Naive 内部结构覆盖。 */
|
||
@reference "../../../styles/styles.css";
|
||
.quality-fields {
|
||
@apply grid grid-cols-[repeat(auto-fit,_minmax(min(100%,_180px),_1fr))] items-start gap-4;
|
||
}
|
||
|
||
/* 确认项固定在底栏左侧,操作按钮在右侧;窄屏允许分行。 */
|
||
.app-dialog .dialog-footer:has(> .quality-dialog-footer) {
|
||
@apply w-full;
|
||
}
|
||
.quality-dialog-footer {
|
||
@apply flex w-full flex-wrap items-center justify-between gap-4;
|
||
}
|
||
.quality-dialog-acknowledgement {
|
||
@apply min-w-0 flex-1;
|
||
flex-basis: 360px;
|
||
}
|
||
.quality-dialog-actions {
|
||
@apply ml-auto flex shrink-0 items-center gap-2;
|
||
}
|
||
</style>
|