feat: 首帧校验历史支持人工接受拒绝与安全预检查
This commit is contained in:
1 parent
7a82a62242
commit
105e461a5c
1 file changed
+73
@@ -1,5 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
|
import { NButton, NInput, NAlert } from 'naive-ui'
|
||||||
|
import { errorMessage } from '../../../lib/http'
|
||||||
import ReadonlyInspection from '../../../components/ui/ReadonlyInspection.vue'
|
import ReadonlyInspection from '../../../components/ui/ReadonlyInspection.vue'
|
||||||
import { useQuery } from '../../../composables/useQuery'
|
import { useQuery } from '../../../composables/useQuery'
|
||||||
import { formatDate } from '../../../lib/format'
|
import { formatDate } from '../../../lib/format'
|
||||||
@@ -14,7 +16,10 @@ const props = defineProps<{
|
|||||||
shotId: string
|
shotId: string
|
||||||
/** 当前首帧 */
|
/** 当前首帧 */
|
||||||
keyframeId: string
|
keyframeId: string
|
||||||
|
/** 正在执行其他镜头操作时禁止提交审核。 */
|
||||||
|
disabled?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
const emit = defineEmits<{ reviewed: [] }>()
|
||||||
/** 默认折叠,仅展开后查询。 */
|
/** 默认折叠,仅展开后查询。 */
|
||||||
const open = ref(false)
|
const open = ref(false)
|
||||||
/** 查询键包含全部归属信息,旧请求会被取消。 */
|
/** 查询键包含全部归属信息,旧请求会被取消。 */
|
||||||
@@ -44,6 +49,53 @@ const decisionLabel = (value: string) => ({
|
|||||||
manual_accepted: '人工已接受',
|
manual_accepted: '人工已接受',
|
||||||
unknown: '未校验'
|
unknown: '未校验'
|
||||||
})[value] ?? value
|
})[value] ?? value
|
||||||
|
const reviewAction = ref<'accepted' | 'rejected' | null>(null)
|
||||||
|
const reviewReason = ref('')
|
||||||
|
const reviewer = ref('user')
|
||||||
|
const submitting = ref(false)
|
||||||
|
const submitError = ref('')
|
||||||
|
const submitSuccess = ref('')
|
||||||
|
|
||||||
|
/** 人工接受必须先执行最新安全预检查;任何写入都需要明确按钮操作。 */
|
||||||
|
async function submitReview() {
|
||||||
|
if (!reviewAction.value || !review.value?.validationTaskId || !reviewReason.value.trim() ||
|
||||||
|
!reviewer.value.trim() || submitting.value || props.disabled) return
|
||||||
|
submitting.value = true
|
||||||
|
submitError.value = ''
|
||||||
|
submitSuccess.value = ''
|
||||||
|
try {
|
||||||
|
const taskId = review.value.validationTaskId
|
||||||
|
if (reviewAction.value === 'accepted') {
|
||||||
|
const preview = await qualityApi.previewKeyframeAccept(props.shotId, props.keyframeId, taskId)
|
||||||
|
if (!preview.canAccept || !preview.requiresManualConfirmation) {
|
||||||
|
throw new Error('候选未通过人工接受预检查')
|
||||||
|
}
|
||||||
|
await qualityApi.acceptKeyframeReview(props.shotId, props.keyframeId, {
|
||||||
|
validationTaskId: taskId,
|
||||||
|
expectedPrimaryId: preview.expectedPrimaryId,
|
||||||
|
reviewer: reviewer.value.trim(),
|
||||||
|
reason: reviewReason.value.trim()
|
||||||
|
})
|
||||||
|
submitSuccess.value = '已人工接受,主首帧已更新。'
|
||||||
|
} else {
|
||||||
|
await qualityApi.rejectKeyframeReview(props.shotId, props.keyframeId, {
|
||||||
|
validationTaskId: taskId,
|
||||||
|
reviewer: reviewer.value.trim(),
|
||||||
|
reason: reviewReason.value.trim()
|
||||||
|
})
|
||||||
|
submitSuccess.value = '已记录人工拒绝,候选图片仍保留。'
|
||||||
|
}
|
||||||
|
reviewAction.value = null
|
||||||
|
reviewReason.value = ''
|
||||||
|
reviewQuery.refresh()
|
||||||
|
query.refresh()
|
||||||
|
emit('reviewed')
|
||||||
|
} catch (cause) {
|
||||||
|
submitError.value = errorMessage(cause)
|
||||||
|
} finally {
|
||||||
|
submitting.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
const records = computed(() =>
|
const records = computed(() =>
|
||||||
(query.data.value ?? []).map(item => ({ ...item, validation: parseKeyframeValidationOutput(item.output) }))
|
(query.data.value ?? []).map(item => ({ ...item, validation: parseKeyframeValidationOutput(item.output) }))
|
||||||
)
|
)
|
||||||
@@ -76,6 +128,27 @@ const records = computed(() =>
|
|||||||
<p class="text-muted">{{ item.reason }}</p>
|
<p class="text-muted">{{ item.reason }}</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<section v-if="review?.manualReviewAvailable" class="panel mt-3 p-3 text-xs">
|
||||||
|
<p class="font-semibold">人工复核</p>
|
||||||
|
<p class="mt-2 text-muted">请先预览候选图片并确认视觉效果。接受会替换当前主首帧,拒绝只保存审核记录。</p>
|
||||||
|
<div class="mt-3 flex flex-wrap gap-2">
|
||||||
|
<NButton size="small" :disabled="disabled || submitting" @click="reviewAction = 'accepted'">人工接受</NButton>
|
||||||
|
<NButton size="small" :disabled="disabled || submitting" @click="reviewAction = 'rejected'">人工拒绝</NButton>
|
||||||
|
</div>
|
||||||
|
<div v-if="reviewAction" class="mt-3 space-y-3">
|
||||||
|
<NInput v-model:value="reviewer" placeholder="审核人" :disabled="submitting" />
|
||||||
|
<NInput v-model:value="reviewReason" type="textarea" :rows="3" placeholder="填写审核理由(必填)" :disabled="submitting" />
|
||||||
|
<NAlert :type="reviewAction === 'accepted' ? 'warning' : 'info'" :show-icon="false">
|
||||||
|
{{ reviewAction === 'accepted' ? '确认接受后将替换当前主首帧;AI 原始失败记录仍会保留。' : '拒绝后保留图片及原始质量记录。' }}
|
||||||
|
</NAlert>
|
||||||
|
<div class="flex gap-3">
|
||||||
|
<NButton type="primary" :loading="submitting" :disabled="!reviewReason.trim() || !reviewer.trim()" @click="submitReview">确认{{ reviewAction === 'accepted' ? '接受' : '拒绝' }}</NButton>
|
||||||
|
<NButton :disabled="submitting" @click="reviewAction = null">取消</NButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<NAlert v-if="submitError" type="error" :show-icon="false" class="mt-3">{{ submitError }}</NAlert>
|
||||||
|
<NAlert v-if="submitSuccess" type="success" :show-icon="false" class="mt-3">{{ submitSuccess }}</NAlert>
|
||||||
<p v-if="reviewQuery.error.value" class="text-danger">{{ reviewQuery.error.value }}</p>
|
<p v-if="reviewQuery.error.value" class="text-danger">{{ reviewQuery.error.value }}</p>
|
||||||
<p v-if="!records.length" class="text-muted">暂无校验记录。</p>
|
<p v-if="!records.length" class="text-muted">暂无校验记录。</p>
|
||||||
<!-- 以下是实际校验结论、问题与调用错误模块 -->
|
<!-- 以下是实际校验结论、问题与调用错误模块 -->
|
||||||
|
|||||||
Reference in new issue
Block a user