fix(short-drama-agent-front): 修复代码格式检查问题
This commit is contained in:
1 parent
81d6a85260
commit
48fce3975f
87 files changed
+5714
-1436
No files matched your search
@@ -92,9 +92,21 @@ const plans = computed(() => result.value?.storyboardPlans ?? [])
|
||||
const shots = computed(() => result.value?.storyboardEpisodeShots ?? [])
|
||||
const summary = computed(() => snapshot.value?.taskSummary)
|
||||
/** 候选审核读取完成前不展示旧错误。 */
|
||||
const validation = computed(() => quality.value.structureValid === null ? undefined : { valid: quality.value.structureValid, issues: quality.value.structuralIssues })
|
||||
const validation = computed(() =>
|
||||
quality.value.structureValid === null
|
||||
? undefined
|
||||
: { valid: quality.value.structureValid, issues: quality.value.structuralIssues }
|
||||
)
|
||||
/** 数据来源在桌面和移动端正文均明确显示,候选数量不冒充正式资产。 */
|
||||
const sourceLabel = computed(() => ({ candidate: '拆解候选 · 尚未提交正式结果', formal: '正式拆解结果', history: '历史结果 · 仅供回看', empty: '' })[quality.value.source])
|
||||
const sourceLabel = computed(
|
||||
() =>
|
||||
({
|
||||
candidate: '拆解候选 · 尚未提交正式结果',
|
||||
formal: '正式拆解结果',
|
||||
history: '历史结果 · 仅供回看',
|
||||
empty: ''
|
||||
})[quality.value.source]
|
||||
)
|
||||
const operation = computed(() => getOperation(projectId.value))
|
||||
/** 分镜阅读和诊断入口共用当前剧集,不维护独立的诊断集号输入。 */
|
||||
const selectedEpisodeNo = ref<number>()
|
||||
@@ -204,17 +216,25 @@ async function locateIssue(issue: ShotValidation['issues'][number]) {
|
||||
selectedEpisodeNo.value = issue.episodeNo
|
||||
await nextTick()
|
||||
if (issue.beatNo)
|
||||
await storyboardList.value?.locate({
|
||||
episodeNo: issue.episodeNo,
|
||||
beatNo: issue.beatNo,
|
||||
...(issue.shotNo ? { shotNo: issue.shotNo } : {})
|
||||
}, { problem: true })
|
||||
await storyboardList.value?.locate(
|
||||
{
|
||||
episodeNo: issue.episodeNo,
|
||||
beatNo: issue.beatNo,
|
||||
...(issue.shotNo ? { shotNo: issue.shotNo } : {})
|
||||
},
|
||||
{ problem: true }
|
||||
)
|
||||
}
|
||||
const taskStopped = computed(() => execution.value?.status === 'failed' || execution.value?.status === 'completed')
|
||||
/** 后续候选修订已替代旧任务结果时,只在明确的历史记录中展示回执。 */
|
||||
const executionHistorical = computed(() => {
|
||||
const record = backgroundExecution.query.data.value
|
||||
return !!record && !!latestCheckpoint.value && !!record.completedAt && Date.parse(latestCheckpoint.value.createdAt) > Date.parse(record.completedAt)
|
||||
return (
|
||||
!!record &&
|
||||
!!latestCheckpoint.value &&
|
||||
!!record.completedAt &&
|
||||
Date.parse(latestCheckpoint.value.createdAt) > Date.parse(record.completedAt)
|
||||
)
|
||||
})
|
||||
/** 后台拆解结束后自动刷新项目、Checkpoint 与正式主体/分镜数据。 */
|
||||
watch(
|
||||
@@ -244,10 +264,32 @@ const hasBreakdownIssues = computed(() =>
|
||||
)
|
||||
/** 问题按钮按真实问题类型展示,不把质量待审或执行异常误称为结构校验失败。 */
|
||||
const issueEntryLabel = computed(() =>
|
||||
quality.value.error ? '候选审核待刷新' : validation.value?.valid === false ? '分镜校验未通过' : pendingQuality.value ? '分镜质量待修订' : '拆解问题待处理'
|
||||
quality.value.error
|
||||
? '候选审核待刷新'
|
||||
: validation.value?.valid === false
|
||||
? '分镜校验未通过'
|
||||
: pendingQuality.value
|
||||
? '分镜质量待修订'
|
||||
: '拆解问题待处理'
|
||||
)
|
||||
/** 当前状态颜色只取当前质量和活动任务,不继承历史执行失败。 */
|
||||
const qualityStatus = computed(() => breakdownBusy.value ? 'running' : quality.value.loading ? 'pending' : quality.value.needsRefresh ? 'unknown' : currentWorkflowError.value ? 'failed' : quality.value.problems.length ? 'blocked' : quality.value.structureValid === true ? quality.value.isCandidate ? 'candidate_pending' : 'completed' : 'unknown')
|
||||
const qualityStatus = computed(() =>
|
||||
breakdownBusy.value
|
||||
? 'running'
|
||||
: quality.value.loading
|
||||
? 'pending'
|
||||
: quality.value.needsRefresh
|
||||
? 'unknown'
|
||||
: currentWorkflowError.value
|
||||
? 'failed'
|
||||
: quality.value.problems.length
|
||||
? 'blocked'
|
||||
: quality.value.structureValid === true
|
||||
? quality.value.isCandidate
|
||||
? 'candidate_pending'
|
||||
: 'completed'
|
||||
: 'unknown'
|
||||
)
|
||||
/** 当前生命周期与审核文案集中展示。 */
|
||||
const qualityLabel = computed(() => {
|
||||
if (breakdownBusy.value) return '拆解进行中'
|
||||
@@ -271,8 +313,9 @@ const issueActionsDisabled = computed(
|
||||
operation.value.pending ||
|
||||
breakdownBusy.value ||
|
||||
backgroundExecution.discovering.value ||
|
||||
!!backgroundExecution.discoveryError.value
|
||||
|| quality.value.loading || !!quality.value.error
|
||||
!!backgroundExecution.discoveryError.value ||
|
||||
quality.value.loading ||
|
||||
!!quality.value.error
|
||||
)
|
||||
const configValid = computed(
|
||||
() => Number.isSafeInteger(groupSize.value) && groupSize.value > 0 && modules.value.length > 0
|
||||
@@ -304,7 +347,13 @@ watch(
|
||||
() => {
|
||||
const executionError = currentWorkflowError.value
|
||||
const invalid = quality.value.issueCount > 0
|
||||
if (quality.value.needsRefresh || quality.value.loading || breakdownBusy.value || backgroundExecution.discovering.value) return
|
||||
if (
|
||||
quality.value.needsRefresh ||
|
||||
quality.value.loading ||
|
||||
breakdownBusy.value ||
|
||||
backgroundExecution.discovering.value
|
||||
)
|
||||
return
|
||||
if ((!executionError && !invalid) || notifiedIssues.has(issueSignature.value)) return
|
||||
notifiedIssues.add(issueSignature.value)
|
||||
actionMessage?.warning(
|
||||
@@ -361,10 +410,20 @@ const rulesAcknowledged = ref(false)
|
||||
/** 每次真实模型启动仍需核对后台任务是否停止。 */
|
||||
const startAcknowledged = ref(false)
|
||||
/** 规则、目标或步骤变化后重新确认,不沿用旧勾选。 */
|
||||
watch([startPolicy.reviewOpen, startPolicy.editorKey, startScope], () => { rulesAcknowledged.value = false })
|
||||
watch(startPolicy.startOpen, () => { startAcknowledged.value = false })
|
||||
watch([startPolicy.reviewOpen, startPolicy.editorKey, startScope], () => {
|
||||
rulesAcknowledged.value = false
|
||||
})
|
||||
watch(startPolicy.startOpen, () => {
|
||||
startAcknowledged.value = false
|
||||
})
|
||||
/** 关闭整个设置时中断只读确认,不能在关闭后打开迟到的弹窗。 */
|
||||
watch(toolsOpen, shown => { if (!shown) startPolicy.cancel() }, { flush: 'sync' })
|
||||
watch(
|
||||
toolsOpen,
|
||||
shown => {
|
||||
if (!shown) startPolicy.cancel()
|
||||
},
|
||||
{ flush: 'sync' }
|
||||
)
|
||||
|
||||
/** 校验用户编辑的规则,成功后进入普通启动确认;此步骤不运行模型。 */
|
||||
async function confirmStartRules() {
|
||||
@@ -452,7 +511,11 @@ async function run(action: BreakdownAction) {
|
||||
id,
|
||||
labels[action],
|
||||
async () => {
|
||||
const started = await breakdownApi.run(id, action, action === 'start' ? { ...input.value, ...permit! } : undefined)
|
||||
const started = await breakdownApi.run(
|
||||
id,
|
||||
action,
|
||||
action === 'start' ? { ...input.value, ...permit! } : undefined
|
||||
)
|
||||
await backgroundExecution.track(started.executionId)
|
||||
return started
|
||||
},
|
||||
@@ -460,8 +523,13 @@ async function run(action: BreakdownAction) {
|
||||
)
|
||||
await refresh()
|
||||
const cause = operation.value.cause
|
||||
if (!success && action === 'start' && id === projectId.value && cause instanceof ApiError &&
|
||||
['QUALITY_POLICY_NOT_CONFIRMED', 'QUALITY_POLICY_VERSION_CONFLICT'].includes(cause.code ?? ''))
|
||||
if (
|
||||
!success &&
|
||||
action === 'start' &&
|
||||
id === projectId.value &&
|
||||
cause instanceof ApiError &&
|
||||
['QUALITY_POLICY_NOT_CONFIRMED', 'QUALITY_POLICY_VERSION_CONFLICT'].includes(cause.code ?? '')
|
||||
)
|
||||
await startPolicy.prepare()
|
||||
}
|
||||
|
||||
@@ -533,8 +601,13 @@ const rules = {
|
||||
@closed="finishOpeningIssues"
|
||||
>
|
||||
<!-- 以下是在同一全屏抽屉内核对真实质量规则的模块,不叠加第二个抽屉 -->
|
||||
<div v-if="startPolicy.reviewOpen.value && startPolicy.policy.value" class="breakdown-policy-review">
|
||||
<p class="text-sm leading-6 text-muted">请核对动作与物理规则,修改将在继续时保存。确认会保存到当前项目,规则未变时不再重复提醒。</p>
|
||||
<div
|
||||
v-if="startPolicy.reviewOpen.value && startPolicy.policy.value"
|
||||
class="breakdown-policy-review"
|
||||
>
|
||||
<p class="text-sm leading-6 text-muted">
|
||||
请核对动作与物理规则,修改将在继续时保存。确认会保存到当前项目,规则未变时不再重复提醒。
|
||||
</p>
|
||||
<QualityPolicySettings
|
||||
ref="qualityForm"
|
||||
:key="startPolicy.editorKey.value"
|
||||
@@ -542,13 +615,22 @@ const rules = {
|
||||
:initial-policy="startPolicy.policy.value"
|
||||
:disabled="!canStart || startPolicy.busy.value"
|
||||
/>
|
||||
<NCheckbox v-model:checked="rulesAcknowledged" :disabled="startPolicy.busy.value || !canStart" class="mt-5">
|
||||
<NCheckbox
|
||||
v-model:checked="rulesAcknowledged"
|
||||
:disabled="startPolicy.busy.value || !canStart"
|
||||
class="mt-5"
|
||||
>
|
||||
我已核对本次拆解使用的质量规则
|
||||
</NCheckbox>
|
||||
<p v-if="startPolicy.error.value" role="alert" class="mt-4 text-sm text-danger">{{ startPolicy.error.value }}</p>
|
||||
<p v-if="startPolicy.error.value" role="alert" class="mt-4 text-sm text-danger">
|
||||
{{ startPolicy.error.value }}
|
||||
</p>
|
||||
</div>
|
||||
<!-- 以下是拆解分组设置模块,规则确认时保留已有预览和草稿 -->
|
||||
<section v-show="!startPolicy.reviewOpen.value" class="panel workspace-panel breakdown-settings-panel">
|
||||
<section
|
||||
v-show="!startPolicy.reviewOpen.value"
|
||||
class="panel workspace-panel breakdown-settings-panel"
|
||||
>
|
||||
<p
|
||||
v-if="backgroundExecution.discoveryError.value"
|
||||
class="mb-4 text-xs leading-6 text-danger"
|
||||
@@ -658,7 +740,9 @@ const rules = {
|
||||
type="primary"
|
||||
:disabled="!canStart || startPolicy.busy.value"
|
||||
@click="startPolicy.prepare"
|
||||
><template #icon><ShieldCheck :size="16" aria-hidden="true" /></template>{{ candidateOnly ? '生成拆解候选' : '开始拆解' }}</NButton>
|
||||
><template #icon><ShieldCheck :size="16" aria-hidden="true" /></template
|
||||
>{{ candidateOnly ? '生成拆解候选' : '开始拆解' }}</NButton
|
||||
>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<div v-for="group in preview.groups" :key="group.groupId" class="group-chip">
|
||||
@@ -667,7 +751,13 @@ const rules = {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="startPolicy.error.value && !startPolicy.startOpen.value" role="alert" class="mt-4 text-sm text-danger">{{ startPolicy.error.value }}</p>
|
||||
<p
|
||||
v-if="startPolicy.error.value && !startPolicy.startOpen.value"
|
||||
role="alert"
|
||||
class="mt-4 text-sm text-danger"
|
||||
>
|
||||
{{ startPolicy.error.value }}
|
||||
</p>
|
||||
<p v-if="project.status === 'generating'" class="mt-4 text-xs text-danger">
|
||||
剧本仍在生成,暂不允许启动拆解,避免读取到不完整的剧集。
|
||||
</p>
|
||||
@@ -688,40 +778,79 @@ const rules = {
|
||||
@refresh="refreshCandidate"
|
||||
/>
|
||||
<!-- 以下是明确标记的历史执行回执,旧任务结论不表示当前候选质量 -->
|
||||
<component :is="executionHistorical ? NCollapse : 'div'" v-if="backgroundExecution.executionId.value" v-show="!startPolicy.reviewOpen.value" :class="{ 'breakdown-execution-history': executionHistorical }">
|
||||
<component :is="executionHistorical ? NCollapseItem : 'div'" :name="executionHistorical ? 'history' : undefined" :title="executionHistorical ? '历史拆解执行记录(不代表当前质量)' : undefined">
|
||||
<WorkflowExecutionPanel
|
||||
<component
|
||||
:is="executionHistorical ? NCollapse : 'div'"
|
||||
v-if="backgroundExecution.executionId.value"
|
||||
:title="executionHistorical ? '历史拆解任务' : '剧本拆解任务'"
|
||||
class="breakdown-execution-panel"
|
||||
:show-status-hint="false"
|
||||
:execution="backgroundExecution.query.data.value"
|
||||
:loading="backgroundExecution.query.loading.value"
|
||||
:error="backgroundExecution.query.error.value"
|
||||
@refresh="backgroundExecution.query.refresh"
|
||||
@dismiss="backgroundExecution.dismiss"
|
||||
/>
|
||||
</component>
|
||||
v-show="!startPolicy.reviewOpen.value"
|
||||
:class="{ 'breakdown-execution-history': executionHistorical }"
|
||||
>
|
||||
<component
|
||||
:is="executionHistorical ? NCollapseItem : 'div'"
|
||||
:name="executionHistorical ? 'history' : undefined"
|
||||
:title="executionHistorical ? '历史拆解执行记录(不代表当前质量)' : undefined"
|
||||
>
|
||||
<WorkflowExecutionPanel
|
||||
v-if="backgroundExecution.executionId.value"
|
||||
:title="executionHistorical ? '历史拆解任务' : '剧本拆解任务'"
|
||||
class="breakdown-execution-panel"
|
||||
:show-status-hint="false"
|
||||
:execution="backgroundExecution.query.data.value"
|
||||
:loading="backgroundExecution.query.loading.value"
|
||||
:error="backgroundExecution.query.error.value"
|
||||
@refresh="backgroundExecution.query.refresh"
|
||||
@dismiss="backgroundExecution.dismiss"
|
||||
/>
|
||||
</component>
|
||||
</component>
|
||||
<!-- 以下是固定的规则确认底栏,返回不记录确认,继续不会直接调用模型 -->
|
||||
<template v-if="startPolicy.reviewOpen.value" #footer>
|
||||
<NButton :disabled="startPolicy.saving.value" @click="startPolicy.cancel">取消</NButton>
|
||||
<NButton type="primary" :loading="startPolicy.busy.value" :disabled="!rulesAcknowledged || !qualityForm?.canSave || startPolicy.busy.value || !canStart" @click="confirmStartRules"><template #icon><ShieldCheck :size="16" aria-hidden="true" /></template>确认规则并继续</NButton>
|
||||
<NButton
|
||||
type="primary"
|
||||
:loading="startPolicy.busy.value"
|
||||
:disabled="
|
||||
!rulesAcknowledged || !qualityForm?.canSave || startPolicy.busy.value || !canStart
|
||||
"
|
||||
@click="confirmStartRules"
|
||||
><template #icon><ShieldCheck :size="16" aria-hidden="true" /></template
|
||||
>确认规则并继续</NButton
|
||||
>
|
||||
</template>
|
||||
</WorkspaceTools>
|
||||
<!-- 以下是每次真实模型调用前的费用与任务确认,规则未变时直接进入此步骤 -->
|
||||
<AppDialog
|
||||
:open="startPolicy.startOpen.value"
|
||||
:title="candidateOnly ? '生成拆解候选' : '开始拆解'"
|
||||
:description="candidateOnly ? '将按当前分组调用模型生成主体、形态与分镜候选,可能产生模型费用。现有正式数据会保留,候选需经独立确认后才提交。' : '将按当前预览启动完整拆解并调用模型,可能产生模型费用。抽取结束后仍需完成主体整理、分镜生成与入库。'"
|
||||
:description="
|
||||
candidateOnly
|
||||
? '将按当前分组调用模型生成主体、形态与分镜候选,可能产生模型费用。现有正式数据会保留,候选需经独立确认后才提交。'
|
||||
: '将按当前预览启动完整拆解并调用模型,可能产生模型费用。抽取结束后仍需完成主体整理、分镜生成与入库。'
|
||||
"
|
||||
:busy="operation.pending"
|
||||
@update:open="updateStartOpen"
|
||||
>
|
||||
<NCheckbox v-if="records.length > 0" v-model:checked="startAcknowledged" :disabled="startPolicy.busy.value">我已确认后台任务停止,当前没有同项目的生成或拆解任务在运行。</NCheckbox>
|
||||
<p v-if="startPolicy.error.value" role="alert" class="mt-4 text-sm text-danger">{{ startPolicy.error.value }}</p>
|
||||
<NCheckbox
|
||||
v-if="records.length > 0"
|
||||
v-model:checked="startAcknowledged"
|
||||
:disabled="startPolicy.busy.value"
|
||||
>我已确认后台任务停止,当前没有同项目的生成或拆解任务在运行。</NCheckbox
|
||||
>
|
||||
<p v-if="startPolicy.error.value" role="alert" class="mt-4 text-sm text-danger">
|
||||
{{ startPolicy.error.value }}
|
||||
</p>
|
||||
<template #footer>
|
||||
<NButton :disabled="operation.pending" @click="startPolicy.cancel">取消</NButton>
|
||||
<NButton type="primary" :loading="startPolicy.reading.value" :disabled="!canStart || startPolicy.busy.value || (records.length > 0 && !startAcknowledged)" @click="confirmStart"><template #icon><ShieldCheck :size="16" aria-hidden="true" /></template>确认{{ candidateOnly ? '生成拆解候选' : '开始拆解' }}</NButton>
|
||||
<NButton
|
||||
type="primary"
|
||||
:loading="startPolicy.reading.value"
|
||||
:disabled="
|
||||
!canStart || startPolicy.busy.value || (records.length > 0 && !startAcknowledged)
|
||||
"
|
||||
@click="confirmStart"
|
||||
><template #icon><ShieldCheck :size="16" aria-hidden="true" /></template>确认{{
|
||||
candidateOnly ? '生成拆解候选' : '开始拆解'
|
||||
}}</NButton
|
||||
>
|
||||
</template>
|
||||
</AppDialog>
|
||||
</div>
|
||||
@@ -736,7 +865,9 @@ const rules = {
|
||||
<template v-else>
|
||||
<section class="breakdown-results-section" :data-breakdown-source="quality.source">
|
||||
<!-- 以下是候选与正式数据来源提示,手机也不隐藏,防止把候选镜头当作正式资产 -->
|
||||
<p v-if="sourceLabel" class="text-xs text-muted" role="status">{{ sourceLabel }}<span v-if="quality.loading"> · 正在读取当前质量审核…</span></p>
|
||||
<p v-if="sourceLabel" class="text-xs text-muted" role="status">
|
||||
{{ sourceLabel }}<span v-if="quality.loading"> · 正在读取当前质量审核…</span>
|
||||
</p>
|
||||
<div class="result-toolbar tabs-toolbar">
|
||||
<NTabs v-model:value="tab" class="workspace-tabs" type="line" size="small" aria-label="拆解结果"
|
||||
><!-- 以下是仅显示分类名称的拆解标签模块,主体数量保留在搜索统计中 -->
|
||||
@@ -765,16 +896,16 @@ const rules = {
|
||||
</NButton>
|
||||
<!-- 以下是手机分类导航中的拆解设置入口,共用原有设置弹窗 -->
|
||||
<WorkspaceActionTooltip label="拆解设置">
|
||||
<NButton
|
||||
quaternary
|
||||
class="icon-button breakdown-mobile-tools"
|
||||
aria-label="拆解设置"
|
||||
aria-haspopup="dialog"
|
||||
:aria-expanded="toolsOpen"
|
||||
@click="toolsOpen = true"
|
||||
>
|
||||
<template #icon><Settings2 :size="15" aria-hidden="true" /></template>
|
||||
</NButton>
|
||||
<NButton
|
||||
quaternary
|
||||
class="icon-button breakdown-mobile-tools"
|
||||
aria-label="拆解设置"
|
||||
aria-haspopup="dialog"
|
||||
:aria-expanded="toolsOpen"
|
||||
@click="toolsOpen = true"
|
||||
>
|
||||
<template #icon><Settings2 :size="15" aria-hidden="true" /></template>
|
||||
</NButton>
|
||||
</WorkspaceActionTooltip>
|
||||
<!-- 以下是拆解快照直接导出模块,与剧本创作共用图标和悬浮说明 -->
|
||||
<WorkspaceExportButton
|
||||
@@ -803,13 +934,21 @@ const rules = {
|
||||
v-model:episode-no="selectedEpisodeNo"
|
||||
:plans="plans"
|
||||
:episodes="shots"
|
||||
:diagnosis-disabled="quality.source !== 'formal' || breakdownBusy || backgroundExecution.discovering.value"
|
||||
:diagnosis-disabled="
|
||||
quality.source !== 'formal' ||
|
||||
breakdownBusy ||
|
||||
backgroundExecution.discovering.value
|
||||
"
|
||||
@diagnose="openShotDiagnosis"
|
||||
>
|
||||
<!-- 以下是跟随当前剧集的一行诊断摘要,诊断弹窗独立于列表滚动 -->
|
||||
<template #diagnosis>
|
||||
<StoryboardDiagnosis
|
||||
v-if="quality.source === 'formal' && !breakdownBusy && !backgroundExecution.discovering.value"
|
||||
v-if="
|
||||
quality.source === 'formal' &&
|
||||
!breakdownBusy &&
|
||||
!backgroundExecution.discovering.value
|
||||
"
|
||||
ref="diagnosisPanel"
|
||||
:project-id="projectId"
|
||||
:episode-no="currentEpisodeNo"
|
||||
@@ -902,7 +1041,14 @@ const rules = {
|
||||
</p>
|
||||
<!-- 以下是从当前动作冲突带入角色和动作的例外入口,独立保存规则且保留旧例外 -->
|
||||
<ActionExceptionRepair
|
||||
v-if="issuesOpen && qualityObservation.source.value.state && quality.source !== 'history' && quality.actionBlocks.some(block => [...block.blockingCodes, ...block.warningCodes].includes('action_resource_conflict'))"
|
||||
v-if="
|
||||
issuesOpen &&
|
||||
qualityObservation.source.value.state &&
|
||||
quality.source !== 'history' &&
|
||||
quality.actionBlocks.some(block =>
|
||||
[...block.blockingCodes, ...block.warningCodes].includes('action_resource_conflict')
|
||||
)
|
||||
"
|
||||
:project-id="projectId"
|
||||
:checkpoint-id="latestCheckpoint?.checkpointId || ''"
|
||||
:state="qualityObservation.source.value.state"
|
||||
@@ -962,7 +1108,10 @@ const rules = {
|
||||
|
||||
<style>
|
||||
/* 历史折叠只保留一层内容留白,避免 Naive 内容间距叠加任务卡片的 mt-4。 */
|
||||
.breakdown-execution-history.n-collapse .n-collapse-item .n-collapse-item__content-wrapper .n-collapse-item__content-inner {
|
||||
.breakdown-execution-history.n-collapse
|
||||
.n-collapse-item
|
||||
.n-collapse-item__content-wrapper
|
||||
.n-collapse-item__content-inner {
|
||||
padding-top: 8px;
|
||||
}
|
||||
.breakdown-execution-history .breakdown-execution-panel {
|
||||
|
||||
@@ -29,7 +29,12 @@ import WorkspacePage from '../../components/ui/WorkspacePage.vue'
|
||||
<!-- 以下是分类标签与操作入口占位模块 -->
|
||||
<div class="breakdown-skeleton-tabs">
|
||||
<div class="breakdown-skeleton-tab-labels">
|
||||
<span v-for="tab in 5" :key="tab" class="breakdown-skeleton-tab"><NSkeleton :class="{ 'breakdown-skeleton-task-label': tab === 5 }" :width="tab === 5 ? 56 : 28" :height="14" /></span>
|
||||
<span v-for="tab in 5" :key="tab" class="breakdown-skeleton-tab"
|
||||
><NSkeleton
|
||||
:class="{ 'breakdown-skeleton-task-label': tab === 5 }"
|
||||
:width="tab === 5 ? 56 : 28"
|
||||
:height="14"
|
||||
/></span>
|
||||
</div>
|
||||
<div class="breakdown-skeleton-tab-actions">
|
||||
<NSkeleton class="breakdown-skeleton-icon breakdown-skeleton-mobile-settings" />
|
||||
|
||||
@@ -29,28 +29,53 @@ export interface ActionExceptionTarget extends CandidateShotLocation {
|
||||
* @returns 可添加精确例外的真实目标;历史、缺失或无效证据不产生目标
|
||||
*/
|
||||
export function actionExceptionTargets(state: BreakdownState, quality: BreakdownQuality): ActionExceptionTarget[] {
|
||||
if (!['candidate', 'formal'].includes(quality.source) || quality.loading || quality.needsRefresh || quality.error) return []
|
||||
if (!['candidate', 'formal'].includes(quality.source) || quality.loading || quality.needsRefresh || quality.error)
|
||||
return []
|
||||
const targets = new Map<string, ActionExceptionTarget>()
|
||||
for (const block of quality.actionBlocks) {
|
||||
if (![...block.blockingCodes, ...block.warningCodes].includes('action_resource_conflict')) continue
|
||||
const shot = state.storyboardEpisodeShots?.find(episode => episode.episodeNo === block.episodeNo)
|
||||
?.beatShots.find(beat => beat.beatNo === block.beatNo)?.shots.find(item => item.shotNo === block.shotNo)
|
||||
const shot = state.storyboardEpisodeShots
|
||||
?.find(episode => episode.episodeNo === block.episodeNo)
|
||||
?.beatShots.find(beat => beat.beatNo === block.beatNo)
|
||||
?.shots.find(item => item.shotNo === block.shotNo)
|
||||
if (!shot?.requiredActions?.length || !shot.durationPlanning) continue
|
||||
for (const [index, phase] of shot.durationPlanning.phases.entries()) {
|
||||
// 与后端审计一致:只接受本阶段、已存在动作及镜头主体的明确占用证据。
|
||||
const resources = (phase.resourceOccupancy ?? []).filter(item =>
|
||||
shot.subjectRefs.includes(item.ownerRef) && phase.actionIds?.includes(item.actionId) &&
|
||||
shot.requiredActions!.some(action => action.id === item.actionId) &&
|
||||
actionResourceOptions.some(option => option.value === item.resource))
|
||||
const resources = (phase.resourceOccupancy ?? []).filter(
|
||||
item =>
|
||||
shot.subjectRefs.includes(item.ownerRef) &&
|
||||
phase.actionIds?.includes(item.actionId) &&
|
||||
shot.requiredActions!.some(action => action.id === item.actionId) &&
|
||||
actionResourceOptions.some(option => option.value === item.resource)
|
||||
)
|
||||
for (const [leftIndex, left] of resources.entries()) {
|
||||
for (const right of resources.slice(leftIndex + 1)) {
|
||||
if (left.ownerRef !== right.ownerRef || left.resource !== right.resource || left.actionId === right.actionId) continue
|
||||
if (left.shareable && right.shareable && !['support', 'move'].includes(left.usage) && !['support', 'move'].includes(right.usage)) continue
|
||||
if (
|
||||
left.ownerRef !== right.ownerRef ||
|
||||
left.resource !== right.resource ||
|
||||
left.actionId === right.actionId
|
||||
)
|
||||
continue
|
||||
if (
|
||||
left.shareable &&
|
||||
right.shareable &&
|
||||
!['support', 'move'].includes(left.usage) &&
|
||||
!['support', 'move'].includes(right.usage)
|
||||
)
|
||||
continue
|
||||
const key = `${block.episodeNo}/${block.beatNo}/${block.shotNo}/${index + 1}/${left.ownerRef}/${left.resource}`
|
||||
const target = targets.get(key) ?? {
|
||||
key, episodeNo: block.episodeNo, beatNo: block.beatNo, shotNo: block.shotNo,
|
||||
phaseNo: index + 1, shotTitle: shot.title, ownerRef: left.ownerRef, resource: left.resource,
|
||||
ownerName: state.subjectCandidates?.find(subject => subject.ref === left.ownerRef)?.name || left.ownerRef,
|
||||
key,
|
||||
episodeNo: block.episodeNo,
|
||||
beatNo: block.beatNo,
|
||||
shotNo: block.shotNo,
|
||||
phaseNo: index + 1,
|
||||
shotTitle: shot.title,
|
||||
ownerRef: left.ownerRef,
|
||||
resource: left.resource,
|
||||
ownerName:
|
||||
state.subjectCandidates?.find(subject => subject.ref === left.ownerRef)?.name ||
|
||||
left.ownerRef,
|
||||
actions: []
|
||||
}
|
||||
for (const actionId of [left.actionId, right.actionId]) {
|
||||
|
||||
@@ -14,7 +14,14 @@ import type {
|
||||
LegacyActionDiagnosisResults
|
||||
} from './types'
|
||||
import type { WorkflowExecutionStart } from '../workflows/execution.types'
|
||||
import type { CandidateRevalidation, CandidateCommitPreview, CandidateSubjectRepairInput, CandidateSubjectRepairResult, CandidateActionRepairInput, CandidateActionRepairResult } from './candidate.types'
|
||||
import type {
|
||||
CandidateRevalidation,
|
||||
CandidateCommitPreview,
|
||||
CandidateSubjectRepairInput,
|
||||
CandidateSubjectRepairResult,
|
||||
CandidateActionRepairInput,
|
||||
CandidateActionRepairResult
|
||||
} from './candidate.types'
|
||||
import type {
|
||||
QualityRepairPlan,
|
||||
QualityRepairCandidates,
|
||||
@@ -32,7 +39,10 @@ export const breakdownApi = {
|
||||
* @returns 不调用模型的检查结果
|
||||
*/
|
||||
diagnosisPreflight: (id: string, shotId: string, signal?: AbortSignal) =>
|
||||
request<DiagnosisPreflight>(`/projects/${encodeURIComponent(id)}/breakdown/storyboard-legacy-action-diagnosis-preflight/${encodeURIComponent(shotId)}`, { signal }),
|
||||
request<DiagnosisPreflight>(
|
||||
`/projects/${encodeURIComponent(id)}/breakdown/storyboard-legacy-action-diagnosis-preflight/${encodeURIComponent(shotId)}`,
|
||||
{ signal }
|
||||
),
|
||||
/**
|
||||
* 查看指定镜头的诊断历史及版本失效情况。
|
||||
* @param id 项目编号
|
||||
@@ -41,7 +51,10 @@ export const breakdownApi = {
|
||||
* @returns 最近诊断历史
|
||||
*/
|
||||
diagnosisHistory: (id: string, shotId: string, signal?: AbortSignal) =>
|
||||
request<DiagnosisHistory>(`/projects/${encodeURIComponent(id)}/breakdown/storyboard-legacy-action-diagnoses/${encodeURIComponent(shotId)}`, { signal }),
|
||||
request<DiagnosisHistory>(
|
||||
`/projects/${encodeURIComponent(id)}/breakdown/storyboard-legacy-action-diagnoses/${encodeURIComponent(shotId)}`,
|
||||
{ signal }
|
||||
),
|
||||
/**
|
||||
* 核对指定诊断能否进入人工修订,不自动应用建议。
|
||||
* @param id 项目编号
|
||||
@@ -51,7 +64,10 @@ export const breakdownApi = {
|
||||
* @returns 候选及资产、来源和版本限制
|
||||
*/
|
||||
diagnosisRepairReadiness: (id: string, shotId: string, diagnosisId: string, signal?: AbortSignal) =>
|
||||
request<DiagnosisRepairReadiness>(`/projects/${encodeURIComponent(id)}/breakdown/storyboard-legacy-action-repair-readiness/${encodeURIComponent(shotId)}/${encodeURIComponent(diagnosisId)}`, { signal }),
|
||||
request<DiagnosisRepairReadiness>(
|
||||
`/projects/${encodeURIComponent(id)}/breakdown/storyboard-legacy-action-repair-readiness/${encodeURIComponent(shotId)}/${encodeURIComponent(diagnosisId)}`,
|
||||
{ signal }
|
||||
),
|
||||
|
||||
/**
|
||||
* 只读重新审核当前候选,不提供正式提交许可。
|
||||
@@ -60,7 +76,9 @@ export const breakdownApi = {
|
||||
* @returns 版本化质量审核
|
||||
*/
|
||||
revalidateCandidate: (id: string, signal?: AbortSignal) =>
|
||||
request<CandidateRevalidation>(`/projects/${encodeURIComponent(id)}/breakdown/candidate-revalidation`, { signal }),
|
||||
request<CandidateRevalidation>(`/projects/${encodeURIComponent(id)}/breakdown/candidate-revalidation`, {
|
||||
signal
|
||||
}),
|
||||
/**
|
||||
* 只读检查剧本与下游资产的正式提交安全条件。
|
||||
* @param id 当前项目
|
||||
@@ -68,7 +86,9 @@ export const breakdownApi = {
|
||||
* @returns 版本化安全检查
|
||||
*/
|
||||
candidateCommitPreview: (id: string, signal?: AbortSignal) =>
|
||||
request<CandidateCommitPreview>(`/projects/${encodeURIComponent(id)}/breakdown/candidate-commit-preview`, { signal }),
|
||||
request<CandidateCommitPreview>(`/projects/${encodeURIComponent(id)}/breakdown/candidate-commit-preview`, {
|
||||
signal
|
||||
}),
|
||||
/**
|
||||
* 用户确认后补齐候选主体引用与真实形态。
|
||||
* @param id 当前项目
|
||||
@@ -76,7 +96,10 @@ export const breakdownApi = {
|
||||
* @returns 新候选检查点
|
||||
*/
|
||||
repairCandidateSubject: (id: string, input: CandidateSubjectRepairInput) =>
|
||||
request<CandidateSubjectRepairResult>(`/projects/${encodeURIComponent(id)}/breakdown/candidate-subject-repair`, { method: 'POST', body: input }),
|
||||
request<CandidateSubjectRepairResult>(
|
||||
`/projects/${encodeURIComponent(id)}/breakdown/candidate-subject-repair`,
|
||||
{ method: 'POST', body: input }
|
||||
),
|
||||
/**
|
||||
* 用户确认后批量修订候选动作描述,不触发模型。
|
||||
* @param id 当前项目
|
||||
@@ -84,7 +107,10 @@ export const breakdownApi = {
|
||||
* @returns 新候选检查点及剩余待审剧集
|
||||
*/
|
||||
repairCandidateActions: (id: string, input: CandidateActionRepairInput) =>
|
||||
request<CandidateActionRepairResult>(`/projects/${encodeURIComponent(id)}/breakdown/candidate-action-batch-repair`, { method: 'POST', body: input }),
|
||||
request<CandidateActionRepairResult>(
|
||||
`/projects/${encodeURIComponent(id)}/breakdown/candidate-action-batch-repair`,
|
||||
{ method: 'POST', body: input }
|
||||
),
|
||||
/**
|
||||
* 读取当前仍被质量审核阻断的镜头。
|
||||
* @param id 当前项目编号
|
||||
|
||||
@@ -13,7 +13,16 @@ export const candidateCheckLabels: Record<keyof CandidateCommitPreview['checks']
|
||||
noProtectedShots: '没有需要保护的镜头资产'
|
||||
}
|
||||
/** 必须逐项校验的固定安全门禁,不根据响应动态减少检查项。 */
|
||||
export const candidateCheckKeys = ['qualityPolicyMatches', 'episodeNumbersMatch', 'episodeFingerprintsMatch', 'noActiveExecutions', 'noActiveVideos', 'noSubjectIdentities', 'noSubjectImages', 'noProtectedShots'] as const
|
||||
export const candidateCheckKeys = [
|
||||
'qualityPolicyMatches',
|
||||
'episodeNumbersMatch',
|
||||
'episodeFingerprintsMatch',
|
||||
'noActiveExecutions',
|
||||
'noActiveVideos',
|
||||
'noSubjectIdentities',
|
||||
'noSubjectImages',
|
||||
'noProtectedShots'
|
||||
] as const
|
||||
|
||||
/**
|
||||
* 安全预检查必须逐项通过且属于当前项目和候选,不能只相信 ready。
|
||||
@@ -22,7 +31,11 @@ export const candidateCheckKeys = ['qualityPolicyMatches', 'episodeNumbersMatch'
|
||||
* @param checkpointId 当前候选版本
|
||||
* @returns 是否可进入最终确认
|
||||
*/
|
||||
export function candidatePreviewReady(preview: CandidateCommitPreview | null, projectId: string, checkpointId?: string): boolean {
|
||||
export function candidatePreviewReady(
|
||||
preview: CandidateCommitPreview | null,
|
||||
projectId: string,
|
||||
checkpointId?: string
|
||||
): boolean {
|
||||
if (!preview || preview.projectId !== projectId || preview.checkpointId !== checkpointId) return false
|
||||
// 外部 JSON 的布尔值必须严格为 true,不接受缺失值或字符串等真值。
|
||||
const flags: unknown[] = [preview.readOnly, preview.ready, ...candidateCheckKeys.map(key => preview.checks?.[key])]
|
||||
|
||||
@@ -91,15 +91,19 @@ export interface CandidateRevalidation {
|
||||
/** 当前动作阻断或资源冲突。 */
|
||||
actionQualityBlocks: CandidateActionBlock[]
|
||||
/** 阻断镜头的原始动作规划。 */
|
||||
actionRepairTargets: Array<CandidateActionBlock & {
|
||||
/** 缺少原始镜头时禁止修复。 */
|
||||
shot: Pick<StoryboardShot, 'title' | 'description' | 'visualFocus' | 'durationSeconds' | 'subjectRefs'> & {
|
||||
/** 原始动作,不提供 kind 编辑入口。 */
|
||||
requiredActions: NonNullable<StoryboardShot['requiredActions']>
|
||||
/** 原始阶段规划。 */
|
||||
durationPlanning: StoryboardShot['durationPlanning'] | null
|
||||
} | null
|
||||
}>
|
||||
actionRepairTargets: Array<
|
||||
CandidateActionBlock & {
|
||||
/** 缺少原始镜头时禁止修复。 */
|
||||
shot:
|
||||
| (Pick<StoryboardShot, 'title' | 'description' | 'visualFocus' | 'durationSeconds' | 'subjectRefs'> & {
|
||||
/** 原始动作,不提供 kind 编辑入口。 */
|
||||
requiredActions: NonNullable<StoryboardShot['requiredActions']>
|
||||
/** 原始阶段规划。 */
|
||||
durationPlanning: StoryboardShot['durationPlanning'] | null
|
||||
})
|
||||
| null
|
||||
}
|
||||
>
|
||||
/** 道具引用检查。 */
|
||||
propReferenceDiagnostics: CandidatePropDiagnostic[]
|
||||
/** 没有对应动作阻断的残留待审剧集,仍需明确处理。 */
|
||||
|
||||
@@ -50,14 +50,28 @@ const notice = ref('')
|
||||
/** 项目级写操作锁。 */
|
||||
const operation = computed(() => getOperation(props.projectId))
|
||||
/** 当前审核与原始数据必须属于同一项目和最新检查点。 */
|
||||
const current = computed(() => !!props.checkpointId && props.quality.checkpointId === props.checkpointId &&
|
||||
(!props.state.projectId || props.state.projectId === props.projectId) && ['candidate', 'formal'].includes(props.quality.source))
|
||||
const current = computed(
|
||||
() =>
|
||||
!!props.checkpointId &&
|
||||
props.quality.checkpointId === props.checkpointId &&
|
||||
(!props.state.projectId || props.state.projectId === props.projectId) &&
|
||||
['candidate', 'formal'].includes(props.quality.source)
|
||||
)
|
||||
/** 只从真实审核和阶段证据生成目标。 */
|
||||
const targets = computed(() => current.value ? actionExceptionTargets(props.state, props.quality) : [])
|
||||
const targets = computed(() => (current.value ? actionExceptionTargets(props.state, props.quality) : []))
|
||||
/** 已有例外原样展示,保存新项不会删除或替换它们。 */
|
||||
const exceptions = computed(() => receipt.value?.policy.actionExceptions ?? [])
|
||||
/** 用户可以提交的时机,所有外部活动锁都需要满足。 */
|
||||
const writable = computed(() => current.value && !!receipt.value && !props.disabled && !operation.value.pending && !loading.value && !checking.value && !writing.value)
|
||||
const writable = computed(
|
||||
() =>
|
||||
current.value &&
|
||||
!!receipt.value &&
|
||||
!props.disabled &&
|
||||
!operation.value.pending &&
|
||||
!loading.value &&
|
||||
!checking.value &&
|
||||
!writing.value
|
||||
)
|
||||
/** 失效代次与可取消的只读请求。 */
|
||||
let generation = 0
|
||||
/** 当前规则查询的取消控制器。 */
|
||||
@@ -87,8 +101,11 @@ async function load() {
|
||||
try {
|
||||
const result = await read(id, controller.signal)
|
||||
if (version === generation) receipt.value = result
|
||||
} catch (cause) { if (version === generation) error.value = errorMessage(cause) }
|
||||
finally { if (version === generation) loading.value = false }
|
||||
} catch (cause) {
|
||||
if (version === generation) error.value = errorMessage(cause)
|
||||
} finally {
|
||||
if (version === generation) loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +114,12 @@ async function load() {
|
||||
* @returns 是否已经保存对应例外
|
||||
*/
|
||||
function exists(target: ActionExceptionTarget): boolean {
|
||||
return exceptions.value.some(item => item.code === 'action_resource_conflict' && item.ownerRef === target.ownerRef && item.resource === target.resource)
|
||||
return exceptions.value.some(
|
||||
item =>
|
||||
item.code === 'action_resource_conflict' &&
|
||||
item.ownerRef === target.ownerRef &&
|
||||
item.resource === target.resource
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,24 +161,45 @@ async function save() {
|
||||
error.value = ''
|
||||
try {
|
||||
const latest = await read(id, controller.signal)
|
||||
if (version !== generation || props.disabled || operation.value.pending || !current.value ||
|
||||
!targets.value.some(item => JSON.stringify(item) === targetSignature)) return
|
||||
if (
|
||||
version !== generation ||
|
||||
props.disabled ||
|
||||
operation.value.pending ||
|
||||
!current.value ||
|
||||
!targets.value.some(item => JSON.stringify(item) === targetSignature)
|
||||
)
|
||||
return
|
||||
receipt.value = latest
|
||||
if (exists(target)) { notice.value = '这个角色的对应部位已有例外,已保留现有设置。'; selected.value = null; return }
|
||||
if (exists(target)) {
|
||||
notice.value = '这个角色的对应部位已有例外,已保留现有设置。'
|
||||
selected.value = null
|
||||
return
|
||||
}
|
||||
if (exceptions.value.length >= 30) throw new Error('动作例外最多 30 项,当前不能继续添加。')
|
||||
const input = policyDraft(latest.policy)
|
||||
input.actionExceptions = [...(input.actionExceptions ?? []), {
|
||||
code: 'action_resource_conflict', ownerRef: target.ownerRef, resource: target.resource, reason: reason.value.trim()
|
||||
}]
|
||||
input.actionExceptions = [
|
||||
...(input.actionExceptions ?? []),
|
||||
{
|
||||
code: 'action_resource_conflict',
|
||||
ownerRef: target.ownerRef,
|
||||
resource: target.resource,
|
||||
reason: reason.value.trim()
|
||||
}
|
||||
]
|
||||
const signature = qualityPolicySignature(input)
|
||||
writing.value = true
|
||||
const success = await runOperation(id, '正在保存动作例外', async () => {
|
||||
const result = await projectsApi.saveQualityPolicy(id, input, latest.revision)
|
||||
validateQualityPolicyReceipt(result, id)
|
||||
if (result.projectId !== id || qualityPolicySignature(result.policy) !== signature)
|
||||
throw new Error('规则保存回执与提交内容不一致,请重新读取确认。')
|
||||
if (version === generation) receipt.value = { ...result, policy: policyDraft(result.policy) }
|
||||
}, { type: 'info', content: '动作例外已保存,当前分镜仍需审核,不会自动放行提交。' })
|
||||
const success = await runOperation(
|
||||
id,
|
||||
'正在保存动作例外',
|
||||
async () => {
|
||||
const result = await projectsApi.saveQualityPolicy(id, input, latest.revision)
|
||||
validateQualityPolicyReceipt(result, id)
|
||||
if (result.projectId !== id || qualityPolicySignature(result.policy) !== signature)
|
||||
throw new Error('规则保存回执与提交内容不一致,请重新读取确认。')
|
||||
if (version === generation) receipt.value = { ...result, policy: policyDraft(result.policy) }
|
||||
},
|
||||
{ type: 'info', content: '动作例外已保存,当前分镜仍需审核,不会自动放行提交。' }
|
||||
)
|
||||
if (version !== generation) return
|
||||
if (success) {
|
||||
selected.value = null
|
||||
@@ -164,57 +207,114 @@ async function save() {
|
||||
notice.value = '动作例外已保存。当前分镜仍需审核,不会自动标记通过或修改正式结果。'
|
||||
emit('refresh')
|
||||
} else error.value = operation.value.error
|
||||
} catch (cause) { if (version === generation) error.value = errorMessage(cause) }
|
||||
finally { if (version === generation) { checking.value = false; writing.value = false } }
|
||||
} catch (cause) {
|
||||
if (version === generation) error.value = errorMessage(cause)
|
||||
} finally {
|
||||
if (version === generation) {
|
||||
checking.value = false
|
||||
writing.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 修改原因时清除旧校验,打开空白草稿不提前报错。 */
|
||||
watch(reason, () => { issue.value = '' })
|
||||
/** 当前问题的动作证据变化后撤销旧草稿,不能把旧动作的确认套到新动作。 */
|
||||
watch(targets, items => {
|
||||
if (selected.value && !items.some(item => JSON.stringify(item) === JSON.stringify(selected.value))) cancel()
|
||||
}, { flush: 'sync' })
|
||||
/** 切换版本后清空旧草稿和读取,迟到响应不得回填或提交。 */
|
||||
watch(() => [props.projectId, props.checkpointId], () => {
|
||||
generation++
|
||||
controller?.abort()
|
||||
receipt.value = null
|
||||
selected.value = null
|
||||
reason.value = ''
|
||||
watch(reason, () => {
|
||||
issue.value = ''
|
||||
notice.value = ''
|
||||
error.value = ''
|
||||
loading.value = false
|
||||
checking.value = false
|
||||
writing.value = false
|
||||
void load()
|
||||
}, { immediate: true, flush: 'sync' })
|
||||
})
|
||||
/** 当前问题的动作证据变化后撤销旧草稿,不能把旧动作的确认套到新动作。 */
|
||||
watch(
|
||||
targets,
|
||||
items => {
|
||||
if (selected.value && !items.some(item => JSON.stringify(item) === JSON.stringify(selected.value))) cancel()
|
||||
},
|
||||
{ flush: 'sync' }
|
||||
)
|
||||
/** 切换版本后清空旧草稿和读取,迟到响应不得回填或提交。 */
|
||||
watch(
|
||||
() => [props.projectId, props.checkpointId],
|
||||
() => {
|
||||
generation++
|
||||
controller?.abort()
|
||||
receipt.value = null
|
||||
selected.value = null
|
||||
reason.value = ''
|
||||
issue.value = ''
|
||||
notice.value = ''
|
||||
error.value = ''
|
||||
loading.value = false
|
||||
checking.value = false
|
||||
writing.value = false
|
||||
void load()
|
||||
},
|
||||
{ immediate: true, flush: 'sync' }
|
||||
)
|
||||
/** 父抽屉只在真实写入期间锁定,普通读取仍可关闭。 */
|
||||
watch(writing, value => emit('busy', value), { flush: 'sync' })
|
||||
onScopeDispose(() => { generation++; controller?.abort(); emit('busy', false) })
|
||||
onScopeDispose(() => {
|
||||
generation++
|
||||
controller?.abort()
|
||||
emit('busy', false)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是拆解后从具体冲突添加动作例外的模块,角色和动作均不可自由输入 -->
|
||||
<section class="workspace-panel space-y-4" aria-label="动作例外修订">
|
||||
<WorkspaceSectionHeading title="动作例外" description="只为剧本明确允许的特殊动作添加例外。角色、部位和动作从当前问题自动带入,你只需填写允许原因。" />
|
||||
<WorkspaceSectionHeading
|
||||
title="动作例外"
|
||||
description="只为剧本明确允许的特殊动作添加例外。角色、部位和动作从当前问题自动带入,你只需填写允许原因。"
|
||||
/>
|
||||
<p v-if="loading" role="status" class="text-xs text-muted">正在读取已有动作例外…</p>
|
||||
<div v-if="error" role="alert" class="space-y-2 text-sm text-danger"><p>{{ error }}</p><NButton v-if="!receipt" :disabled="loading" @click="load">重新读取规则</NButton></div>
|
||||
<div v-if="error" role="alert" class="space-y-2 text-sm text-danger">
|
||||
<p>{{ error }}</p>
|
||||
<NButton v-if="!receipt" :disabled="loading" @click="load">重新读取规则</NButton>
|
||||
</div>
|
||||
<QualityPolicyExceptions :exceptions="exceptions" />
|
||||
<p v-if="!targets.length && !loading" class="text-xs leading-6 text-muted">当前没有能准确带入角色与动作的冲突。缺少动作证据或其他结构错误时,请先使用人工修订。</p>
|
||||
<p v-if="!targets.length && !loading" class="text-xs leading-6 text-muted">
|
||||
当前没有能准确带入角色与动作的冲突。缺少动作证据或其他结构错误时,请先使用人工修订。
|
||||
</p>
|
||||
<article v-for="target in targets" :key="target.key" class="space-y-3" :data-exception-target="target.key">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<p class="text-sm">第 {{ target.episodeNo }} 集 · 节拍 {{ target.beatNo }} · 镜头 {{ target.shotNo }} · 阶段 {{ target.phaseNo }}</p>
|
||||
<NButton v-if="selected?.key !== target.key" :disabled="!writable || exists(target)" @click="select(target)"><template #icon><Plus :size="15" aria-hidden="true" /></template>{{ exists(target) ? '已有例外' : '添加例外' }}</NButton>
|
||||
<p class="text-sm">
|
||||
第 {{ target.episodeNo }} 集 · 节拍 {{ target.beatNo }} · 镜头 {{ target.shotNo }} · 阶段
|
||||
{{ target.phaseNo }}
|
||||
</p>
|
||||
<NButton
|
||||
v-if="selected?.key !== target.key"
|
||||
:disabled="!writable || exists(target)"
|
||||
@click="select(target)"
|
||||
><template #icon><Plus :size="15" aria-hidden="true" /></template
|
||||
>{{ exists(target) ? '已有例外' : '添加例外' }}</NButton
|
||||
>
|
||||
</div>
|
||||
<p class="text-sm">{{ target.ownerName }}({{ target.ownerRef }}) · {{ actionResourceOptions.find(option => option.value === target.resource)?.label }}</p>
|
||||
<ul class="space-y-1 pl-5 text-xs leading-6 text-muted list-disc"><li v-for="action in target.actions" :key="action">{{ action }}</li></ul>
|
||||
<p class="text-sm">
|
||||
{{ target.ownerName }}({{ target.ownerRef }}) ·
|
||||
{{ actionResourceOptions.find(option => option.value === target.resource)?.label }}
|
||||
</p>
|
||||
<ul class="space-y-1 pl-5 text-xs leading-6 text-muted list-disc">
|
||||
<li v-for="action in target.actions" :key="action">{{ action }}</li>
|
||||
</ul>
|
||||
<!-- 以下是只填写原因的例外草稿,后端实际范围是同一角色的对应部位 -->
|
||||
<div v-if="selected?.key === target.key" class="space-y-3">
|
||||
<p class="text-xs leading-6 text-muted">此例外按项目保存,同一角色或物品在其他镜头中的同类占用冲突也会受影响;其他错误仍会检查。</p>
|
||||
<NFormItem label="允许原因"><NInput v-model:value="reason" type="textarea" aria-label="动作例外允许原因" placeholder="填写剧本中明确允许这样做的设定" :autosize="{ minRows: 2, maxRows: 6 }" :disabled="disabled || checking || writing" /></NFormItem>
|
||||
<p class="text-xs leading-6 text-muted">
|
||||
此例外按项目保存,同一角色或物品在其他镜头中的同类占用冲突也会受影响;其他错误仍会检查。
|
||||
</p>
|
||||
<NFormItem label="允许原因"
|
||||
><NInput
|
||||
v-model:value="reason"
|
||||
type="textarea"
|
||||
aria-label="动作例外允许原因"
|
||||
placeholder="填写剧本中明确允许这样做的设定"
|
||||
:autosize="{ minRows: 2, maxRows: 6 }"
|
||||
:disabled="disabled || checking || writing"
|
||||
/></NFormItem>
|
||||
<p v-if="issue" role="alert" class="text-xs text-danger">{{ issue }}</p>
|
||||
<div class="flex flex-wrap justify-end gap-2"><NButton :disabled="writing" @click="cancel">取消</NButton><NButton type="primary" :disabled="!writable" :loading="checking || writing" @click="save"><template #icon><Plus :size="15" aria-hidden="true" /></template>保存动作例外</NButton></div>
|
||||
<div class="flex flex-wrap justify-end gap-2">
|
||||
<NButton :disabled="writing" @click="cancel">取消</NButton
|
||||
><NButton type="primary" :disabled="!writable" :loading="checking || writing" @click="save"
|
||||
><template #icon><Plus :size="15" aria-hidden="true" /></template>保存动作例外</NButton
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<p v-if="notice" role="status" class="text-xs leading-6 text-muted">{{ notice }}</p>
|
||||
|
||||
@@ -51,17 +51,40 @@ let controller: AbortController | undefined
|
||||
/** 拒绝忽略取消信号后返回的旧响应。 */
|
||||
let version = 0
|
||||
/** 当前候选生成或提交后的面板。 */
|
||||
const isCandidate = computed(() => props.state?.candidateOnly === true && (props.quality.isCandidate || props.quality.committed))
|
||||
const isCandidate = computed(
|
||||
() => props.state?.candidateOnly === true && (props.quality.isCandidate || props.quality.committed)
|
||||
)
|
||||
/** 后端持久化标记优先,成功回执只在当前会话补充防重复锁。 */
|
||||
const committed = computed(() => props.quality.committed || submittedId.value === `${props.projectId}:${props.checkpointId}`)
|
||||
const committed = computed(
|
||||
() => props.quality.committed || submittedId.value === `${props.projectId}:${props.checkpointId}`
|
||||
)
|
||||
/** 审核通过后只允许请求预检查,绝不直接允许写入。 */
|
||||
const canCheck = computed(() => !props.disabled && !operation.value.pending && !committed.value && props.quality.canRequestCommitPreview && props.quality.checkpointId === props.checkpointId)
|
||||
const canCheck = computed(
|
||||
() =>
|
||||
!props.disabled &&
|
||||
!operation.value.pending &&
|
||||
!committed.value &&
|
||||
props.quality.canRequestCommitPreview &&
|
||||
props.quality.checkpointId === props.checkpointId
|
||||
)
|
||||
/** 逐项与版本确认后的预检查结果。 */
|
||||
const ready = computed(() => candidatePreviewReady(preview.value, props.projectId, props.checkpointId))
|
||||
/** 仅展示具体未通过的安全检查。 */
|
||||
const failedChecks = computed(() => preview.value ? candidateCheckKeys.filter(key => preview.value!.checks?.[key] !== true).map(key => candidateCheckLabels[key]) : [])
|
||||
const failedChecks = computed(() =>
|
||||
preview.value
|
||||
? candidateCheckKeys.filter(key => preview.value!.checks?.[key] !== true).map(key => candidateCheckLabels[key])
|
||||
: []
|
||||
)
|
||||
/** 当前候选规模与正式资产区别标注。 */
|
||||
const counts = computed(() => ({ subjects: props.state?.subjectCandidates?.length ?? 0, episodes: props.state?.storyboardEpisodeShots?.length ?? 0, shots: props.state?.storyboardEpisodeShots?.reduce((sum, episode) => sum + episode.beatShots.reduce((total, beat) => total + beat.shots.length, 0), 0) ?? 0 }))
|
||||
const counts = computed(() => ({
|
||||
subjects: props.state?.subjectCandidates?.length ?? 0,
|
||||
episodes: props.state?.storyboardEpisodeShots?.length ?? 0,
|
||||
shots:
|
||||
props.state?.storyboardEpisodeShots?.reduce(
|
||||
(sum, episode) => sum + episode.beatShots.reduce((total, beat) => total + beat.shots.length, 0),
|
||||
0
|
||||
) ?? 0
|
||||
}))
|
||||
|
||||
/** 撤销旧检查与确认,版本变化后不能复用提交许可。 */
|
||||
function invalidate() {
|
||||
@@ -73,8 +96,22 @@ function invalidate() {
|
||||
acknowledged.value = false
|
||||
checkError.value = ''
|
||||
}
|
||||
watch([() => props.projectId, () => props.checkpointId, () => props.quality.canRequestCommitPreview, () => props.quality.committed], invalidate, { flush: 'sync' })
|
||||
watch(() => props.disabled, disabled => { if (disabled && !committing.value) invalidate() })
|
||||
watch(
|
||||
[
|
||||
() => props.projectId,
|
||||
() => props.checkpointId,
|
||||
() => props.quality.canRequestCommitPreview,
|
||||
() => props.quality.committed
|
||||
],
|
||||
invalidate,
|
||||
{ flush: 'sync' }
|
||||
)
|
||||
watch(
|
||||
() => props.disabled,
|
||||
disabled => {
|
||||
if (disabled && !committing.value) invalidate()
|
||||
}
|
||||
)
|
||||
onScopeDispose(invalidate)
|
||||
|
||||
/** 安全检查通过后才展示最终确认;不调用任何写接口。 */
|
||||
@@ -89,7 +126,8 @@ async function check() {
|
||||
try {
|
||||
const result = await breakdownApi.candidateCommitPreview(id, controller.signal)
|
||||
if (current !== version) return
|
||||
if (result.projectId !== id || result.checkpointId !== checkpointId || result.readOnly !== true) throw new Error('候选安全预检查已过期,请刷新后重新检查。')
|
||||
if (result.projectId !== id || result.checkpointId !== checkpointId || result.readOnly !== true)
|
||||
throw new Error('候选安全预检查已过期,请刷新后重新检查。')
|
||||
preview.value = result
|
||||
if (candidatePreviewReady(result, id, checkpointId)) confirmOpen.value = true
|
||||
else showActionFeedback(message, '候选暂不能提交,请处理未通过的安全检查。', 'warning')
|
||||
@@ -98,7 +136,15 @@ async function check() {
|
||||
checkError.value = errorMessage(cause)
|
||||
showActionFeedback(message, checkError.value, 'error')
|
||||
}
|
||||
} finally { if (current === version) checking.value = false }
|
||||
} finally {
|
||||
if (current === version) checking.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 取消最终确认时关闭弹窗并清除勾选,保留本次安全预检查结果。 */
|
||||
function cancelConfirmation() {
|
||||
confirmOpen.value = false
|
||||
acknowledged.value = false
|
||||
}
|
||||
|
||||
/** 最终确认时重新核对版本和全部安全门禁,随后交由后端事务提交。 */
|
||||
@@ -108,16 +154,39 @@ async function commit() {
|
||||
const checkpointId = props.checkpointId
|
||||
const checkedVersion = version
|
||||
committing.value = true
|
||||
const ok = await runOperation(id, '正在提交拆解候选', async () => {
|
||||
const records = await projectsApi.checkpoints(id)
|
||||
const latest = workflowCheckpoints(records, 'breakdown').at(-1)
|
||||
if (!checkpointId || latest?.checkpointId !== checkpointId || latest.state.storyboardPersisted || latest.state.candidateCommitted || props.projectId !== id || props.checkpointId !== checkpointId) throw new Error('拆解候选版本已变化或已经提交,请刷新后重新确认。')
|
||||
const checked = await breakdownApi.candidateCommitPreview(id)
|
||||
if (checkedVersion !== version || !props.quality.canRequestCommitPreview || !candidatePreviewReady(checked, id, checkpointId) || props.projectId !== id || props.checkpointId !== checkpointId) throw new Error('提交安全条件已变化,请重新检查候选。')
|
||||
const receipt = await breakdownApi.commitCandidate(id)
|
||||
if (receipt.projectId !== id) throw new Error('提交回执所属项目不一致,请刷新确认。')
|
||||
return receipt
|
||||
}, receipt => ({ type: 'success', content: `拆解结果已保存并采用:${receipt.subjectCount} 个主体、${receipt.episodeCount} 集、${receipt.shotCount} 个镜头。` }))
|
||||
const ok = await runOperation(
|
||||
id,
|
||||
'正在提交拆解候选',
|
||||
async () => {
|
||||
const records = await projectsApi.checkpoints(id)
|
||||
const latest = workflowCheckpoints(records, 'breakdown').at(-1)
|
||||
if (
|
||||
!checkpointId ||
|
||||
latest?.checkpointId !== checkpointId ||
|
||||
latest.state.storyboardPersisted ||
|
||||
latest.state.candidateCommitted ||
|
||||
props.projectId !== id ||
|
||||
props.checkpointId !== checkpointId
|
||||
)
|
||||
throw new Error('拆解候选版本已变化或已经提交,请刷新后重新确认。')
|
||||
const checked = await breakdownApi.candidateCommitPreview(id)
|
||||
if (
|
||||
checkedVersion !== version ||
|
||||
!props.quality.canRequestCommitPreview ||
|
||||
!candidatePreviewReady(checked, id, checkpointId) ||
|
||||
props.projectId !== id ||
|
||||
props.checkpointId !== checkpointId
|
||||
)
|
||||
throw new Error('提交安全条件已变化,请重新检查候选。')
|
||||
const receipt = await breakdownApi.commitCandidate(id)
|
||||
if (receipt.projectId !== id) throw new Error('提交回执所属项目不一致,请刷新确认。')
|
||||
return receipt
|
||||
},
|
||||
receipt => ({
|
||||
type: 'success',
|
||||
content: `拆解结果已保存并采用:${receipt.subjectCount} 个主体、${receipt.episodeCount} 集、${receipt.shotCount} 个镜头。`
|
||||
})
|
||||
)
|
||||
if (props.projectId === id) {
|
||||
if (ok) submittedId.value = `${id}:${checkpointId}`
|
||||
invalidate()
|
||||
@@ -129,25 +198,77 @@ async function commit() {
|
||||
|
||||
<template>
|
||||
<!-- 以下是候选质量与安全提交模块,不使用只读审核结果替代事务门禁 -->
|
||||
<section v-if="isCandidate" class="workspace-panel space-y-4" :class="{ 'breakdown-candidate-committed': committed }" aria-label="拆解候选">
|
||||
<section
|
||||
v-if="isCandidate"
|
||||
class="workspace-panel space-y-4"
|
||||
:class="{ 'breakdown-candidate-committed': committed }"
|
||||
aria-label="拆解候选"
|
||||
>
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h3 class="text-sm font-medium">{{ committed ? '拆解结果已保存并采用' : '待确认的拆解候选' }}</h3>
|
||||
<span class="text-xs text-muted">{{ committed ? '正式主体' : '候选主体' }} {{ counts.subjects }} · {{ counts.episodes }} 集 · {{ counts.shots }} 镜</span>
|
||||
<span class="text-xs text-muted"
|
||||
>{{ committed ? '正式主体' : '候选主体' }} {{ counts.subjects }} · {{ counts.episodes }} 集 ·
|
||||
{{ counts.shots }} 镜</span
|
||||
>
|
||||
</div>
|
||||
<p class="text-xs leading-6 text-muted">{{ committed ? '本次拆解出的人物、场景、道具和分镜已保存,后续制作会使用这份结果。' : '候选尚未写入正式资产,质量审核后还需通过安全预检查。' }}</p>
|
||||
<p v-if="!committed" class="text-xs text-muted" role="status">{{ quality.loading ? '正在重新审核当前候选…' : quality.needsRefresh ? '这份拆解结果的检查状态尚未确认,请点击“重新检查”。' : quality.canRequestCommitPreview ? '候选质量审核通过,可执行提交安全预检查。' : '候选仍有待处理问题,请先修订。' }}</p>
|
||||
<p class="text-xs leading-6 text-muted">
|
||||
{{
|
||||
committed
|
||||
? '本次拆解出的人物、场景、道具和分镜已保存,后续制作会使用这份结果。'
|
||||
: '候选尚未写入正式资产,质量审核后还需通过安全预检查。'
|
||||
}}
|
||||
</p>
|
||||
<p v-if="!committed" class="text-xs text-muted" role="status">
|
||||
{{
|
||||
quality.loading
|
||||
? '正在重新审核当前候选…'
|
||||
: quality.needsRefresh
|
||||
? '这份拆解结果的检查状态尚未确认,请点击“重新检查”。'
|
||||
: quality.canRequestCommitPreview
|
||||
? '候选质量审核通过,可执行提交安全预检查。'
|
||||
: '候选仍有待处理问题,请先修订。'
|
||||
}}
|
||||
</p>
|
||||
<!-- 以下是尚未采用结果的检查与确认操作,采用后不再显示操作区域 -->
|
||||
<div v-if="!committed" class="flex flex-wrap items-center gap-3">
|
||||
<NButton :disabled="!canCheck" :loading="checking || committing" @click="check">提交候选为正式结果</NButton>
|
||||
<WorkspaceRefreshButton label="重新检查" :loading="quality.loading" :disabled="operation.pending || checking" @refresh="emit('refresh')" />
|
||||
<WorkspaceRefreshButton
|
||||
label="重新检查"
|
||||
:loading="quality.loading"
|
||||
:disabled="operation.pending || checking"
|
||||
@refresh="emit('refresh')"
|
||||
/>
|
||||
</div>
|
||||
<section v-if="failedChecks.length" class="problem-surface p-4" aria-label="未通过的提交安全检查"><p class="mb-2 text-sm">提交安全检查未通过</p><ul class="list-inside list-disc space-y-2 text-xs"><li v-for="label in failedChecks" :key="label">{{ label }}</li></ul></section>
|
||||
<section v-if="failedChecks.length" class="problem-surface p-4" aria-label="未通过的提交安全检查">
|
||||
<p class="mb-2 text-sm">提交安全检查未通过</p>
|
||||
<ul class="list-inside list-disc space-y-2 text-xs">
|
||||
<li v-for="label in failedChecks" :key="label">{{ label }}</li>
|
||||
</ul>
|
||||
</section>
|
||||
<p v-if="checkError" class="text-xs text-danger" role="alert">{{ checkError }}</p>
|
||||
<!-- 以下是通过只读预检查后才出现的最终确认,取消和关闭撤销确认 -->
|
||||
<AppDialog v-model:open="confirmOpen" title="确认提交候选为正式结果" :busy="committing" description="将替换正式主体、形态与分镜。保存时还会检查剧本是否变化,以及已有制作成果是否受到影响。">
|
||||
<p class="text-sm">本次候选:{{ counts.subjects }} 个主体、{{ counts.episodes }} 集、{{ counts.shots }} 个镜头。</p>
|
||||
<NCheckbox v-model:checked="acknowledged" class="mt-5">我已确认替换正式结果,当前没有同项目的制作任务在运行。</NCheckbox>
|
||||
<template #footer><NButton :disabled="committing" @click="confirmOpen = false; acknowledged = false">取消</NButton><NButton type="primary" :loading="committing" :disabled="!acknowledged || !ready || !canCheck" @click="commit">确认提交候选为正式结果</NButton></template>
|
||||
<AppDialog
|
||||
v-model:open="confirmOpen"
|
||||
title="确认提交候选为正式结果"
|
||||
:busy="committing"
|
||||
description="将替换正式主体、形态与分镜。保存时还会检查剧本是否变化,以及已有制作成果是否受到影响。"
|
||||
>
|
||||
<p class="text-sm">
|
||||
本次候选:{{ counts.subjects }} 个主体、{{ counts.episodes }} 集、{{ counts.shots }} 个镜头。
|
||||
</p>
|
||||
<NCheckbox v-model:checked="acknowledged" class="mt-5"
|
||||
>我已确认替换正式结果,当前没有同项目的制作任务在运行。</NCheckbox
|
||||
>
|
||||
<template #footer
|
||||
><NButton :disabled="committing" @click="cancelConfirmation">取消</NButton
|
||||
><NButton
|
||||
type="primary"
|
||||
:loading="committing"
|
||||
:disabled="!acknowledged || !ready || !canCheck"
|
||||
@click="commit"
|
||||
>确认提交候选为正式结果</NButton
|
||||
></template
|
||||
>
|
||||
</AppDialog>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
@@ -35,10 +35,24 @@ const open = defineModel<boolean>('open', { default: false })
|
||||
/** 抽屉关闭后再定位正文,避免焦点陷阱阻止定位。 */
|
||||
const emit = defineEmits<{ locate: [issue: ShotValidation['issues'][number]]; refresh: [] }>()
|
||||
/** 问题类型统一分类,缺失精确坐标时只提供剧集查看。 */
|
||||
const problemGroups = computed(() => ([
|
||||
['subject', '主体引用缺失'], ['binding', '形态绑定异常'], ['structure', '分镜结构校验'],
|
||||
['action', '动作质量阻断'], ['pending', '待审核剧集'], ['workflow', '当前执行异常']
|
||||
] as const).map(([type, label]) => ({ type, label, items: props.quality?.problems.filter(item => item.type === type) ?? [] })).filter(group => group.items.length))
|
||||
const problemGroups = computed(() =>
|
||||
(
|
||||
[
|
||||
['subject', '主体引用缺失'],
|
||||
['binding', '形态绑定异常'],
|
||||
['structure', '分镜结构校验'],
|
||||
['action', '动作质量阻断'],
|
||||
['pending', '待审核剧集'],
|
||||
['workflow', '当前执行异常']
|
||||
] as const
|
||||
)
|
||||
.map(([type, label]) => ({
|
||||
type,
|
||||
label,
|
||||
items: props.quality?.problems.filter(item => item.type === type) ?? []
|
||||
}))
|
||||
.filter(group => group.items.length)
|
||||
)
|
||||
/** 相同镜头的问题合并为一组,重复消息不重复显示。 */
|
||||
const groups = computed(() => {
|
||||
const result = new Map<string, BreakdownIssueGroup>()
|
||||
@@ -78,25 +92,64 @@ function finish() {
|
||||
<!-- 以下是全屏展示的拆解执行错误与分镜校验问题模块 -->
|
||||
<AppDrawer v-model:open="open" title="拆解问题" :busy="busy" class="breakdown-issues-drawer" @closed="finish">
|
||||
<template #description
|
||||
><span v-if="quality">{{ quality.isCandidate ? '当前候选' : quality.source === 'history' ? '历史结果(当前质量未确认)' : '当前正式结果' }} · 结构 {{ quality.structuralCount }} 项 · 动作 {{ quality.actionBlocks.length }} 镜</span
|
||||
><span v-if="quality"
|
||||
>{{
|
||||
quality.isCandidate
|
||||
? '当前候选'
|
||||
: quality.source === 'history'
|
||||
? '历史结果(当前质量未确认)'
|
||||
: '当前正式结果'
|
||||
}}
|
||||
· 结构 {{ quality.structuralCount }} 项 · 动作 {{ quality.actionBlocks.length }} 镜</span
|
||||
><span v-else-if="count">{{ count }} 项校验问题 · {{ groups.length }} 个位置</span
|
||||
><span v-else>查看最近保存结果中的问题</span></template
|
||||
>
|
||||
<!-- 以下是当前版本的分类问题,历史错误不会混入当前问题数量 -->
|
||||
<div v-if="quality" class="space-y-5" :aria-busy="quality.loading">
|
||||
<p v-if="quality.loading" class="text-sm text-muted" role="status">正在读取当前候选审核…</p>
|
||||
<div v-else-if="quality.error" class="problem-surface p-5 space-y-3"><p class="text-sm break-words">{{ quality.error }}</p><NButton @click="emit('refresh')">重新读取审核</NButton></div>
|
||||
<div v-else-if="quality.error" class="problem-surface p-5 space-y-3">
|
||||
<p class="text-sm break-words">{{ quality.error }}</p>
|
||||
<NButton @click="emit('refresh')">重新读取审核</NButton>
|
||||
</div>
|
||||
<template v-else>
|
||||
<section v-for="group in problemGroups" :key="group.type" class="space-y-3" :aria-label="group.label">
|
||||
<h3 class="text-sm font-medium">{{ group.label }} · {{ group.items.length }}</h3>
|
||||
<article v-for="item in group.items" :key="item.key" class="workspace-panel problem-surface space-y-3 break-words" :data-problem-type="item.type">
|
||||
<div v-if="item.location" class="flex flex-wrap items-center justify-between gap-3"><p class="text-sm">第 {{ item.location.episodeNo }} 集<span v-if="item.location.beatNo"> · 节拍 {{ item.location.beatNo }}</span><span v-if="item.location.shotNo"> · 镜头 {{ item.location.shotNo }}</span><span class="ml-3 text-xs text-muted">待处理</span></p><NButton v-if="locatable" text size="small" @click="locate(item.location)">{{ item.location.beatNo ? '定位分镜' : '查看本集' }}</NButton></div>
|
||||
<p class="text-sm leading-6">{{ userFacingText(item.message) }}</p><p v-if="item.codes.length" class="text-xs text-muted break-all">需要处理:{{ item.codes.map(qualityIssueLabel).join('、') }}</p>
|
||||
<article
|
||||
v-for="item in group.items"
|
||||
:key="item.key"
|
||||
class="workspace-panel problem-surface space-y-3 break-words"
|
||||
:data-problem-type="item.type"
|
||||
>
|
||||
<div v-if="item.location" class="flex flex-wrap items-center justify-between gap-3">
|
||||
<p class="text-sm">
|
||||
第 {{ item.location.episodeNo }} 集<span v-if="item.location.beatNo">
|
||||
· 节拍 {{ item.location.beatNo }}</span
|
||||
><span v-if="item.location.shotNo"> · 镜头 {{ item.location.shotNo }}</span
|
||||
><span class="ml-3 text-xs text-muted">待处理</span>
|
||||
</p>
|
||||
<NButton v-if="locatable" text size="small" @click="locate(item.location)">{{
|
||||
item.location.beatNo ? '定位分镜' : '查看本集'
|
||||
}}</NButton>
|
||||
</div>
|
||||
<p class="text-sm leading-6">{{ userFacingText(item.message) }}</p>
|
||||
<p v-if="item.codes.length" class="text-xs text-muted break-all">
|
||||
需要处理:{{ item.codes.map(qualityIssueLabel).join('、') }}
|
||||
</p>
|
||||
</article>
|
||||
</section>
|
||||
<p v-if="!quality.issueCount && !workflowError" class="text-sm text-muted">当前版本没有待处理的质量问题。</p>
|
||||
<p v-if="!quality.issueCount && !workflowError" class="text-sm text-muted">
|
||||
当前版本没有待处理的质量问题。
|
||||
</p>
|
||||
<!-- 以下是使用 Naive 折叠组件的历史记录,默认收起且不计入当前问题 -->
|
||||
<NCollapse v-if="quality.historyIssues.length" class="text-xs text-muted" data-history-issues><NCollapseItem name="history" :title="`历史审核记录 · ${quality.historyIssues.length} 项(不计入当前问题)`"><p v-for="(item, index) in quality.historyIssues" :key="index" class="mt-3 break-words">第 {{ item.episodeNo }} 集 · {{ userFacingText(item.message) }}</p></NCollapseItem></NCollapse>
|
||||
<NCollapse v-if="quality.historyIssues.length" class="text-xs text-muted" data-history-issues
|
||||
><NCollapseItem
|
||||
name="history"
|
||||
:title="`历史审核记录 · ${quality.historyIssues.length} 项(不计入当前问题)`"
|
||||
><p v-for="(item, index) in quality.historyIssues" :key="index" class="mt-3 break-words">
|
||||
第 {{ item.episodeNo }} 集 · {{ userFacingText(item.message) }}
|
||||
</p></NCollapseItem
|
||||
></NCollapse
|
||||
>
|
||||
</template>
|
||||
</div>
|
||||
<div class="space-y-4">
|
||||
|
||||
@@ -40,9 +40,21 @@ const emit = defineEmits<{ refresh: [] }>()
|
||||
/** 项目写锁与统一消息反馈。 */
|
||||
const operation = computed(() => getOperation(props.projectId))
|
||||
/** 必须匹配当前检查点与项目的审核。 */
|
||||
const review = computed(() => props.review?.checkpointId === props.checkpointId && props.review.projectId === props.projectId ? props.review : null)
|
||||
const review = computed(() =>
|
||||
props.review?.checkpointId === props.checkpointId && props.review.projectId === props.projectId
|
||||
? props.review
|
||||
: null
|
||||
)
|
||||
/** 只有明确候选且没有活动操作才允许修订。 */
|
||||
const writable = computed(() => !!review.value && props.state.candidateOnly === true && !props.state.storyboardPersisted && !props.state.candidateCommitted && !props.disabled && !operation.value.pending)
|
||||
const writable = computed(
|
||||
() =>
|
||||
!!review.value &&
|
||||
props.state.candidateOnly === true &&
|
||||
!props.state.storyboardPersisted &&
|
||||
!props.state.candidateCommitted &&
|
||||
!props.disabled &&
|
||||
!operation.value.pending
|
||||
)
|
||||
/** 已选择的镜头坐标键。 */
|
||||
const targetKey = ref('')
|
||||
/** 从真实主体选项中选择的引用。 */
|
||||
@@ -67,15 +79,24 @@ const targets = computed(() => {
|
||||
const values = new Map<string, CandidateShotLocation & { refs: string[] }>()
|
||||
const add = (location: CandidateShotLocation, subjectReference: string) => {
|
||||
if (!props.state.subjectCandidates?.some(subject => subject.ref === subjectReference)) return
|
||||
const shot = props.state.storyboardEpisodeShots?.find(item => item.episodeNo === location.episodeNo)?.beatShots.find(item => item.beatNo === location.beatNo)?.shots.find(item => item.shotNo === location.shotNo)
|
||||
if (!shot || shot.subjectRefs.includes(subjectReference) || shot.subjectBindings?.some(item => item.subjectRef === subjectReference)) return
|
||||
const shot = props.state.storyboardEpisodeShots
|
||||
?.find(item => item.episodeNo === location.episodeNo)
|
||||
?.beatShots.find(item => item.beatNo === location.beatNo)
|
||||
?.shots.find(item => item.shotNo === location.shotNo)
|
||||
if (
|
||||
!shot ||
|
||||
shot.subjectRefs.includes(subjectReference) ||
|
||||
shot.subjectBindings?.some(item => item.subjectRef === subjectReference)
|
||||
)
|
||||
return
|
||||
const key = positionKey(location)
|
||||
const value = values.get(key) ?? { ...location, refs: [] }
|
||||
if (!value.refs.includes(subjectReference)) value.refs.push(subjectReference)
|
||||
values.set(key, value)
|
||||
}
|
||||
for (const item of review.value?.missingSubjectRefs ?? []) {
|
||||
if (item.beatNo && item.shotNo && item.subject) add({ episodeNo: item.episodeNo, beatNo: item.beatNo, shotNo: item.shotNo }, item.subject.ref)
|
||||
if (item.beatNo && item.shotNo && item.subject)
|
||||
add({ episodeNo: item.episodeNo, beatNo: item.beatNo, shotNo: item.shotNo }, item.subject.ref)
|
||||
}
|
||||
for (const item of review.value?.propReferenceDiagnostics ?? []) {
|
||||
if (!item.shotHasSubject && !item.shotHasBinding) add(item, item.subjectRef)
|
||||
@@ -85,58 +106,130 @@ const targets = computed(() => {
|
||||
/** 当前镜头的可信缺失引用选项。 */
|
||||
const target = computed(() => targets.value.find(item => positionKey(item) === targetKey.value))
|
||||
/** 主体只取当前候选,禁止任意输入。 */
|
||||
const subjectOptions = computed(() => (props.state.subjectCandidates ?? []).filter(item => target.value?.refs.includes(item.ref)).map(item => ({ label: `${item.name}(${item.ref})`, value: item.ref })))
|
||||
const subjectOptions = computed(() =>
|
||||
(props.state.subjectCandidates ?? [])
|
||||
.filter(item => target.value?.refs.includes(item.ref))
|
||||
.map(item => ({ label: `${item.name}(${item.ref})`, value: item.ref }))
|
||||
)
|
||||
/** 形态严格按真实主体 profileId 过滤。 */
|
||||
const formOptions = computed(() => {
|
||||
const subject = props.state.subjectCandidates?.find(item => item.ref === subjectRef.value)
|
||||
return (props.state.subjectForms ?? []).filter(item => item.profileId === subject?.profileId).map(item => ({ label: item.formName || item.name, value: item.formId }))
|
||||
return (props.state.subjectForms ?? [])
|
||||
.filter(item => item.profileId === subject?.profileId)
|
||||
.map(item => ({ label: item.formName || item.name, value: item.formId }))
|
||||
})
|
||||
/** 可提交主体目标,切换任何字段后都会撤销先前确认。 */
|
||||
const subjectReady = computed(() => writable.value && !!target.value && subjectOptions.value.some(item => item.value === subjectRef.value) && formOptions.value.some(item => item.value === formId.value))
|
||||
const subjectReady = computed(
|
||||
() =>
|
||||
writable.value &&
|
||||
!!target.value &&
|
||||
subjectOptions.value.some(item => item.value === subjectRef.value) &&
|
||||
formOptions.value.some(item => item.value === formId.value)
|
||||
)
|
||||
/** 多镜头修复摘要只取用户选择的真实动作。 */
|
||||
const repairs = computed(() => actionDrafts.value.filter(item => item.selected).map(({ episodeNo, beatNo, shotNo, actionId, description }) => ({ episodeNo, beatNo, shotNo, actionId, description: description.trim() })))
|
||||
/** 每个选中动作都必须提供非空的、经过人工改写的过程描述。 */
|
||||
const actionReady = computed(() => writable.value && repairs.value.length > 0 && actionDrafts.value.filter(item => item.selected).every(item => !!item.description.trim() && item.description.trim() !== item.original.trim()))
|
||||
/** 主体修复的最终确认摘要。 */
|
||||
const subjectSummary = computed(() => `只更新候选检查点,不修改正式资产。目标:${targetKey.value};主体:${subjectRef.value};形态:${formOptions.value.find(item => item.value === formId.value)?.label ?? ''}。`)
|
||||
/** 批量修复的最终确认摘要,描述变化后必须重新确认。 */
|
||||
const actionSummary = computed(() => `只更新候选,不调用模型。共 ${repairs.value.length} 个动作:${repairs.value.map(item => `${positionKey(item)} · ${item.actionId}:${item.description}`).join(';')}`)
|
||||
|
||||
watch(targetKey, () => { subjectRef.value = ''; formId.value = '' })
|
||||
watch(subjectRef, () => { formId.value = '' })
|
||||
watch([() => props.projectId, () => props.checkpointId, review], () => {
|
||||
const version = `${props.projectId}:${props.checkpointId}`
|
||||
if (version !== draftVersion) {
|
||||
draftVersion = version
|
||||
targetKey.value = ''
|
||||
subjectRef.value = ''
|
||||
formId.value = ''
|
||||
actionDrafts.value = []
|
||||
}
|
||||
if (!review.value || actionDrafts.value.length) return
|
||||
actionDrafts.value = review.value.actionRepairTargets.flatMap(item => {
|
||||
if (!item.blockingCodes.includes('state_used_as_action_phase') || !item.shot) return []
|
||||
const shot = item.shot
|
||||
return shot.requiredActions.filter(action => action.kind === 'state' && shot.durationPlanning?.phases.some(phase => phase.actionIds?.includes(action.id))).map(action => ({
|
||||
episodeNo: item.episodeNo, beatNo: item.beatNo, shotNo: item.shotNo,
|
||||
key: `${positionKey(item)}/${action.id}`, actionId: action.id, selected: false,
|
||||
description: '', original: action.description, title: shot.title,
|
||||
parallel: shot.durationPlanning?.phases.some(phase => phase.actionIds?.includes(action.id) && phase.actionIds.length > 1) ?? false
|
||||
const repairs = computed(() =>
|
||||
actionDrafts.value
|
||||
.filter(item => item.selected)
|
||||
.map(({ episodeNo, beatNo, shotNo, actionId, description }) => ({
|
||||
episodeNo,
|
||||
beatNo,
|
||||
shotNo,
|
||||
actionId,
|
||||
description: description.trim()
|
||||
}))
|
||||
})
|
||||
}, { immediate: true })
|
||||
)
|
||||
/** 每个选中动作都必须提供非空的、经过人工改写的过程描述。 */
|
||||
const actionReady = computed(
|
||||
() =>
|
||||
writable.value &&
|
||||
repairs.value.length > 0 &&
|
||||
actionDrafts.value
|
||||
.filter(item => item.selected)
|
||||
.every(item => !!item.description.trim() && item.description.trim() !== item.original.trim())
|
||||
)
|
||||
/** 主体修复的最终确认摘要。 */
|
||||
const subjectSummary = computed(
|
||||
() =>
|
||||
`只更新候选检查点,不修改正式资产。目标:${targetKey.value};主体:${subjectRef.value};形态:${formOptions.value.find(item => item.value === formId.value)?.label ?? ''}。`
|
||||
)
|
||||
/** 批量修复的最终确认摘要,描述变化后必须重新确认。 */
|
||||
const actionSummary = computed(
|
||||
() =>
|
||||
`只更新候选,不调用模型。共 ${repairs.value.length} 个动作:${repairs.value.map(item => `${positionKey(item)} · ${item.actionId}:${item.description}`).join(';')}`
|
||||
)
|
||||
|
||||
watch(targetKey, () => {
|
||||
subjectRef.value = ''
|
||||
formId.value = ''
|
||||
})
|
||||
watch(subjectRef, () => {
|
||||
formId.value = ''
|
||||
})
|
||||
watch(
|
||||
[() => props.projectId, () => props.checkpointId, review],
|
||||
() => {
|
||||
const version = `${props.projectId}:${props.checkpointId}`
|
||||
if (version !== draftVersion) {
|
||||
draftVersion = version
|
||||
targetKey.value = ''
|
||||
subjectRef.value = ''
|
||||
formId.value = ''
|
||||
actionDrafts.value = []
|
||||
}
|
||||
if (!review.value || actionDrafts.value.length) return
|
||||
actionDrafts.value = review.value.actionRepairTargets.flatMap(item => {
|
||||
if (!item.blockingCodes.includes('state_used_as_action_phase') || !item.shot) return []
|
||||
const shot = item.shot
|
||||
return shot.requiredActions
|
||||
.filter(
|
||||
action =>
|
||||
action.kind === 'state' &&
|
||||
shot.durationPlanning?.phases.some(phase => phase.actionIds?.includes(action.id))
|
||||
)
|
||||
.map(action => ({
|
||||
episodeNo: item.episodeNo,
|
||||
beatNo: item.beatNo,
|
||||
shotNo: item.shotNo,
|
||||
key: `${positionKey(item)}/${action.id}`,
|
||||
actionId: action.id,
|
||||
selected: false,
|
||||
description: '',
|
||||
original: action.description,
|
||||
title: shot.title,
|
||||
parallel:
|
||||
shot.durationPlanning?.phases.some(
|
||||
phase => phase.actionIds?.includes(action.id) && phase.actionIds.length > 1
|
||||
) ?? false
|
||||
}))
|
||||
})
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
/** 用户确认后提交单镜头主体补齐,成功后重读真实新版本。 */
|
||||
async function repairSubject() {
|
||||
if (!subjectReady.value || !target.value) return
|
||||
const id = props.projectId
|
||||
const checkpointId = props.checkpointId
|
||||
const input = { expectedCheckpointId: checkpointId, episodeNo: target.value.episodeNo, beatNo: target.value.beatNo, shotNo: target.value.shotNo, subjectRef: subjectRef.value, formId: formId.value }
|
||||
const ok = await runOperation(id, '修复候选主体引用', async () => {
|
||||
const receipt = await breakdownApi.repairCandidateSubject(id, input)
|
||||
if (!receipt.checkpointId || receipt.checkpointId === checkpointId) throw new Error('未确认候选新版本,请刷新审核后核对。')
|
||||
return receipt
|
||||
}, { type: 'success', content: '候选引用已修订,正在重新读取审核结果。' })
|
||||
const input = {
|
||||
expectedCheckpointId: checkpointId,
|
||||
episodeNo: target.value.episodeNo,
|
||||
beatNo: target.value.beatNo,
|
||||
shotNo: target.value.shotNo,
|
||||
subjectRef: subjectRef.value,
|
||||
formId: formId.value
|
||||
}
|
||||
const ok = await runOperation(
|
||||
id,
|
||||
'修复候选主体引用',
|
||||
async () => {
|
||||
const receipt = await breakdownApi.repairCandidateSubject(id, input)
|
||||
if (!receipt.checkpointId || receipt.checkpointId === checkpointId)
|
||||
throw new Error('未确认候选新版本,请刷新审核后核对。')
|
||||
return receipt
|
||||
},
|
||||
{ type: 'success', content: '候选引用已修订,正在重新读取审核结果。' }
|
||||
)
|
||||
if (ok && props.projectId === id) emit('refresh')
|
||||
}
|
||||
|
||||
@@ -146,11 +239,17 @@ async function repairActions() {
|
||||
const id = props.projectId
|
||||
const checkpointId = props.checkpointId
|
||||
const input = { expectedCheckpointId: checkpointId, repairs: structuredClone(repairs.value) }
|
||||
const ok = await runOperation(id, '批量修复候选动作', async () => {
|
||||
const receipt = await breakdownApi.repairCandidateActions(id, input)
|
||||
if (!receipt.checkpointId || receipt.checkpointId === checkpointId) throw new Error('未确认候选新版本,请刷新审核后核对。')
|
||||
return receipt
|
||||
}, { type: 'success', content: '候选动作已修订,正在重新读取审核结果。' })
|
||||
const ok = await runOperation(
|
||||
id,
|
||||
'批量修复候选动作',
|
||||
async () => {
|
||||
const receipt = await breakdownApi.repairCandidateActions(id, input)
|
||||
if (!receipt.checkpointId || receipt.checkpointId === checkpointId)
|
||||
throw new Error('未确认候选新版本,请刷新审核后核对。')
|
||||
return receipt
|
||||
},
|
||||
{ type: 'success', content: '候选动作已修订,正在重新读取审核结果。' }
|
||||
)
|
||||
if (ok && props.projectId === id) emit('refresh')
|
||||
}
|
||||
</script>
|
||||
@@ -158,28 +257,99 @@ async function repairActions() {
|
||||
<template>
|
||||
<!-- 以下是仅针对候选的主体与形态补齐模块 -->
|
||||
<section v-if="targets.length" class="workspace-panel space-y-4" aria-label="候选主体修复">
|
||||
<WorkspaceSectionHeading title="补齐候选主体引用" description="选择当前缺失引用及该主体已有形态,确认后保存为新的候选版本。" />
|
||||
<WorkspaceSectionHeading
|
||||
title="补齐候选主体引用"
|
||||
description="选择当前缺失引用及该主体已有形态,确认后保存为新的候选版本。"
|
||||
/>
|
||||
<div class="grid grid-cols-1 gap-4 lg:grid-cols-3">
|
||||
<NFormItem label="目标镜头"><NSelect v-model:value="targetKey" aria-label="主体修复目标镜头" :disabled="!writable" :options="targets.map(item => ({ label: `第 ${item.episodeNo} 集 · 节拍 ${item.beatNo} · 镜头 ${item.shotNo}`, value: positionKey(item) }))" /></NFormItem>
|
||||
<NFormItem label="候选主体"><NSelect v-model:value="subjectRef" aria-label="待补齐候选主体" :disabled="!writable || !target" :options="subjectOptions" /></NFormItem>
|
||||
<NFormItem label="已有形态"><NSelect v-model:value="formId" aria-label="候选主体已有形态" :disabled="!writable || !subjectRef" :options="formOptions" /></NFormItem>
|
||||
<NFormItem label="目标镜头"
|
||||
><NSelect
|
||||
v-model:value="targetKey"
|
||||
aria-label="主体修复目标镜头"
|
||||
:disabled="!writable"
|
||||
:options="
|
||||
targets.map(item => ({
|
||||
label: `第 ${item.episodeNo} 集 · 节拍 ${item.beatNo} · 镜头 ${item.shotNo}`,
|
||||
value: positionKey(item)
|
||||
}))
|
||||
"
|
||||
/></NFormItem>
|
||||
<NFormItem label="候选主体"
|
||||
><NSelect
|
||||
v-model:value="subjectRef"
|
||||
aria-label="待补齐候选主体"
|
||||
:disabled="!writable || !target"
|
||||
:options="subjectOptions"
|
||||
/></NFormItem>
|
||||
<NFormItem label="已有形态"
|
||||
><NSelect
|
||||
v-model:value="formId"
|
||||
aria-label="候选主体已有形态"
|
||||
:disabled="!writable || !subjectRef"
|
||||
:options="formOptions"
|
||||
/></NFormItem>
|
||||
</div>
|
||||
<ConfirmAction :key="`${checkpointId}:${subjectSummary}`" label="修复候选主体引用" :description="subjectSummary" :disabled="!subjectReady" :loading="isOperationRunning(operation, '修复候选主体引用')" @confirm="repairSubject" />
|
||||
<ConfirmAction
|
||||
:key="`${checkpointId}:${subjectSummary}`"
|
||||
label="修复候选主体引用"
|
||||
:description="subjectSummary"
|
||||
:disabled="!subjectReady"
|
||||
:loading="isOperationRunning(operation, '修复候选主体引用')"
|
||||
@confirm="repairSubject"
|
||||
/>
|
||||
</section>
|
||||
<!-- 以下是动作质量阻断的批量语义修订模块,不提供 kind 修改或自动修复 -->
|
||||
<section v-if="review?.actionQualityBlocks.length" class="workspace-panel space-y-4" aria-label="候选批量动作修复">
|
||||
<WorkspaceSectionHeading title="批量修订候选动作" description="仅展示当前阻断镜头。逐项选择并填写可观察的动作过程,提交前核对修复摘要。" />
|
||||
<p v-if="!actionDrafts.length" class="text-xs text-muted">当前阻断不属于批量接口支持的结果状态引用问题,无法在此自动修订。</p>
|
||||
<article v-for="draft in actionDrafts" :key="draft.key" class="candidate-action-draft space-y-3 p-4" :data-action-id="draft.actionId">
|
||||
<NCheckbox v-model:checked="draft.selected" :disabled="!writable">第 {{ draft.episodeNo }} 集 · 节拍 {{ draft.beatNo }} · 镜头 {{ draft.shotNo }} · {{ draft.title }} · {{ draft.actionId }}</NCheckbox>
|
||||
<WorkspaceSectionHeading
|
||||
title="批量修订候选动作"
|
||||
description="仅展示当前阻断镜头。逐项选择并填写可观察的动作过程,提交前核对修复摘要。"
|
||||
/>
|
||||
<p v-if="!actionDrafts.length" class="text-xs text-muted">
|
||||
当前阻断不属于批量接口支持的结果状态引用问题,无法在此自动修订。
|
||||
</p>
|
||||
<article
|
||||
v-for="draft in actionDrafts"
|
||||
:key="draft.key"
|
||||
class="candidate-action-draft space-y-3 p-4"
|
||||
:data-action-id="draft.actionId"
|
||||
>
|
||||
<NCheckbox v-model:checked="draft.selected" :disabled="!writable"
|
||||
>第 {{ draft.episodeNo }} 集 · 节拍 {{ draft.beatNo }} · 镜头 {{ draft.shotNo }} · {{ draft.title }} ·
|
||||
{{ draft.actionId }}</NCheckbox
|
||||
>
|
||||
<p class="text-xs leading-6 text-muted">原始状态:{{ draft.original }}</p>
|
||||
<p v-if="draft.parallel" class="text-xs text-danger">这个动作与其他动作同时发生。请先核对它们的关系,避免修改后互相冲突。</p>
|
||||
<NInput v-model:value="draft.description" type="textarea" :disabled="!writable || !draft.selected" :input-props="{ 'aria-label': `动作 ${draft.key} 修订描述` }" placeholder="请人工填写动作如何发生,不能只把结果状态改名" :autosize="{ minRows: 3, maxRows: 8 }" />
|
||||
<p v-if="draft.parallel" class="text-xs text-danger">
|
||||
这个动作与其他动作同时发生。请先核对它们的关系,避免修改后互相冲突。
|
||||
</p>
|
||||
<NInput
|
||||
v-model:value="draft.description"
|
||||
type="textarea"
|
||||
:disabled="!writable || !draft.selected"
|
||||
:input-props="{ 'aria-label': `动作 ${draft.key} 修订描述` }"
|
||||
placeholder="请人工填写动作如何发生,不能只把结果状态改名"
|
||||
:autosize="{ minRows: 3, maxRows: 8 }"
|
||||
/>
|
||||
</article>
|
||||
<p v-if="repairs.length" class="text-xs leading-6 text-muted break-words" aria-label="批量修复摘要">{{ actionSummary }}</p>
|
||||
<ConfirmAction v-if="actionDrafts.length" :key="`${checkpointId}:${actionSummary}`" label="批量修复候选动作" :description="actionSummary" :disabled="!actionReady" :loading="isOperationRunning(operation, '批量修复候选动作')" @confirm="repairActions" />
|
||||
<p v-if="repairs.length" class="text-xs leading-6 text-muted break-words" aria-label="批量修复摘要">
|
||||
{{ actionSummary }}
|
||||
</p>
|
||||
<ConfirmAction
|
||||
v-if="actionDrafts.length"
|
||||
:key="`${checkpointId}:${actionSummary}`"
|
||||
label="批量修复候选动作"
|
||||
:description="actionSummary"
|
||||
:disabled="!actionReady"
|
||||
:loading="isOperationRunning(operation, '批量修复候选动作')"
|
||||
@confirm="repairActions"
|
||||
/>
|
||||
</section>
|
||||
<p v-if="operation.error && ['修复候选主体引用', '批量修复候选动作'].includes(operation.label)" role="alert" class="text-xs text-danger break-words">{{ operation.error }}</p>
|
||||
<p
|
||||
v-if="operation.error && ['修复候选主体引用', '批量修复候选动作'].includes(operation.label)"
|
||||
role="alert"
|
||||
class="text-xs text-danger break-words"
|
||||
>
|
||||
{{ operation.error }}
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -31,18 +31,42 @@ const revisions = ref<StoryboardHandRepairHistory | null>(null)
|
||||
/** 当前诊断对应的修订资格。 */
|
||||
const readiness = ref<DiagnosisRepairReadiness | null>(null)
|
||||
/** 两类记录均已成功读到空结果时,使用同一条空状态,读取失败不冒充暂无记录。 */
|
||||
const noRecords = computed(() => !loading.value && !error.value && !!history.value && !!revisions.value &&
|
||||
history.value.revisions.length === 0 && revisions.value.revisions.length === 0)
|
||||
const noRecords = computed(
|
||||
() =>
|
||||
!loading.value &&
|
||||
!error.value &&
|
||||
!!history.value &&
|
||||
!!revisions.value &&
|
||||
history.value.revisions.length === 0 &&
|
||||
revisions.value.revisions.length === 0
|
||||
)
|
||||
/** 当前列表与资格必须同时有效,不能把旧诊断或直接应用标记解释成修订许可。 */
|
||||
const repairEligible = computed(() => readiness.value?.eligible === true && readiness.value.requiresManualReview === true &&
|
||||
readiness.value.canApplyDirectly === false && readiness.value.willCallModel === false && readiness.value.willModifyAssets === false &&
|
||||
props.shot.status === 'conflict_found' && props.shot.policyStatus === 'current' && props.shot.shotStale === false)
|
||||
const repairEligible = computed(
|
||||
() =>
|
||||
readiness.value?.eligible === true &&
|
||||
readiness.value.requiresManualReview === true &&
|
||||
readiness.value.canApplyDirectly === false &&
|
||||
readiness.value.willCallModel === false &&
|
||||
readiness.value.willModifyAssets === false &&
|
||||
props.shot.status === 'conflict_found' &&
|
||||
props.shot.policyStatus === 'current' &&
|
||||
props.shot.shotStale === false
|
||||
)
|
||||
/** 只读请求加载,始终允许关闭主窗口。 */
|
||||
const loading = ref(false)
|
||||
/** 保留可重试的查询错误。 */
|
||||
const error = ref('')
|
||||
/** 同镜头诊断和版本状态组成请求身份。 */
|
||||
const target = computed(() => JSON.stringify([props.projectId, props.shot.shotId, props.shot.diagnosisId, props.shot.policyStatus, props.shot.shotStale, props.shot.latestRepairId]))
|
||||
const target = computed(() =>
|
||||
JSON.stringify([
|
||||
props.projectId,
|
||||
props.shot.shotId,
|
||||
props.shot.diagnosisId,
|
||||
props.shot.policyStatus,
|
||||
props.shot.shotStale,
|
||||
props.shot.latestRepairId
|
||||
])
|
||||
)
|
||||
/** 请求代次用于拦截迟到结果。 */
|
||||
let version = 0
|
||||
/** 只读请求关闭时取消。 */
|
||||
@@ -52,75 +76,164 @@ let controller: AbortController | undefined
|
||||
async function load() {
|
||||
if (loading.value) return
|
||||
const current = ++version
|
||||
const id = props.projectId, shotId = props.shot.shotId, diagnosisId = props.shot.diagnosisId
|
||||
controller?.abort(); controller = new AbortController()
|
||||
loading.value = true; error.value = ''
|
||||
const id = props.projectId,
|
||||
shotId = props.shot.shotId,
|
||||
diagnosisId = props.shot.diagnosisId
|
||||
controller?.abort()
|
||||
controller = new AbortController()
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
try {
|
||||
const [records, checked, changes] = await Promise.all([
|
||||
breakdownApi.diagnosisHistory(id, shotId, controller.signal),
|
||||
diagnosisId ? breakdownApi.diagnosisRepairReadiness(id, shotId, diagnosisId, controller.signal) : Promise.resolve(null),
|
||||
diagnosisId
|
||||
? breakdownApi.diagnosisRepairReadiness(id, shotId, diagnosisId, controller.signal)
|
||||
: Promise.resolve(null),
|
||||
preparationApi.revisions(id, shotId, controller.signal)
|
||||
])
|
||||
if (current !== version) return
|
||||
if (changes.projectId !== id || changes.shotId !== shotId || !Array.isArray(changes.revisions) || records.projectId !== id || records.shotId !== shotId || !Array.isArray(records.revisions) ||
|
||||
checked && (checked.projectId !== id || checked.shotId !== shotId || checked.diagnosisId !== diagnosisId))
|
||||
if (
|
||||
changes.projectId !== id ||
|
||||
changes.shotId !== shotId ||
|
||||
!Array.isArray(changes.revisions) ||
|
||||
records.projectId !== id ||
|
||||
records.shotId !== shotId ||
|
||||
!Array.isArray(records.revisions) ||
|
||||
(checked && (checked.projectId !== id || checked.shotId !== shotId || checked.diagnosisId !== diagnosisId))
|
||||
)
|
||||
throw new Error('记录与当前镜头不一致,请重新读取。')
|
||||
history.value = records; readiness.value = checked; revisions.value = changes
|
||||
} catch (cause) { if (current === version) error.value = errorMessage(cause) }
|
||||
finally { if (current === version) loading.value = false }
|
||||
history.value = records
|
||||
readiness.value = checked
|
||||
revisions.value = changes
|
||||
} catch (cause) {
|
||||
if (current === version) error.value = errorMessage(cause)
|
||||
} finally {
|
||||
if (current === version) loading.value = false
|
||||
}
|
||||
}
|
||||
/** 收起或切换上下文时废弃旧请求,不把旧资格沿用到新版本。 */
|
||||
function reset() { version++; controller?.abort(); loading.value = false; history.value = null; readiness.value = null; revisions.value = null; error.value = '' }
|
||||
watch(expanded, value => { if (value.includes('review')) void load(); else reset() })
|
||||
watch(target, () => { reset(); if (expanded.value.includes('review')) void load() })
|
||||
function reset() {
|
||||
version++
|
||||
controller?.abort()
|
||||
loading.value = false
|
||||
history.value = null
|
||||
readiness.value = null
|
||||
revisions.value = null
|
||||
error.value = ''
|
||||
}
|
||||
watch(expanded, value => {
|
||||
if (value.includes('review')) void load()
|
||||
else reset()
|
||||
})
|
||||
watch(target, () => {
|
||||
reset()
|
||||
if (expanded.value.includes('review')) void load()
|
||||
})
|
||||
onScopeDispose(reset)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- 以下是指定诊断的只读修订条件与历史记录,普通列表不暴露内部编号 -->
|
||||
<div class="diagnosis-shot-tools">
|
||||
<NButton size="small" :aria-label="showDetails ? '收起修订条件与历史' : '修订条件与诊断历史'" :title="showDetails ? '收起修订条件与历史' : '修订条件与诊断历史'" :aria-expanded="showDetails" @click="expanded = showDetails ? [] : ['review']"><template #icon><History :size="15" aria-hidden="true" /></template><span class="diagnosis-action-label">{{ showDetails ? '收起修订条件与历史' : '修订条件与诊断历史' }}</span></NButton>
|
||||
<!-- 以下是与定位、复查和历史入口同排的刷新操作,不在展开正文另起一组工具。 -->
|
||||
<NButton v-if="showDetails" size="small" :loading="loading" @click="load"><template #icon><RefreshCw :size="14" aria-hidden="true" /></template>刷新记录</NButton>
|
||||
<NCollapse v-show="showDetails" v-model:expanded-names="expanded" class="diagnosis-shot-details">
|
||||
<NCollapseItem name="review" title="修订条件与诊断历史">
|
||||
<div class="space-y-3 text-xs leading-6">
|
||||
<p v-if="error" class="text-danger" role="alert">{{ error }}</p>
|
||||
<p v-if="loading" role="status" class="text-muted">正在核对当前镜头记录…</p>
|
||||
<p v-else-if="noRecords" class="text-muted">暂无修订或 AI 诊断记录。</p>
|
||||
<section v-if="readiness" class="space-y-2" aria-label="当前诊断修订条件">
|
||||
<p>{{ repairEligible ? '已满足人工修订的前提,仍需人工核对完整动作。' : '当前暂不能按这份诊断修订镜头。' }}</p>
|
||||
<p v-for="reason in readiness.blockingReasons" :key="reason" class="text-muted">{{ diagnosisReason(reason) }}</p>
|
||||
<p v-if="repairEligible" class="text-muted">可点击“查看并修订动作”,读取当前正式规划后再明确保存。</p>
|
||||
<article v-for="(candidate, index) in readiness.repairCandidates" :key="index" class="space-y-1">
|
||||
<p>阶段 {{ candidate.phaseNo }} · {{ candidate.characterRef }}</p><p>{{ userFacingText(candidate.suggestion) }}</p>
|
||||
</article>
|
||||
</section>
|
||||
<section v-if="revisions?.revisions.length" class="space-y-3" aria-label="正式修订历史">
|
||||
<p class="font-medium">正式修订 · {{ revisions.count }} 条</p>
|
||||
<article v-for="record in revisions.revisions" :key="record.id" class="space-y-1"><p class="text-muted">{{ formatDate(record.createdAt) }}</p><p>{{ record.reason }}</p></article>
|
||||
</section>
|
||||
<section v-if="history?.revisions.length" class="space-y-3" aria-label="诊断历史">
|
||||
<p class="font-medium">AI 诊断 · {{ history.count }} 条</p>
|
||||
<article v-for="record in history.revisions" :key="record.id" class="space-y-1">
|
||||
<p>{{ formatDate(record.createdAt) }} · {{ diagnosisStatusLabels[record.effectiveStatus as keyof typeof diagnosisStatusLabels] || '结果待核对' }}</p>
|
||||
<p class="text-muted">{{ record.shotStale ? '镜头已变化' : '镜头内容一致' }} · {{ record.policyStatus === 'current' ? '规则版本一致' : record.policyStatus === 'stale' ? '规则版本已变化' : '缺少规则版本' }}</p>
|
||||
<RawDataDetails :value="record" title="完整诊断证据(高级)" />
|
||||
</article>
|
||||
</section>
|
||||
</div>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
<NButton
|
||||
size="small"
|
||||
:aria-label="showDetails ? '收起修订条件与历史' : '修订条件与诊断历史'"
|
||||
:title="showDetails ? '收起修订条件与历史' : '修订条件与诊断历史'"
|
||||
:aria-expanded="showDetails"
|
||||
@click="expanded = showDetails ? [] : ['review']"
|
||||
><template #icon><History :size="15" aria-hidden="true" /></template
|
||||
><span class="diagnosis-action-label">{{
|
||||
showDetails ? '收起修订条件与历史' : '修订条件与诊断历史'
|
||||
}}</span></NButton
|
||||
>
|
||||
<!-- 以下是与定位、复查和历史入口同排的刷新操作,不在展开正文另起一组工具。 -->
|
||||
<NButton v-if="showDetails" size="small" :loading="loading" @click="load"
|
||||
><template #icon><RefreshCw :size="14" aria-hidden="true" /></template>刷新记录</NButton
|
||||
>
|
||||
<NCollapse v-show="showDetails" v-model:expanded-names="expanded" class="diagnosis-shot-details">
|
||||
<NCollapseItem name="review" title="修订条件与诊断历史">
|
||||
<div class="space-y-3 text-xs leading-6">
|
||||
<p v-if="error" class="text-danger" role="alert">{{ error }}</p>
|
||||
<p v-if="loading" role="status" class="text-muted">正在核对当前镜头记录…</p>
|
||||
<p v-else-if="noRecords" class="text-muted">暂无修订或 AI 诊断记录。</p>
|
||||
<section v-if="readiness" class="space-y-2" aria-label="当前诊断修订条件">
|
||||
<p>
|
||||
{{
|
||||
repairEligible
|
||||
? '已满足人工修订的前提,仍需人工核对完整动作。'
|
||||
: '当前暂不能按这份诊断修订镜头。'
|
||||
}}
|
||||
</p>
|
||||
<p v-for="reason in readiness.blockingReasons" :key="reason" class="text-muted">
|
||||
{{ diagnosisReason(reason) }}
|
||||
</p>
|
||||
<p v-if="repairEligible" class="text-muted">
|
||||
可点击“查看并修订动作”,读取当前正式规划后再明确保存。
|
||||
</p>
|
||||
<article
|
||||
v-for="(candidate, index) in readiness.repairCandidates"
|
||||
:key="index"
|
||||
class="space-y-1"
|
||||
>
|
||||
<p>阶段 {{ candidate.phaseNo }} · {{ candidate.characterRef }}</p>
|
||||
<p>{{ userFacingText(candidate.suggestion) }}</p>
|
||||
</article>
|
||||
</section>
|
||||
<section v-if="revisions?.revisions.length" class="space-y-3" aria-label="正式修订历史">
|
||||
<p class="font-medium">正式修订 · {{ revisions.count }} 条</p>
|
||||
<article v-for="record in revisions.revisions" :key="record.id" class="space-y-1">
|
||||
<p class="text-muted">{{ formatDate(record.createdAt) }}</p>
|
||||
<p>{{ record.reason }}</p>
|
||||
</article>
|
||||
</section>
|
||||
<section v-if="history?.revisions.length" class="space-y-3" aria-label="诊断历史">
|
||||
<p class="font-medium">AI 诊断 · {{ history.count }} 条</p>
|
||||
<article v-for="record in history.revisions" :key="record.id" class="space-y-1">
|
||||
<p>
|
||||
{{ formatDate(record.createdAt) }} ·
|
||||
{{
|
||||
diagnosisStatusLabels[
|
||||
record.effectiveStatus as keyof typeof diagnosisStatusLabels
|
||||
] || '结果待核对'
|
||||
}}
|
||||
</p>
|
||||
<p class="text-muted">
|
||||
{{ record.shotStale ? '镜头已变化' : '镜头内容一致' }} ·
|
||||
{{
|
||||
record.policyStatus === 'current'
|
||||
? '规则版本一致'
|
||||
: record.policyStatus === 'stale'
|
||||
? '规则版本已变化'
|
||||
: '缺少规则版本'
|
||||
}}
|
||||
</p>
|
||||
<RawDataDetails :value="record" title="完整诊断证据(高级)" />
|
||||
</article>
|
||||
</section>
|
||||
</div>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.diagnosis-shot-tools { display: contents; }
|
||||
.diagnosis-shot-tools > .n-button { min-height: 34px; }
|
||||
.diagnosis-shot-tools {
|
||||
display: contents;
|
||||
}
|
||||
.diagnosis-shot-tools > .n-button {
|
||||
min-height: 34px;
|
||||
}
|
||||
/* 展开仍由 Naive 组件管理;入口使用独立可聚焦按钮,避免重复折叠标题。 */
|
||||
.diagnosis-shot-details { flex-basis: 100%; min-width: 0; }
|
||||
.diagnosis-shot-details :deep(.n-collapse-item__header) { display: none; }
|
||||
.diagnosis-shot-details {
|
||||
flex-basis: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
.diagnosis-shot-details :deep(.n-collapse-item__header) {
|
||||
display: none;
|
||||
}
|
||||
/* 隐藏默认折叠标题后清除两层顶部留白,正文与卡片操作共用间距。 */
|
||||
.diagnosis-shot-details :deep(.n-collapse-item__content-wrapper),
|
||||
.diagnosis-shot-details :deep(.n-collapse-item__content-inner) { padding-top: 0; }
|
||||
.diagnosis-shot-details :deep(.n-collapse-item__content-inner) {
|
||||
padding-top: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -123,7 +123,13 @@ function updateTransition(resource: ResourceOccupancy, value: 'release' | 'trans
|
||||
:disabled="disabled"
|
||||
/></NFormItem>
|
||||
<NCheckbox v-model:checked="action.mustPerformInShot" :disabled="disabled">本镜必须完成</NCheckbox>
|
||||
<NButton class="icon-button" :aria-label="`移除动作 ${index + 1}`" :disabled="disabled" @click="draft.requiredActions.splice(index, 1)"><template #icon><Trash2 :size="16" /></template></NButton>
|
||||
<NButton
|
||||
class="icon-button"
|
||||
:aria-label="`移除动作 ${index + 1}`"
|
||||
:disabled="disabled"
|
||||
@click="draft.requiredActions.splice(index, 1)"
|
||||
><template #icon><Trash2 :size="16" /></template
|
||||
></NButton>
|
||||
</div>
|
||||
</section>
|
||||
<!-- 以下是动作阶段编辑模块,同阶段动作视为同时发生 -->
|
||||
@@ -143,7 +149,13 @@ function updateTransition(resource: ResourceOccupancy, value: 'release' | 'trans
|
||||
>
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h4 class="text-sm">阶段 {{ index + 1 }}</h4>
|
||||
<NButton class="icon-button" :aria-label="`移除阶段 ${index + 1}`" :disabled="disabled" @click="draft.durationPlanning.phases.splice(index, 1)"><template #icon><Trash2 :size="16" /></template></NButton>
|
||||
<NButton
|
||||
class="icon-button"
|
||||
:aria-label="`移除阶段 ${index + 1}`"
|
||||
:disabled="disabled"
|
||||
@click="draft.durationPlanning.phases.splice(index, 1)"
|
||||
><template #icon><Trash2 :size="16" /></template
|
||||
></NButton>
|
||||
</div>
|
||||
<NFormItem label="阶段描述"
|
||||
><NInput v-model:value="phase.action" :aria-label="`阶段 ${index + 1} 描述`" :disabled="disabled"
|
||||
@@ -199,7 +211,13 @@ function updateTransition(resource: ResourceOccupancy, value: 'release' | 'trans
|
||||
:disabled="disabled"
|
||||
/></NFormItem>
|
||||
<NCheckbox v-model:checked="hand.shareable" :disabled="disabled">可共享</NCheckbox>
|
||||
<NButton class="icon-button" :aria-label="`移除阶段 ${index + 1} 手部证据 ${handIndex + 1}`" :disabled="disabled" @click="phase.handOccupancy?.splice(handIndex, 1)"><template #icon><Trash2 :size="16" /></template></NButton>
|
||||
<NButton
|
||||
class="icon-button"
|
||||
:aria-label="`移除阶段 ${index + 1} 手部证据 ${handIndex + 1}`"
|
||||
:disabled="disabled"
|
||||
@click="phase.handOccupancy?.splice(handIndex, 1)"
|
||||
><template #icon><Trash2 :size="16" /></template
|
||||
></NButton>
|
||||
</div>
|
||||
<div
|
||||
v-for="(resource, resourceIndex) in phase.resourceOccupancy"
|
||||
@@ -235,9 +253,32 @@ function updateTransition(resource: ResourceOccupancy, value: 'release' | 'trans
|
||||
:disabled="disabled"
|
||||
/></NFormItem>
|
||||
<NCheckbox v-model:checked="resource.shareable" :disabled="disabled">可共享</NCheckbox>
|
||||
<NFormItem label="持续对象" :show-feedback="false"><NInput :value="resource.continuityRef || ''" placeholder="仅填写已有明确对象引用" :disabled="disabled" @update:value="updateContinuity(resource, $event)" /></NFormItem>
|
||||
<NFormItem label="释放或交接" :show-feedback="false"><NSelect :value="resource.transition ?? null" clearable :options="[{ label: '明确释放', value: 'release' }, { label: '明确交接', value: 'transfer' }]" placeholder="未声明" :disabled="disabled" @update:value="updateTransition(resource, $event)" /></NFormItem>
|
||||
<NButton class="icon-button" :aria-label="`移除阶段 ${index + 1} 资源证据 ${resourceIndex + 1}`" :disabled="disabled" @click="phase.resourceOccupancy?.splice(resourceIndex, 1)"><template #icon><Trash2 :size="16" /></template></NButton>
|
||||
<NFormItem label="持续对象" :show-feedback="false"
|
||||
><NInput
|
||||
:value="resource.continuityRef || ''"
|
||||
placeholder="仅填写已有明确对象引用"
|
||||
:disabled="disabled"
|
||||
@update:value="updateContinuity(resource, $event)"
|
||||
/></NFormItem>
|
||||
<NFormItem label="释放或交接" :show-feedback="false"
|
||||
><NSelect
|
||||
:value="resource.transition ?? null"
|
||||
clearable
|
||||
:options="[
|
||||
{ label: '明确释放', value: 'release' },
|
||||
{ label: '明确交接', value: 'transfer' }
|
||||
]"
|
||||
placeholder="未声明"
|
||||
:disabled="disabled"
|
||||
@update:value="updateTransition(resource, $event)"
|
||||
/></NFormItem>
|
||||
<NButton
|
||||
class="icon-button"
|
||||
:aria-label="`移除阶段 ${index + 1} 资源证据 ${resourceIndex + 1}`"
|
||||
:disabled="disabled"
|
||||
@click="phase.resourceOccupancy?.splice(resourceIndex, 1)"
|
||||
><template #icon><Trash2 :size="16" /></template
|
||||
></NButton>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
@@ -3,7 +3,19 @@ import { computed, inject, onScopeDispose, ref, watch } from 'vue'
|
||||
import { NButton, NCollapse, NCollapseItem, NInputNumber, NSelect, NSpin, NTag } from 'naive-ui'
|
||||
import { RefreshCw, ScanLine, MapPin, RotateCcw, Wrench, CircleCheck, CircleAlert } from '@lucide/vue'
|
||||
import { breakdownApi } from '../api'
|
||||
import { diagnosisInput, diagnosisStatusLabels, scopeDiagnosisShots, summarizeDiagnosis, diagnosisHasAttention, diagnosisOptionalReview, diagnosisAuditLabel, diagnosisAuditHasProblem, diagnosisCanStart, diagnosisReason, bodyDimensionLabels } from '../diagnosis'
|
||||
import {
|
||||
diagnosisInput,
|
||||
diagnosisStatusLabels,
|
||||
scopeDiagnosisShots,
|
||||
summarizeDiagnosis,
|
||||
diagnosisHasAttention,
|
||||
diagnosisOptionalReview,
|
||||
diagnosisAuditLabel,
|
||||
diagnosisAuditHasProblem,
|
||||
diagnosisCanStart,
|
||||
diagnosisReason,
|
||||
bodyDimensionLabels
|
||||
} from '../diagnosis'
|
||||
import type { DiagnosisLocation, DiagnosisScope } from '../diagnosis'
|
||||
import type {
|
||||
LegacyActionDiagnosisPreview,
|
||||
@@ -51,7 +63,10 @@ const dialogOpen = ref(false)
|
||||
/** 首批诊断数据完成前保留固定加载区域,不渲染会闪现的空结果。 */
|
||||
const dialogDataReady = ref(false)
|
||||
/** 等待弹窗离场后再转移焦点,避免焦点陷阱把定位焦点拉回。 */
|
||||
const pendingLocation = ref<{ /** 正式镜头坐标。 */ location: DiagnosisLocation; /** 当前有明确问题。 */ problem: boolean } | null>(null)
|
||||
const pendingLocation = ref<{
|
||||
/** 正式镜头坐标。 */ location: DiagnosisLocation
|
||||
/** 当前有明确问题。 */ problem: boolean
|
||||
} | null>(null)
|
||||
/** 等诊断抽屉离场后打开正式动作修订,不叠加主界面。 */
|
||||
const pendingRepair = ref<PreparationIssue | null>(null)
|
||||
/** 已交接到正式修订的真实目标。 */
|
||||
@@ -141,9 +156,7 @@ const visibleShots = computed(() =>
|
||||
scopedShots.value.filter(
|
||||
shot =>
|
||||
resultFilter.value === 'all' ||
|
||||
(resultFilter.value === 'review'
|
||||
? diagnosisOptionalReview(shot)
|
||||
: diagnosisHasAttention(shot))
|
||||
(resultFilter.value === 'review' ? diagnosisOptionalReview(shot) : diagnosisHasAttention(shot))
|
||||
)
|
||||
)
|
||||
|
||||
@@ -158,7 +171,9 @@ async function readCurrentReview(projectId: string): Promise<boolean | null> {
|
||||
await projectContext.refreshStageReadiness()
|
||||
const state = projectContext.stageReadiness.value
|
||||
return state?.projectId === projectId ? state.breakdown.ready === true : null
|
||||
} catch { return null }
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
/** 预览展示范围内的实际镜头总数,不把待补证据数量冒充付费数量。 */
|
||||
const previewCount = computed(() => previews.value?.reduce((sum, item) => sum + item.candidateCount, 0) ?? 0)
|
||||
@@ -177,7 +192,8 @@ const canStart = computed(
|
||||
!previewBusy.value &&
|
||||
!execution.active.value &&
|
||||
!starting.value &&
|
||||
(scope.value.kind !== 'shot' || diagnosisCanStart(preflight.value, props.projectId, previews.value?.[0]?.candidates[0]?.shotId ?? ''))
|
||||
(scope.value.kind !== 'shot' ||
|
||||
diagnosisCanStart(preflight.value, props.projectId, previews.value?.[0]?.candidates[0]?.shotId ?? ''))
|
||||
)
|
||||
/** 费用确认使用当前预览范围及并发,不虚构模型价格。 */
|
||||
const confirmation = computed(
|
||||
@@ -187,7 +203,12 @@ const confirmation = computed(
|
||||
/** 当前正式检查结果复用导航的权威状态,不使用独立 AI 记录数量推测审核结论。 */
|
||||
const formalReviewState = computed(() => {
|
||||
const state = projectContext?.stageReadiness.value
|
||||
if (projectContext?.error.value || projectContext?.project.value?.id !== props.projectId || state?.projectId !== props.projectId) return null
|
||||
if (
|
||||
projectContext?.error.value ||
|
||||
projectContext?.project.value?.id !== props.projectId ||
|
||||
state?.projectId !== props.projectId
|
||||
)
|
||||
return null
|
||||
return state.breakdown.ready === true
|
||||
})
|
||||
/** 顶部优先显示实际问题与正式审核结果,独立 AI 记录仅使用中性的可选检查说明。 */
|
||||
@@ -281,10 +302,17 @@ async function loadPreview() {
|
||||
if (version !== previewVersion) return
|
||||
if (target.kind === 'shot') {
|
||||
const candidate = data[0]?.candidates[0]
|
||||
if (!candidate || data.length !== 1 || data[0]!.candidates.length !== 1) throw new Error('未取得唯一的正式镜头,请刷新结果。')
|
||||
if (!candidate || data.length !== 1 || data[0]!.candidates.length !== 1)
|
||||
throw new Error('未取得唯一的正式镜头,请刷新结果。')
|
||||
const checked = await breakdownApi.diagnosisPreflight(id, candidate.shotId)
|
||||
if (version !== previewVersion) return
|
||||
if (checked.projectId !== id || checked.shotId !== candidate.shotId || checked.episodeNo !== target.episodeNo || checked.beatNo !== target.beatNo || checked.shotNo !== target.shotNo)
|
||||
if (
|
||||
checked.projectId !== id ||
|
||||
checked.shotId !== candidate.shotId ||
|
||||
checked.episodeNo !== target.episodeNo ||
|
||||
checked.beatNo !== target.beatNo ||
|
||||
checked.shotNo !== target.shotNo
|
||||
)
|
||||
throw new Error('检查结果与当前镜头不一致,请重新预览。')
|
||||
preflight.value = checked
|
||||
}
|
||||
@@ -395,14 +423,25 @@ function open(location?: DiagnosisLocation) {
|
||||
* @param problem 是否存在当前明确的问题
|
||||
*/
|
||||
function locate(location: DiagnosisLocation, problem = false) {
|
||||
pendingLocation.value = { location: { episodeNo: location.episodeNo, beatNo: location.beatNo, shotNo: location.shotNo }, problem }
|
||||
pendingLocation.value = {
|
||||
location: { episodeNo: location.episodeNo, beatNo: location.beatNo, shotNo: location.shotNo },
|
||||
problem
|
||||
}
|
||||
dialogOpen.value = false
|
||||
}
|
||||
|
||||
/** 弹窗关闭动画结束后定位镜头,键盘焦点与正文高亮保持一致。 */
|
||||
function finishLocate() {
|
||||
if (pendingLocation.value) { const target = pendingLocation.value; pendingLocation.value = null; emit('locate', target.location, target.problem) }
|
||||
if (pendingRepair.value) { repairTarget.value = pendingRepair.value; pendingRepair.value = null; repairOpen.value = true }
|
||||
if (pendingLocation.value) {
|
||||
const target = pendingLocation.value
|
||||
pendingLocation.value = null
|
||||
emit('locate', target.location, target.problem)
|
||||
}
|
||||
if (pendingRepair.value) {
|
||||
repairTarget.value = pendingRepair.value
|
||||
pendingRepair.value = null
|
||||
repairOpen.value = true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -412,7 +451,13 @@ function finishLocate() {
|
||||
function requestRepair(item: LegacyActionDiagnosisResults['shots'][number]) {
|
||||
if (!dialogOpen.value || starting.value || execution.active.value) return
|
||||
pendingLocation.value = null
|
||||
pendingRepair.value = { episodeNo: item.episodeNo, beatNo: item.beatNo, shotNo: item.shotNo, shotId: item.shotId, message: `核对当前正式镜头:${item.title}` }
|
||||
pendingRepair.value = {
|
||||
episodeNo: item.episodeNo,
|
||||
beatNo: item.beatNo,
|
||||
shotNo: item.shotNo,
|
||||
shotId: item.shotId,
|
||||
message: `核对当前正式镜头:${item.title}`
|
||||
}
|
||||
dialogOpen.value = false
|
||||
}
|
||||
|
||||
@@ -430,17 +475,28 @@ async function startDiagnosis() {
|
||||
if (!previous) return
|
||||
const checked = await breakdownApi.diagnosisPreflight(id, previous.shotId)
|
||||
if (version !== previewVersion || !dialogOpen.value || !diagnosisCanStart(checked, id, previous.shotId)) {
|
||||
if (version === previewVersion) { preflight.value = checked; void loadResults() }
|
||||
if (version === previewVersion) {
|
||||
preflight.value = checked
|
||||
void loadResults()
|
||||
}
|
||||
return
|
||||
}
|
||||
const latestPreview = await breakdownApi.legacyActionDiagnosisPreview(id, target.episodeNo, target.beatNo, target.shotNo)
|
||||
const latestPreview = await breakdownApi.legacyActionDiagnosisPreview(
|
||||
id,
|
||||
target.episodeNo,
|
||||
target.beatNo,
|
||||
target.shotNo
|
||||
)
|
||||
if (version !== previewVersion || !dialogOpen.value) return
|
||||
if (JSON.stringify(latestPreview.candidates) !== JSON.stringify(previews.value?.[0]?.candidates)) {
|
||||
previews.value = null
|
||||
throw new Error('镜头内容已变化,请重新预览后确认诊断。')
|
||||
}
|
||||
preflight.value = checked
|
||||
if (checked.policyRevision !== previous.policyRevision || checked.policyFingerprint !== previous.policyFingerprint) {
|
||||
if (
|
||||
checked.policyRevision !== previous.policyRevision ||
|
||||
checked.policyFingerprint !== previous.policyFingerprint
|
||||
) {
|
||||
previews.value = null
|
||||
throw new Error('诊断使用的质量规则已变化,请重新预览后确认。')
|
||||
}
|
||||
@@ -539,7 +595,14 @@ defineExpose({ open })
|
||||
>
|
||||
<NTag v-if="execution.active.value" type="info" size="small" :bordered="false">诊断中</NTag>
|
||||
</div>
|
||||
<NButton text size="small" class="diagnosis-summary-trigger" :disabled="!projectId" aria-haspopup="dialog" :aria-expanded="dialogOpen" @click="open()"
|
||||
<NButton
|
||||
text
|
||||
size="small"
|
||||
class="diagnosis-summary-trigger"
|
||||
:disabled="!projectId"
|
||||
aria-haspopup="dialog"
|
||||
:aria-expanded="dialogOpen"
|
||||
@click="open()"
|
||||
>查看诊断</NButton
|
||||
>
|
||||
</div>
|
||||
@@ -556,7 +619,10 @@ defineExpose({ open })
|
||||
<div v-if="dialogDataReady" class="diagnosis-dialog-content">
|
||||
<!-- 以下是当前范围模块,剧集编号始终与阅读列表一致 -->
|
||||
<section class="diagnosis-section diagnosis-scope-bar" aria-label="诊断范围">
|
||||
<div class="diagnosis-scope-heading"><h3>诊断范围</h3><span class="text-xs text-muted">{{ scopeLabel }}</span></div>
|
||||
<div class="diagnosis-scope-heading">
|
||||
<h3>诊断范围</h3>
|
||||
<span class="text-xs text-muted">{{ scopeLabel }}</span>
|
||||
</div>
|
||||
<div class="diagnosis-scope-controls">
|
||||
<NButton
|
||||
size="small"
|
||||
@@ -575,232 +641,404 @@ defineExpose({ open })
|
||||
</section>
|
||||
<!-- 以下是上下排列的检查结果与可选复查,两个区域统一底色与内边距 -->
|
||||
<div class="diagnosis-workspace">
|
||||
<div class="diagnosis-results-column">
|
||||
<!-- 以下是诊断结果模块,默认隐藏未诊断长列表 -->
|
||||
<section class="diagnosis-section">
|
||||
<div class="diagnosis-section-heading">
|
||||
<h3>检查结果</h3>
|
||||
<!-- 刷新图标始终占位,加载前后按钮和标题行保持同一尺寸 -->
|
||||
<NButton
|
||||
text
|
||||
size="small"
|
||||
class="diagnosis-refresh-button"
|
||||
:loading="resultsBusy"
|
||||
@click="loadResults"
|
||||
>
|
||||
<template #icon><RefreshCw :size="14" aria-hidden="true" /></template>
|
||||
刷新结果
|
||||
</NButton>
|
||||
</div>
|
||||
<p v-if="resultsError" class="text-danger" role="alert">{{ resultsError }}</p>
|
||||
<template v-else-if="results">
|
||||
<!-- 以下是面向日常操作的结论摘要,正式审核通过且没有实际问题时使用成功底色 -->
|
||||
<div class="diagnosis-result-overview" :class="{ 'problem-surface': repairCount > 0, 'diagnosis-result-success': reviewed === true && counts.total > 0 && repairCount === 0 }">
|
||||
<CircleAlert v-if="repairCount" :size="20" class="text-danger" aria-hidden="true" />
|
||||
<CircleCheck v-else-if="reviewed === true && counts.total" :size="20" class="text-(--app-success)" aria-hidden="true" />
|
||||
<ScanLine v-else :size="20" class="text-muted" aria-hidden="true" />
|
||||
<div class="min-w-0 space-y-1">
|
||||
<p class="font-medium">{{ !counts.total ? '当前范围尚无镜头' : repairCount ? `有 ${repairCount} 个镜头需要处理` : '当前范围没有需要修复的镜头' }}</p>
|
||||
<p class="text-xs text-muted">{{ scopeLabel }} · 共 {{ counts.total }} 个镜头</p>
|
||||
<p v-if="reviewed === true" class="text-xs text-muted">当前正式分镜已审核通过,AI 复查可按需进行。</p>
|
||||
<p v-else-if="reviewed === false" class="text-xs text-muted">正式分镜检查待确认,请查看制作前检查。</p>
|
||||
<div class="diagnosis-results-column">
|
||||
<!-- 以下是诊断结果模块,默认隐藏未诊断长列表 -->
|
||||
<section class="diagnosis-section">
|
||||
<div class="diagnosis-section-heading">
|
||||
<h3>检查结果</h3>
|
||||
<!-- 刷新图标始终占位,加载前后按钮和标题行保持同一尺寸 -->
|
||||
<NButton
|
||||
text
|
||||
size="small"
|
||||
class="diagnosis-refresh-button"
|
||||
:loading="resultsBusy"
|
||||
@click="loadResults"
|
||||
>
|
||||
<template #icon><RefreshCw :size="14" aria-hidden="true" /></template>
|
||||
刷新结果
|
||||
</NButton>
|
||||
</div>
|
||||
</div>
|
||||
<div class="diagnosis-results-toolbar">
|
||||
<span class="text-xs text-muted">查看镜头</span>
|
||||
<NSelect
|
||||
v-model:value="resultFilter"
|
||||
aria-label="筛选诊断结果"
|
||||
size="small"
|
||||
class="diagnosis-result-filter"
|
||||
:options="[
|
||||
{ label: `需处理:实际问题(${repairCount})`, value: 'attention' },
|
||||
{ label: `可选 AI 复查(${optionalReviewCount})`, value: 'review' },
|
||||
{ label: `全部镜头(${counts.total})`, value: 'all' }
|
||||
]"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="!visibleShots.length" class="diagnosis-empty">
|
||||
<p>
|
||||
{{
|
||||
counts.total === 0
|
||||
? '当前范围尚无镜头。'
|
||||
: resultFilter === 'attention'
|
||||
? reviewed === true ? '额外检查可按需进行,无需为继续制作重复运行。' : '这里只展示已检出的问题,额外 AI 复查可按需进行。'
|
||||
: resultFilter === 'review'
|
||||
? '当前没有可选复查记录。'
|
||||
: '当前筛选下没有镜头。'
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
v-if="visibleShots.length"
|
||||
class="diagnosis-result-list"
|
||||
tabindex="0"
|
||||
aria-label="镜头诊断列表"
|
||||
>
|
||||
<article v-for="item in visibleShots" :key="item.shotId" class="diagnosis-result-item" :class="{ 'problem-surface': diagnosisHasAttention(item) }">
|
||||
<div class="diagnosis-section-heading">
|
||||
<span class="text-xs text-muted"
|
||||
>第 {{ item.episodeNo }} 集 / 节拍 {{ item.beatNo }} / 镜头
|
||||
{{ item.shotNo }}</span
|
||||
>
|
||||
<NTag
|
||||
:type="
|
||||
diagnosisHasAttention(item)
|
||||
? 'error'
|
||||
: item.status === 'no_conflict_found' && !diagnosisHasAttention(item)
|
||||
? 'success'
|
||||
: 'default'
|
||||
"
|
||||
size="small"
|
||||
:bordered="false"
|
||||
>{{ diagnosisStatusLabels[item.status] }}</NTag
|
||||
>
|
||||
</div>
|
||||
<p class="font-medium">{{ item.title }}</p>
|
||||
<p
|
||||
v-for="(description, index) in issueDescriptions(item.issues)"
|
||||
:key="index"
|
||||
class="text-muted"
|
||||
<p v-if="resultsError" class="text-danger" role="alert">{{ resultsError }}</p>
|
||||
<template v-else-if="results">
|
||||
<!-- 以下是面向日常操作的结论摘要,正式审核通过且没有实际问题时使用成功底色 -->
|
||||
<div
|
||||
class="diagnosis-result-overview"
|
||||
:class="{
|
||||
'problem-surface': repairCount > 0,
|
||||
'diagnosis-result-success':
|
||||
reviewed === true && counts.total > 0 && repairCount === 0
|
||||
}"
|
||||
>
|
||||
{{ userFacingText(description) }}
|
||||
</p>
|
||||
<!-- 以下是修订状态、局部手部检查与 AI 全身疑点,结论各自保留 -->
|
||||
<p v-if="item.repairStatus === 'repaired' && reviewed === true && !diagnosisHasAttention(item)" class="text-xs text-muted">已修订并审核通过,AI 复查可选。</p>
|
||||
<p v-else-if="item.requiresPostRepairDiagnosis" class="text-xs text-muted">镜头已修订,可按需进行 AI 复查。</p>
|
||||
<p v-else-if="item.repairStatus === 'repaired'" class="text-xs text-muted">镜头已修订,已有当前版本 AI 诊断</p>
|
||||
<p v-else-if="item.repairStatus === 'repair_history_stale'" class="text-xs text-muted">此前修订记录已过期</p>
|
||||
<p v-if="item.shotStale" class="text-xs text-muted">镜头内容已变化,旧诊断不作为当前结论。</p>
|
||||
<p v-if="item.policyStatus === 'stale'" class="text-xs text-muted">质量规则已变化,需要重新核对。</p>
|
||||
<p v-else-if="item.policyStatus === 'unknown'" class="text-xs text-muted">旧诊断没有完整的质量规则记录。</p>
|
||||
<div v-if="item.resourceAudit && diagnosisAuditHasProblem(item.resourceAudit)" class="space-y-1 text-xs text-muted"><p>{{ diagnosisAuditLabel(item.resourceAudit) }}<template v-if="item.resourceAudit.expectedActionCount > 0"> · 已覆盖 {{ item.resourceAudit.coveredActionCount }} / {{ item.resourceAudit.expectedActionCount }} 个动作</template></p></div>
|
||||
<div v-else-if="!item.resourceAudit && item.handAudit && diagnosisAuditHasProblem(item.handAudit)" class="space-y-1 text-xs text-muted">
|
||||
<p>{{ diagnosisAuditLabel(item.handAudit, true) }}<template v-if="item.handAudit.expectedActionCount > 0"> · 手部动作证据 {{ item.handAudit.coveredActionCount }} / {{ item.handAudit.expectedActionCount }}</template></p>
|
||||
|
||||
</div>
|
||||
<article v-for="(finding, index) in item.bodyMotionFindings" :key="index" class="space-y-1 text-xs">
|
||||
<p>{{ bodyDimensionLabels[finding.dimension] || '其他动作' }} · {{ finding.status === 'conflict' ? '发现冲突' : finding.status === 'needs_review' ? '需要复核' : '证据不足' }}</p>
|
||||
<p>{{ userFacingText(finding.description) }}</p><p class="text-muted">原文:{{ finding.quote }}</p>
|
||||
</article>
|
||||
<!-- 以下是明确的卡片操作区,按钮有独立底面和图标,不与说明混在一起 -->
|
||||
<div class="diagnosis-card-actions workspace-action-group">
|
||||
<NButton size="small" aria-label="定位镜头" title="定位镜头" @click="locate(item, diagnosisHasAttention(item))"><template #icon><MapPin :size="15" aria-hidden="true" /></template><span class="diagnosis-action-label">定位镜头</span></NButton>
|
||||
<NButton v-if="diagnosisOptionalReview(item) || diagnosisHasAttention(item)" size="small" aria-label="可选 AI 复查" title="可选 AI 复查" :disabled="starting || execution.active.value" @click="open(item)"><template #icon><RotateCcw :size="15" aria-hidden="true" /></template><span class="diagnosis-action-label">可选 AI 复查</span></NButton>
|
||||
<NButton v-if="diagnosisHasAttention(item)" size="small" aria-label="查看并修订动作" title="查看并修订动作" :disabled="starting || execution.active.value" @click="requestRepair(item)"><template #icon><Wrench :size="15" aria-hidden="true" /></template><span class="diagnosis-action-label">查看并修订动作</span></NButton>
|
||||
<DiagnosisShotDetails :project-id="projectId" :shot="item" />
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</template>
|
||||
<p v-else class="text-muted">{{ resultsBusy ? '正在读取当前范围结果…' : '尚未读取结果' }}</p>
|
||||
</section>
|
||||
<!-- 以下是实际检出的手部冲突,普通区域仅展示明确问题,不因缺少记录提示修复。 -->
|
||||
<section v-if="!handError && handDiagnostics?.diagnostics.length" class="diagnosis-section">
|
||||
<h3>动作检查发现的问题 · 全项目</h3>
|
||||
<article
|
||||
v-for="(issue, index) in handDiagnostics.diagnostics"
|
||||
:key="index"
|
||||
class="diagnosis-result-item problem-surface mt-3"
|
||||
>
|
||||
<p class="text-xs text-muted">
|
||||
第 {{ issue.episodeNo }} 集 / 节拍 {{ issue.beatNo }} / 镜头
|
||||
{{ issue.shotNo }} / 阶段
|
||||
{{ issue.phaseNo }}
|
||||
</p>
|
||||
<p>{{ issue.suggestion }}</p>
|
||||
<div class="diagnosis-scope-controls">
|
||||
<NButton text size="small" @click="locate(issue, true)">定位镜头</NButton>
|
||||
<NButton
|
||||
text
|
||||
size="small"
|
||||
:loading="repairBusy && repairIssue === index"
|
||||
@click="showRepair(index)"
|
||||
>{{ repairIssue === index ? '收起修复建议' : '查看修复建议' }}</NButton
|
||||
>
|
||||
</div>
|
||||
<div v-if="repairIssue === index && repairPreview" class="diagnosis-repair">
|
||||
<div v-for="(repair, repairIndex) in repairsFor(issue)" :key="repairIndex">
|
||||
<p>{{ repair.suggestion }}</p>
|
||||
<p v-if="repair.blockingReasons.length" class="text-xs text-muted">
|
||||
{{ repair.blockingReasons.join(';') }}
|
||||
</p>
|
||||
</div>
|
||||
<p v-if="!repairsFor(issue).length" class="text-muted">
|
||||
当前没有可用修复建议。
|
||||
<CircleAlert
|
||||
v-if="repairCount"
|
||||
:size="20"
|
||||
class="text-danger"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<CircleCheck
|
||||
v-else-if="reviewed === true && counts.total"
|
||||
:size="20"
|
||||
class="text-(--app-success)"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<ScanLine v-else :size="20" class="text-muted" aria-hidden="true" />
|
||||
<div class="min-w-0 space-y-1">
|
||||
<p class="font-medium">
|
||||
{{
|
||||
!counts.total
|
||||
? '当前范围尚无镜头'
|
||||
: repairCount
|
||||
? `有 ${repairCount} 个镜头需要处理`
|
||||
: '当前范围没有需要修复的镜头'
|
||||
}}
|
||||
</p>
|
||||
<p class="text-xs text-muted">
|
||||
{{ scopeLabel }} · 共 {{ counts.total }} 个镜头
|
||||
</p>
|
||||
<p v-if="reviewed === true" class="text-xs text-muted">
|
||||
当前正式分镜已审核通过,AI 复查可按需进行。
|
||||
</p>
|
||||
<p v-else-if="reviewed === false" class="text-xs text-muted">
|
||||
正式分镜检查待确认,请查看制作前检查。
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
<!-- 以下是合并的高级检查详情,全项目覆盖与当前预览均默认收起。 -->
|
||||
<section class="diagnosis-section">
|
||||
<NCollapse class="diagnosis-evidence-collapse" :default-expanded-names="[]">
|
||||
<NCollapseItem name="advanced-checks">
|
||||
<template #header><span class="diagnosis-evidence-title">高级检查详情</span></template>
|
||||
<template #header-extra="{ collapsed }">
|
||||
<NButton v-if="!collapsed" text size="small" class="diagnosis-refresh-button" :loading="handBusy" @click.stop="loadHandDiagnostics">
|
||||
<template #icon><RefreshCw :size="14" aria-hidden="true" /></template>刷新校验
|
||||
</NButton>
|
||||
</div>
|
||||
<div class="diagnosis-results-toolbar">
|
||||
<span class="text-xs text-muted">查看镜头</span>
|
||||
<NSelect
|
||||
v-model:value="resultFilter"
|
||||
aria-label="筛选诊断结果"
|
||||
size="small"
|
||||
class="diagnosis-result-filter"
|
||||
:options="[
|
||||
{ label: `需处理:实际问题(${repairCount})`, value: 'attention' },
|
||||
{ label: `可选 AI 复查(${optionalReviewCount})`, value: 'review' },
|
||||
{ label: `全部镜头(${counts.total})`, value: 'all' }
|
||||
]"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="!visibleShots.length" class="diagnosis-empty">
|
||||
<p>
|
||||
{{
|
||||
counts.total === 0
|
||||
? '当前范围尚无镜头。'
|
||||
: resultFilter === 'attention'
|
||||
? reviewed === true
|
||||
? '额外检查可按需进行,无需为继续制作重复运行。'
|
||||
: '这里只展示已检出的问题,额外 AI 复查可按需进行。'
|
||||
: resultFilter === 'review'
|
||||
? '当前没有可选复查记录。'
|
||||
: '当前筛选下没有镜头。'
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
v-if="visibleShots.length"
|
||||
class="diagnosis-result-list"
|
||||
tabindex="0"
|
||||
aria-label="镜头诊断列表"
|
||||
>
|
||||
<article
|
||||
v-for="item in visibleShots"
|
||||
:key="item.shotId"
|
||||
class="diagnosis-result-item"
|
||||
:class="{ 'problem-surface': diagnosisHasAttention(item) }"
|
||||
>
|
||||
<div class="diagnosis-section-heading">
|
||||
<span class="text-xs text-muted"
|
||||
>第 {{ item.episodeNo }} 集 / 节拍 {{ item.beatNo }} / 镜头
|
||||
{{ item.shotNo }}</span
|
||||
>
|
||||
<NTag
|
||||
:type="
|
||||
diagnosisHasAttention(item)
|
||||
? 'error'
|
||||
: item.status === 'no_conflict_found' &&
|
||||
!diagnosisHasAttention(item)
|
||||
? 'success'
|
||||
: 'default'
|
||||
"
|
||||
size="small"
|
||||
:bordered="false"
|
||||
>{{ diagnosisStatusLabels[item.status] }}</NTag
|
||||
>
|
||||
</div>
|
||||
<p class="font-medium">{{ item.title }}</p>
|
||||
<p
|
||||
v-for="(description, index) in issueDescriptions(item.issues)"
|
||||
:key="index"
|
||||
class="text-muted"
|
||||
>
|
||||
{{ userFacingText(description) }}
|
||||
</p>
|
||||
<!-- 以下是修订状态、局部手部检查与 AI 全身疑点,结论各自保留 -->
|
||||
<p
|
||||
v-if="
|
||||
item.repairStatus === 'repaired' &&
|
||||
reviewed === true &&
|
||||
!diagnosisHasAttention(item)
|
||||
"
|
||||
class="text-xs text-muted"
|
||||
>
|
||||
已修订并审核通过,AI 复查可选。
|
||||
</p>
|
||||
<p v-else-if="item.requiresPostRepairDiagnosis" class="text-xs text-muted">
|
||||
镜头已修订,可按需进行 AI 复查。
|
||||
</p>
|
||||
<p v-else-if="item.repairStatus === 'repaired'" class="text-xs text-muted">
|
||||
镜头已修订,已有当前版本 AI 诊断
|
||||
</p>
|
||||
<p
|
||||
v-else-if="item.repairStatus === 'repair_history_stale'"
|
||||
class="text-xs text-muted"
|
||||
>
|
||||
此前修订记录已过期
|
||||
</p>
|
||||
<p v-if="item.shotStale" class="text-xs text-muted">
|
||||
镜头内容已变化,旧诊断不作为当前结论。
|
||||
</p>
|
||||
<p v-if="item.policyStatus === 'stale'" class="text-xs text-muted">
|
||||
质量规则已变化,需要重新核对。
|
||||
</p>
|
||||
<p v-else-if="item.policyStatus === 'unknown'" class="text-xs text-muted">
|
||||
旧诊断没有完整的质量规则记录。
|
||||
</p>
|
||||
<div
|
||||
v-if="
|
||||
item.resourceAudit && diagnosisAuditHasProblem(item.resourceAudit)
|
||||
"
|
||||
class="space-y-1 text-xs text-muted"
|
||||
>
|
||||
<p>
|
||||
{{ diagnosisAuditLabel(item.resourceAudit)
|
||||
}}<template v-if="item.resourceAudit.expectedActionCount > 0">
|
||||
· 已覆盖 {{ item.resourceAudit.coveredActionCount }} /
|
||||
{{ item.resourceAudit.expectedActionCount }} 个动作</template
|
||||
>
|
||||
</p>
|
||||
</div>
|
||||
<div
|
||||
v-else-if="
|
||||
!item.resourceAudit &&
|
||||
item.handAudit &&
|
||||
diagnosisAuditHasProblem(item.handAudit)
|
||||
"
|
||||
class="space-y-1 text-xs text-muted"
|
||||
>
|
||||
<p>
|
||||
{{ diagnosisAuditLabel(item.handAudit, true)
|
||||
}}<template v-if="item.handAudit.expectedActionCount > 0">
|
||||
· 手部动作证据 {{ item.handAudit.coveredActionCount }} /
|
||||
{{ item.handAudit.expectedActionCount }}</template
|
||||
>
|
||||
</p>
|
||||
</div>
|
||||
<article
|
||||
v-for="(finding, index) in item.bodyMotionFindings"
|
||||
:key="index"
|
||||
class="space-y-1 text-xs"
|
||||
>
|
||||
<p>
|
||||
{{ bodyDimensionLabels[finding.dimension] || '其他动作' }} ·
|
||||
{{
|
||||
finding.status === 'conflict'
|
||||
? '发现冲突'
|
||||
: finding.status === 'needs_review'
|
||||
? '需要复核'
|
||||
: '证据不足'
|
||||
}}
|
||||
</p>
|
||||
<p>{{ userFacingText(finding.description) }}</p>
|
||||
<p class="text-muted">原文:{{ finding.quote }}</p>
|
||||
</article>
|
||||
<!-- 以下是明确的卡片操作区,按钮有独立底面和图标,不与说明混在一起 -->
|
||||
<div class="diagnosis-card-actions workspace-action-group">
|
||||
<NButton
|
||||
size="small"
|
||||
aria-label="定位镜头"
|
||||
title="定位镜头"
|
||||
@click="locate(item, diagnosisHasAttention(item))"
|
||||
><template #icon><MapPin :size="15" aria-hidden="true" /></template
|
||||
><span class="diagnosis-action-label">定位镜头</span></NButton
|
||||
>
|
||||
<NButton
|
||||
v-if="diagnosisOptionalReview(item) || diagnosisHasAttention(item)"
|
||||
size="small"
|
||||
aria-label="可选 AI 复查"
|
||||
title="可选 AI 复查"
|
||||
:disabled="starting || execution.active.value"
|
||||
@click="open(item)"
|
||||
><template #icon
|
||||
><RotateCcw :size="15" aria-hidden="true" /></template
|
||||
><span class="diagnosis-action-label">可选 AI 复查</span></NButton
|
||||
>
|
||||
<NButton
|
||||
v-if="diagnosisHasAttention(item)"
|
||||
size="small"
|
||||
aria-label="查看并修订动作"
|
||||
title="查看并修订动作"
|
||||
:disabled="starting || execution.active.value"
|
||||
@click="requestRepair(item)"
|
||||
><template #icon><Wrench :size="15" aria-hidden="true" /></template
|
||||
><span class="diagnosis-action-label">查看并修订动作</span></NButton
|
||||
>
|
||||
<DiagnosisShotDetails :project-id="projectId" :shot="item" />
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 以下是紧凑的记录摘要,仅展示有值的分类,重复解释合并为末尾说明 -->
|
||||
<div class="diagnosis-inspection-details text-xs leading-6">
|
||||
<section v-if="results" class="diagnosis-inspection-row">
|
||||
<h4 class="font-medium">AI 复查记录</h4>
|
||||
<div class="diagnosis-counts">
|
||||
<span>本范围 {{ counts.total }} 镜</span><span v-if="counts.conflict" class="text-danger">发现冲突 {{ counts.conflict }} 镜</span>
|
||||
<span v-if="counts.insufficient">依据不足 {{ counts.insufficient }} 镜</span><span v-if="counts.invalid">依据不可用 {{ counts.invalid }} 镜</span>
|
||||
<span v-if="counts.stale">旧记录 {{ counts.stale }} 镜</span><span v-if="counts.pending">暂无记录 {{ counts.pending }} 镜</span><span v-if="counts.clear">未发现冲突 {{ counts.clear }} 镜</span>
|
||||
<p v-else class="text-muted">
|
||||
{{ resultsBusy ? '正在读取当前范围结果…' : '尚未读取结果' }}
|
||||
</p>
|
||||
</section>
|
||||
<!-- 以下是实际检出的手部冲突,普通区域仅展示明确问题,不因缺少记录提示修复。 -->
|
||||
<section v-if="!handError && handDiagnostics?.diagnostics.length" class="diagnosis-section">
|
||||
<h3>动作检查发现的问题 · 全项目</h3>
|
||||
<article
|
||||
v-for="(issue, index) in handDiagnostics.diagnostics"
|
||||
:key="index"
|
||||
class="diagnosis-result-item problem-surface mt-3"
|
||||
>
|
||||
<p class="text-xs text-muted">
|
||||
第 {{ issue.episodeNo }} 集 / 节拍 {{ issue.beatNo }} / 镜头
|
||||
{{ issue.shotNo }} / 阶段
|
||||
{{ issue.phaseNo }}
|
||||
</p>
|
||||
<p>{{ issue.suggestion }}</p>
|
||||
<div class="diagnosis-scope-controls">
|
||||
<NButton text size="small" @click="locate(issue, true)">定位镜头</NButton>
|
||||
<NButton
|
||||
text
|
||||
size="small"
|
||||
:loading="repairBusy && repairIssue === index"
|
||||
@click="showRepair(index)"
|
||||
>{{ repairIssue === index ? '收起修复建议' : '查看修复建议' }}</NButton
|
||||
>
|
||||
</div>
|
||||
<div v-if="repairIssue === index && repairPreview" class="diagnosis-repair">
|
||||
<div v-for="(repair, repairIndex) in repairsFor(issue)" :key="repairIndex">
|
||||
<p>{{ repair.suggestion }}</p>
|
||||
<p v-if="repair.blockingReasons.length" class="text-xs text-muted">
|
||||
{{ repair.blockingReasons.join(';') }}
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
<p v-if="handError" class="text-danger" role="alert">{{ handError }}</p>
|
||||
<section class="diagnosis-inspection-row">
|
||||
<h4 class="font-medium">当前复查范围</h4>
|
||||
<div v-if="previews" class="diagnosis-counts">
|
||||
<span>{{ scopeLabel }} · {{ previewCount }} 个镜头</span>
|
||||
<span v-if="previews.some(item => item.invalidSnapshotCount > 0)" class="text-danger">镜头信息无法读取 {{ previews.reduce((sum, item) => sum + item.invalidSnapshotCount, 0) }} 镜</span>
|
||||
<p v-if="!repairsFor(issue).length" class="text-muted">
|
||||
当前没有可用修复建议。
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
</section>
|
||||
<!-- 以下是合并的高级检查详情,全项目覆盖与当前预览均默认收起。 -->
|
||||
<section class="diagnosis-section">
|
||||
<NCollapse class="diagnosis-evidence-collapse" :default-expanded-names="[]">
|
||||
<NCollapseItem name="advanced-checks">
|
||||
<template #header
|
||||
><span class="diagnosis-evidence-title">高级检查详情</span></template
|
||||
>
|
||||
<template #header-extra="{ collapsed }">
|
||||
<NButton
|
||||
v-if="!collapsed"
|
||||
text
|
||||
size="small"
|
||||
class="diagnosis-refresh-button"
|
||||
:loading="handBusy"
|
||||
@click.stop="loadHandDiagnostics"
|
||||
>
|
||||
<template #icon><RefreshCw :size="14" aria-hidden="true" /></template
|
||||
>刷新校验
|
||||
</NButton>
|
||||
</template>
|
||||
<!-- 以下是紧凑的记录摘要,仅展示有值的分类,重复解释合并为末尾说明 -->
|
||||
<div class="diagnosis-inspection-details text-xs leading-6">
|
||||
<section v-if="results" class="diagnosis-inspection-row">
|
||||
<h4 class="font-medium">AI 复查记录</h4>
|
||||
<div class="diagnosis-counts">
|
||||
<span>本范围 {{ counts.total }} 镜</span
|
||||
><span v-if="counts.conflict" class="text-danger"
|
||||
>发现冲突 {{ counts.conflict }} 镜</span
|
||||
>
|
||||
<span v-if="counts.insufficient"
|
||||
>依据不足 {{ counts.insufficient }} 镜</span
|
||||
><span v-if="counts.invalid"
|
||||
>依据不可用 {{ counts.invalid }} 镜</span
|
||||
>
|
||||
<span v-if="counts.stale">旧记录 {{ counts.stale }} 镜</span
|
||||
><span v-if="counts.pending">暂无记录 {{ counts.pending }} 镜</span
|
||||
><span v-if="counts.clear">未发现冲突 {{ counts.clear }} 镜</span>
|
||||
</div>
|
||||
</section>
|
||||
<p v-if="handError" class="text-danger" role="alert">{{ handError }}</p>
|
||||
<section class="diagnosis-inspection-row">
|
||||
<h4 class="font-medium">当前复查范围</h4>
|
||||
<div v-if="previews" class="diagnosis-counts">
|
||||
<span>{{ scopeLabel }} · {{ previewCount }} 个镜头</span>
|
||||
<span
|
||||
v-if="previews.some(item => item.invalidSnapshotCount > 0)"
|
||||
class="text-danger"
|
||||
>镜头信息无法读取
|
||||
{{
|
||||
previews.reduce(
|
||||
(sum, item) => sum + item.invalidSnapshotCount,
|
||||
0
|
||||
)
|
||||
}}
|
||||
镜</span
|
||||
>
|
||||
</div>
|
||||
<p v-else class="text-muted">尚未预览,可在底部预览范围。</p>
|
||||
</section>
|
||||
<p class="text-muted">
|
||||
仅查看已有记录,不调用
|
||||
AI;未填写记录不代表镜头有误,也不改变正式审核结果。
|
||||
</p>
|
||||
</div>
|
||||
<p v-else class="text-muted">尚未预览,可在底部预览范围。</p>
|
||||
</section>
|
||||
<p class="text-muted">仅查看已有记录,不调用 AI;未填写记录不代表镜头有误,也不改变正式审核结果。</p>
|
||||
</div>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
</section>
|
||||
</div>
|
||||
<!-- 以下是与检查结果采用相同背景和内边距的可选复查模块,执行操作统一保留在弹窗底栏 -->
|
||||
<section class="diagnosis-section diagnosis-review-panel" aria-label="可选 AI 复查设置">
|
||||
<div class="diagnosis-section-heading"><h3>AI 复查</h3><NTag size="small" :bordered="false">可选</NTag></div>
|
||||
<p class="diagnosis-review-description text-sm">需要额外检查动作是否合理时,再运行此项。</p>
|
||||
<p class="text-xs text-muted mt-2">已审核的分镜可继续制作,无需重复复查。</p>
|
||||
<div class="diagnosis-review-scope"><span class="text-xs text-muted">本次复查范围</span><p class="font-medium">{{ scopeLabel }}</p><p class="text-xs text-muted">已有当前版本有效结果的镜头将跳过。</p></div>
|
||||
<!-- 以下是使用 Naive UI 折叠组件的高级设置模块,默认收起 -->
|
||||
<NCollapse class="diagnosis-advanced">
|
||||
<NCollapseItem name="advanced-settings">
|
||||
<template #header><span class="text-xs text-muted">高级设置</span></template>
|
||||
<label class="diagnosis-concurrency"
|
||||
><span>任务并发</span
|
||||
><NInputNumber
|
||||
v-model:value="concurrency"
|
||||
aria-label="诊断任务并发"
|
||||
:min="1"
|
||||
:max="5"
|
||||
:precision="0"
|
||||
size="small"
|
||||
/></label>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
<div v-if="preflight" class="mt-3 space-y-2 text-xs text-muted">
|
||||
<p v-if="preflight.errors.length">可选 AI 复查暂不可用。这不代表当前镜头需要修复。</p>
|
||||
<p v-if="preflight.existingValid">本镜头已有同版本有效诊断,无需重复调用模型。</p>
|
||||
<p v-for="code in preflight.errors" :key="code">{{ diagnosisReason(code) }}</p>
|
||||
<p v-if="preflight.shouldDiagnose">已完成来源预检查,正式诊断仍会再次核对当前版本。</p>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
</section>
|
||||
</div>
|
||||
<p v-if="previewError" class="text-danger" role="alert">{{ previewError }}</p>
|
||||
<p class="text-xs text-muted mt-3">AI 复查会产生模型费用,仅保存检查记录,不修改镜头。请先在底部预览范围,再确认启动。</p>
|
||||
<p v-if="execution.active.value" class="text-xs text-muted mt-3">
|
||||
诊断任务进行中,可关闭弹窗继续查看分镜。
|
||||
</p>
|
||||
</section>
|
||||
<!-- 以下是与检查结果采用相同背景和内边距的可选复查模块,执行操作统一保留在弹窗底栏 -->
|
||||
<section class="diagnosis-section diagnosis-review-panel" aria-label="可选 AI 复查设置">
|
||||
<div class="diagnosis-section-heading">
|
||||
<h3>AI 复查</h3>
|
||||
<NTag size="small" :bordered="false">可选</NTag>
|
||||
</div>
|
||||
<p class="diagnosis-review-description text-sm">需要额外检查动作是否合理时,再运行此项。</p>
|
||||
<p class="text-xs text-muted mt-2">已审核的分镜可继续制作,无需重复复查。</p>
|
||||
<div class="diagnosis-review-scope">
|
||||
<span class="text-xs text-muted">本次复查范围</span>
|
||||
<p class="font-medium">{{ scopeLabel }}</p>
|
||||
<p class="text-xs text-muted">已有当前版本有效结果的镜头将跳过。</p>
|
||||
</div>
|
||||
<!-- 以下是使用 Naive UI 折叠组件的高级设置模块,默认收起 -->
|
||||
<NCollapse class="diagnosis-advanced">
|
||||
<NCollapseItem name="advanced-settings">
|
||||
<template #header><span class="text-xs text-muted">高级设置</span></template>
|
||||
<label class="diagnosis-concurrency"
|
||||
><span>任务并发</span
|
||||
><NInputNumber
|
||||
v-model:value="concurrency"
|
||||
aria-label="诊断任务并发"
|
||||
:min="1"
|
||||
:max="5"
|
||||
:precision="0"
|
||||
size="small"
|
||||
/></label>
|
||||
</NCollapseItem>
|
||||
</NCollapse>
|
||||
<div v-if="preflight" class="mt-3 space-y-2 text-xs text-muted">
|
||||
<p v-if="preflight.errors.length">可选 AI 复查暂不可用。这不代表当前镜头需要修复。</p>
|
||||
<p v-if="preflight.existingValid">本镜头已有同版本有效诊断,无需重复调用模型。</p>
|
||||
<p v-for="code in preflight.errors" :key="code">{{ diagnosisReason(code) }}</p>
|
||||
<p v-if="preflight.shouldDiagnose">已完成来源预检查,正式诊断仍会再次核对当前版本。</p>
|
||||
</div>
|
||||
<p v-if="previewError" class="text-danger" role="alert">{{ previewError }}</p>
|
||||
<p class="text-xs text-muted mt-3">
|
||||
AI 复查会产生模型费用,仅保存检查记录,不修改镜头。请先在底部预览范围,再确认启动。
|
||||
</p>
|
||||
<p v-if="execution.active.value" class="text-xs text-muted mt-3">
|
||||
诊断任务进行中,可关闭弹窗继续查看分镜。
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
<!-- 以下是持久化诊断任务进度模块,刷新页面后仍可恢复 -->
|
||||
<WorkflowExecutionPanel
|
||||
@@ -999,9 +1237,18 @@ defineExpose({ open })
|
||||
background: var(--app-danger-soft);
|
||||
}
|
||||
/* 卡片操作在所有尺寸保留图标和完整文字,空间不足时按按钮自然换行。 */
|
||||
.diagnosis-card-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
|
||||
.diagnosis-card-actions .n-button { min-height: 34px; }
|
||||
.diagnosis-result-item { padding: 20px; }
|
||||
.diagnosis-card-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
padding-top: 8px;
|
||||
}
|
||||
.diagnosis-card-actions .n-button {
|
||||
min-height: 34px;
|
||||
}
|
||||
.diagnosis-result-item {
|
||||
padding: 20px;
|
||||
}
|
||||
.diagnosis-result-item .n-tag {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,13 @@ const locatedPosition = ref('')
|
||||
/** 定位来自当前明确的问题时才使用错误底色,普通查看不能推断问题。 */
|
||||
const locatedProblem = ref(false)
|
||||
/** 正文刷新后清除旧定位,避免已修订镜头继续沿用错误标记。 */
|
||||
watch(() => props.episodes, () => { locatedPosition.value = ''; locatedProblem.value = false })
|
||||
watch(
|
||||
() => props.episodes,
|
||||
() => {
|
||||
locatedPosition.value = ''
|
||||
locatedProblem.value = false
|
||||
}
|
||||
)
|
||||
/** 定位样式的业务依据,与镜头坐标及诊断请求字段分开。 */
|
||||
interface LocateOptions {
|
||||
/** 是否来自当前实际问题,未提供时使用中性定位。 */
|
||||
@@ -91,8 +97,8 @@ defineExpose({ locate })
|
||||
value: item.episodeNo
|
||||
}))
|
||||
"
|
||||
></NSelect
|
||||
></div>
|
||||
></NSelect>
|
||||
</div>
|
||||
<div class="breakdown-storyboard-summary">
|
||||
<span v-if="plan" class="breakdown-storyboard-count"
|
||||
>{{ plan.beats.length }} 个节拍 ·
|
||||
@@ -119,7 +125,11 @@ defineExpose({ locate })
|
||||
class="beat-section"
|
||||
tabindex="-1"
|
||||
:data-shot-position="`${plan.episodeNo}-${beat.beatNo}`"
|
||||
:class="{ 'diagnosis-located': locatedPosition === `${plan.episodeNo}-${beat.beatNo}`, 'diagnosis-problem-located': locatedProblem && locatedPosition === `${plan.episodeNo}-${beat.beatNo}` }"
|
||||
:class="{
|
||||
'diagnosis-located': locatedPosition === `${plan.episodeNo}-${beat.beatNo}`,
|
||||
'diagnosis-problem-located':
|
||||
locatedProblem && locatedPosition === `${plan.episodeNo}-${beat.beatNo}`
|
||||
}"
|
||||
>
|
||||
<div class="beat-heading">
|
||||
<span class="beat-number">{{ String(beat.beatNo).padStart(2, '0') }}</span>
|
||||
@@ -145,7 +155,8 @@ defineExpose({ locate })
|
||||
:data-shot-position="`${plan.episodeNo}-${beat.beatNo}-${shot.shotNo}`"
|
||||
:class="{
|
||||
'diagnosis-located': locatedPosition === `${plan.episodeNo}-${beat.beatNo}-${shot.shotNo}`,
|
||||
'diagnosis-problem-located': locatedProblem && locatedPosition === `${plan.episodeNo}-${beat.beatNo}-${shot.shotNo}`
|
||||
'diagnosis-problem-located':
|
||||
locatedProblem && locatedPosition === `${plan.episodeNo}-${beat.beatNo}-${shot.shotNo}`
|
||||
}"
|
||||
>
|
||||
<div class="shot-label">
|
||||
|
||||
@@ -92,7 +92,8 @@ export function diagnosisReason(code: string): string {
|
||||
QUALITY_POLICY_NOT_CONFIRMED: '请先确认项目质量规则。',
|
||||
QUALITY_POLICY_VERSION_CONFLICT: '质量规则已更新,请重新核对。',
|
||||
QUALITY_POLICY_SNAPSHOT_UNKNOWN: '本次 AI 复查缺少可信的质量规则记录,暂时不能启动。请在制作前检查中核对来源。',
|
||||
QUALITY_POLICY_SNAPSHOT_INVALID: '本次 AI 复查无法使用现有质量规则记录,暂时不能启动。请在制作前检查中核对来源。',
|
||||
QUALITY_POLICY_SNAPSHOT_INVALID:
|
||||
'本次 AI 复查无法使用现有质量规则记录,暂时不能启动。请在制作前检查中核对来源。',
|
||||
QUALITY_POLICY_SNAPSHOT_STALE: '分镜与质量规则版本不一致,请核对最新拆解结果。',
|
||||
STORYBOARD_SOURCE_MISMATCH: '镜头与已提交分镜不一致,请刷新最新结果后核对。'
|
||||
}
|
||||
@@ -107,12 +108,23 @@ export function diagnosisReason(code: string): string {
|
||||
* @returns 是否可以进入费用确认
|
||||
*/
|
||||
export function diagnosisCanStart(value: DiagnosisPreflight | null, projectId: string, shotId: string): boolean {
|
||||
return !!value && value.projectId === projectId && value.shotId === shotId &&
|
||||
value.eligibleForFurtherValidation === true && value.shouldDiagnose === true && value.existingValid === false &&
|
||||
Array.isArray(value.errors) && value.errors.length === 0 && value.requiresExecutionValidation === true &&
|
||||
Number.isSafeInteger(value.policyRevision) && value.policyRevision! >= 0 &&
|
||||
typeof value.policyFingerprint === 'string' && /^[a-f\d]{64}$/.test(value.policyFingerprint) &&
|
||||
value.willCallModel === false && value.willModifyAssets === false
|
||||
return (
|
||||
!!value &&
|
||||
value.projectId === projectId &&
|
||||
value.shotId === shotId &&
|
||||
value.eligibleForFurtherValidation === true &&
|
||||
value.shouldDiagnose === true &&
|
||||
value.existingValid === false &&
|
||||
Array.isArray(value.errors) &&
|
||||
value.errors.length === 0 &&
|
||||
value.requiresExecutionValidation === true &&
|
||||
Number.isSafeInteger(value.policyRevision) &&
|
||||
value.policyRevision! >= 0 &&
|
||||
typeof value.policyFingerprint === 'string' &&
|
||||
/^[a-f\d]{64}$/.test(value.policyFingerprint) &&
|
||||
value.willCallModel === false &&
|
||||
value.willModifyAssets === false
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,8 +135,15 @@ export function diagnosisCanStart(value: DiagnosisPreflight | null, projectId: s
|
||||
export function diagnosisHasAttention(shot: LegacyActionDiagnosisResults['shots'][number]): boolean {
|
||||
const audit = shot.resourceAudit ?? shot.handAudit
|
||||
if (diagnosisAuditHasProblem(audit)) return true
|
||||
const current = shot.status !== 'stale' && shot.shotStale !== true && shot.policyStatus !== 'stale' && shot.policyStatus !== 'unknown'
|
||||
return current && (shot.status === 'conflict_found' || !!shot.bodyMotionFindings?.some(item => item.status === 'conflict'))
|
||||
const current =
|
||||
shot.status !== 'stale' &&
|
||||
shot.shotStale !== true &&
|
||||
shot.policyStatus !== 'stale' &&
|
||||
shot.policyStatus !== 'unknown'
|
||||
return (
|
||||
current &&
|
||||
(shot.status === 'conflict_found' || !!shot.bodyMotionFindings?.some(item => item.status === 'conflict'))
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +152,10 @@ export function diagnosisHasAttention(shot: LegacyActionDiagnosisResults['shots'
|
||||
* @returns 是否存在明确冲突或不可用的结构化信息
|
||||
*/
|
||||
export function diagnosisAuditHasProblem(audit: DiagnosisHandAudit | undefined): boolean {
|
||||
return !!audit && (audit.issueCount > 0 || ['conflict_found', 'invalid_evidence', 'invalid_snapshot'].includes(audit.status))
|
||||
return (
|
||||
!!audit &&
|
||||
(audit.issueCount > 0 || ['conflict_found', 'invalid_evidence', 'invalid_snapshot'].includes(audit.status))
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,8 +165,13 @@ export function diagnosisAuditHasProblem(audit: DiagnosisHandAudit | undefined):
|
||||
*/
|
||||
export function diagnosisOptionalReview(shot: LegacyActionDiagnosisResults['shots'][number]): boolean {
|
||||
const audit = shot.resourceAudit ?? shot.handAudit
|
||||
return !diagnosisHasAttention(shot) && (shot.status !== 'no_conflict_found' || shot.requiresPostRepairDiagnosis === true ||
|
||||
!!shot.bodyMotionFindings?.length || !!audit && ['partial_evidence', 'insufficient_evidence'].includes(audit.status))
|
||||
return (
|
||||
!diagnosisHasAttention(shot) &&
|
||||
(shot.status !== 'no_conflict_found' ||
|
||||
shot.requiresPostRepairDiagnosis === true ||
|
||||
!!shot.bodyMotionFindings?.length ||
|
||||
(!!audit && ['partial_evidence', 'insufficient_evidence'].includes(audit.status)))
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,17 +188,29 @@ export function diagnosisAuditLabel(audit: DiagnosisHandAudit, handOnly = false)
|
||||
|
||||
/** 免费手部检查的结论,不能据此标记 AI 已通过。 */
|
||||
export const handAuditLabels: Record<DiagnosisHandAudit['status'], string> = {
|
||||
insufficient_evidence: '手部记录尚未覆盖', invalid_snapshot: '镜头记录不完整', invalid_evidence: '手部证据无效',
|
||||
conflict_found: '手部仍有冲突', partial_evidence: '部分动作尚未覆盖手部检查', no_conflict_found: '现有手部证据未发现冲突'
|
||||
insufficient_evidence: '手部记录尚未覆盖',
|
||||
invalid_snapshot: '镜头记录不完整',
|
||||
invalid_evidence: '手部证据无效',
|
||||
conflict_found: '手部仍有冲突',
|
||||
partial_evidence: '部分动作尚未覆盖手部检查',
|
||||
no_conflict_found: '现有手部证据未发现冲突'
|
||||
}
|
||||
/** 全身动作维度的中文说明。 */
|
||||
export const bodyDimensionLabels: Record<string, string> = {
|
||||
feet: '脚部动作', balance: '身体平衡', gaze: '视线方向', prop_interaction: '道具交互',
|
||||
physical_continuity: '动作衔接', cross_shot_continuity: '镜头间衔接'
|
||||
feet: '脚部动作',
|
||||
balance: '身体平衡',
|
||||
gaze: '视线方向',
|
||||
prop_interaction: '道具交互',
|
||||
physical_continuity: '动作衔接',
|
||||
cross_shot_continuity: '镜头间衔接'
|
||||
}
|
||||
|
||||
/** 通用动作资源结论不冒充覆盖全部剧情语义。 */
|
||||
export const resourceAuditLabels: typeof handAuditLabels = {
|
||||
insufficient_evidence: '动作记录尚未覆盖', invalid_snapshot: '镜头记录不完整', invalid_evidence: '动作占用证据无效',
|
||||
conflict_found: '动作占用仍有冲突', partial_evidence: '部分动作占用记录尚未覆盖', no_conflict_found: '现有动作占用证据未发现冲突'
|
||||
insufficient_evidence: '动作记录尚未覆盖',
|
||||
invalid_snapshot: '镜头记录不完整',
|
||||
invalid_evidence: '动作占用证据无效',
|
||||
conflict_found: '动作占用仍有冲突',
|
||||
partial_evidence: '部分动作占用记录尚未覆盖',
|
||||
no_conflict_found: '现有动作占用证据未发现冲突'
|
||||
}
|
||||
@@ -51,7 +51,13 @@ export interface BodyMotionFinding {
|
||||
/** 不调用模型的手部证据复检,与 AI 诊断独立。 */
|
||||
export interface DiagnosisHandAudit {
|
||||
/** 证据完整性或冲突结论。 */
|
||||
status: 'insufficient_evidence' | 'invalid_snapshot' | 'invalid_evidence' | 'conflict_found' | 'partial_evidence' | 'no_conflict_found'
|
||||
status:
|
||||
| 'insufficient_evidence'
|
||||
| 'invalid_snapshot'
|
||||
| 'invalid_evidence'
|
||||
| 'conflict_found'
|
||||
| 'partial_evidence'
|
||||
| 'no_conflict_found'
|
||||
/** 检出的冲突数。 */
|
||||
issueCount: number
|
||||
/** 有效证据数量。 */
|
||||
|
||||
@@ -75,7 +75,14 @@ export interface BreakdownQuality {
|
||||
export function normalizeBreakdownState(state: BreakdownState): BreakdownState {
|
||||
// 新版候选只信任顶层;旧版无候选标记的快照才兼容嵌套成果。
|
||||
const result: BreakdownResult = state.candidateOnly === true ? {} : { ...state.breakdownResult }
|
||||
for (const key of ['subjectCandidates', 'subjectForms', 'storyboardPlans', 'storyboardEpisodeShots', 'storyboardShotValidation', 'storyboardNeedsManualReview'] as const) {
|
||||
for (const key of [
|
||||
'subjectCandidates',
|
||||
'subjectForms',
|
||||
'storyboardPlans',
|
||||
'storyboardEpisodeShots',
|
||||
'storyboardShotValidation',
|
||||
'storyboardNeedsManualReview'
|
||||
] as const) {
|
||||
if (state[key] !== undefined) Object.assign(result, { [key]: state[key] })
|
||||
}
|
||||
if (result.storyboardEpisodeShots?.length) {
|
||||
@@ -93,7 +100,12 @@ export function normalizeBreakdownState(state: BreakdownState): BreakdownState {
|
||||
* @returns 是否含可回看的资产内容
|
||||
*/
|
||||
function hasBreakdownData(record: Checkpoint): boolean {
|
||||
return Boolean(record.state.breakdownResult || record.state.subjectCandidates || record.state.storyboardEpisodeShots || record.state.storyboardPlans)
|
||||
return Boolean(
|
||||
record.state.breakdownResult ||
|
||||
record.state.subjectCandidates ||
|
||||
record.state.storyboardEpisodeShots ||
|
||||
record.state.storyboardPlans
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,13 +116,34 @@ function hasBreakdownData(record: Checkpoint): boolean {
|
||||
export function selectBreakdownSource(records: Checkpoint[]): BreakdownSource {
|
||||
const latest = records.at(-1)
|
||||
if (!latest) return { kind: 'empty', state: null }
|
||||
const formal = records.toReversed().find(record => hasBreakdownData(record) && (record.state.storyboardPersisted === true || record.state.candidateCommitted === true || record.state.candidateOnly !== true))
|
||||
const formal = records
|
||||
.toReversed()
|
||||
.find(
|
||||
record =>
|
||||
hasBreakdownData(record) &&
|
||||
(record.state.storyboardPersisted === true ||
|
||||
record.state.candidateCommitted === true ||
|
||||
record.state.candidateOnly !== true)
|
||||
)
|
||||
if (latest.state.candidateOnly === true || hasBreakdownData(latest) || latest.state.runConfig) {
|
||||
const state = normalizeBreakdownState(latest.state)
|
||||
return { checkpoint: latest, state, formal, kind: state.storyboardPersisted === true || state.candidateCommitted === true || state.candidateOnly !== true ? 'formal' : 'candidate' }
|
||||
return {
|
||||
checkpoint: latest,
|
||||
state,
|
||||
formal,
|
||||
kind:
|
||||
state.storyboardPersisted === true || state.candidateCommitted === true || state.candidateOnly !== true
|
||||
? 'formal'
|
||||
: 'candidate'
|
||||
}
|
||||
}
|
||||
const previous = records.toReversed().find(hasBreakdownData)
|
||||
return { kind: previous ? 'history' : 'empty', checkpoint: previous, state: previous ? normalizeBreakdownState(previous.state) : null, formal }
|
||||
return {
|
||||
kind: previous ? 'history' : 'empty',
|
||||
checkpoint: previous,
|
||||
state: previous ? normalizeBreakdownState(previous.state) : null,
|
||||
formal
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,11 +153,29 @@ export function selectBreakdownSource(records: Checkpoint[]): BreakdownSource {
|
||||
* @param checkpointId 当前候选版本
|
||||
* @returns 原始有效审核结果
|
||||
*/
|
||||
export function assertCandidateReview(review: CandidateRevalidation, projectId: string, checkpointId: string): CandidateRevalidation {
|
||||
export function assertCandidateReview(
|
||||
review: CandidateRevalidation,
|
||||
projectId: string,
|
||||
checkpointId: string
|
||||
): CandidateRevalidation {
|
||||
if (!review || review.projectId !== projectId || review.checkpointId !== checkpointId)
|
||||
throw new Error('候选审核版本已过期,请刷新候选状态。')
|
||||
const arrayKeys = ['previousIssues', 'currentIssues', 'missingSubjectRefs', 'actionQualityBlocks', 'actionRepairTargets', 'pendingQualityEpisodeNos', 'propReferenceDiagnostics', 'pendingWithoutActionBlocks'] as const
|
||||
if (!review.candidateValidation || typeof review.candidateValidation.valid !== 'boolean' || !Array.isArray(review.candidateValidation.issues) || !arrayKeys.every(key => Array.isArray(review[key])))
|
||||
const arrayKeys = [
|
||||
'previousIssues',
|
||||
'currentIssues',
|
||||
'missingSubjectRefs',
|
||||
'actionQualityBlocks',
|
||||
'actionRepairTargets',
|
||||
'pendingQualityEpisodeNos',
|
||||
'propReferenceDiagnostics',
|
||||
'pendingWithoutActionBlocks'
|
||||
] as const
|
||||
if (
|
||||
!review.candidateValidation ||
|
||||
typeof review.candidateValidation.valid !== 'boolean' ||
|
||||
!Array.isArray(review.candidateValidation.issues) ||
|
||||
!arrayKeys.every(key => Array.isArray(review[key]))
|
||||
)
|
||||
throw new Error('候选审核响应不完整,请刷新候选状态。')
|
||||
return review
|
||||
}
|
||||
@@ -137,46 +188,141 @@ export function assertCandidateReview(review: CandidateRevalidation, projectId:
|
||||
* @param error 读取失败或版本过期原因
|
||||
* @returns 页面、问题抽屉与提交面板共享的质量状态
|
||||
*/
|
||||
export function breakdownQuality(source: BreakdownSource, review: CandidateRevalidation | null, loading = false, error = ''): BreakdownQuality {
|
||||
export function breakdownQuality(
|
||||
source: BreakdownSource,
|
||||
review: CandidateRevalidation | null,
|
||||
loading = false,
|
||||
error = ''
|
||||
): BreakdownQuality {
|
||||
const candidate = source.kind === 'candidate'
|
||||
const current = candidate && review?.checkpointId === source.checkpoint?.checkpointId ? review : null
|
||||
const known = candidate ? !!current && !loading && !error : source.kind === 'formal'
|
||||
const structuralIssues = known ? candidate ? current!.currentIssues : source.state?.storyboardShotValidation?.issues ?? [] : []
|
||||
const validation = known ? candidate ? current!.currentIssues.length === 0 : source.state?.storyboardShotValidation?.valid ?? null : null
|
||||
const actionBlocks = known ? candidate ? current!.actionQualityBlocks : (source.state?.storyboardActionQualityDecisions ?? []).filter(item => item.status === 'blocked' || item.warningCodes.includes('action_resource_conflict')).map(item => ({ ...item, isPendingEpisode: true })) : []
|
||||
const pendingEpisodeNos = known ? candidate ? current!.pendingQualityEpisodeNos : source.state?.storyboardPendingQualityEpisodeNos ?? [] : []
|
||||
const structuralIssues = known
|
||||
? candidate
|
||||
? current!.currentIssues
|
||||
: (source.state?.storyboardShotValidation?.issues ?? [])
|
||||
: []
|
||||
const validation = known
|
||||
? candidate
|
||||
? current!.currentIssues.length === 0
|
||||
: (source.state?.storyboardShotValidation?.valid ?? null)
|
||||
: null
|
||||
const actionBlocks = known
|
||||
? candidate
|
||||
? current!.actionQualityBlocks
|
||||
: (source.state?.storyboardActionQualityDecisions ?? [])
|
||||
.filter(item => item.status === 'blocked' || item.warningCodes.includes('action_resource_conflict'))
|
||||
.map(item => ({ ...item, isPendingEpisode: true }))
|
||||
: []
|
||||
const pendingEpisodeNos = known
|
||||
? candidate
|
||||
? current!.pendingQualityEpisodeNos
|
||||
: (source.state?.storyboardPendingQualityEpisodeNos ?? [])
|
||||
: []
|
||||
const problems: BreakdownProblem[] = structuralIssues.map((item, index) => ({
|
||||
key: `structure-${item.episodeNo}-${item.beatNo}-${item.shotNo}-${index}`,
|
||||
type: item.message.includes('主体引用缺失') ? 'subject' : /绑定|形态|Form/.test(item.message) ? 'binding' : 'structure',
|
||||
type: item.message.includes('主体引用缺失')
|
||||
? 'subject'
|
||||
: /绑定|形态|Form/.test(item.message)
|
||||
? 'binding'
|
||||
: 'structure',
|
||||
location: item,
|
||||
message: item.message,
|
||||
codes: []
|
||||
}))
|
||||
for (const block of actionBlocks) problems.push({ key: `action-${block.episodeNo}-${block.beatNo}-${block.shotNo}`, type: 'action', location: { ...block, message: '动作质量待修订' }, message: '当前动作规划仍有阻断或资源冲突。', codes: [...new Set([...block.blockingCodes, ...block.warningCodes])] })
|
||||
for (const episodeNo of pendingEpisodeNos.filter(no => !actionBlocks.some(item => item.episodeNo === no))) problems.push({ key: `pending-${episodeNo}`, type: 'pending', location: { episodeNo, message: '剧集仍标记为待审核' }, message: '该集仍标记为待审核,当前没有动作阻断明细,请重新核对审核状态。', codes: [] })
|
||||
for (const block of actionBlocks)
|
||||
problems.push({
|
||||
key: `action-${block.episodeNo}-${block.beatNo}-${block.shotNo}`,
|
||||
type: 'action',
|
||||
location: { ...block, message: '动作质量待修订' },
|
||||
message: '当前动作规划仍有阻断或资源冲突。',
|
||||
codes: [...new Set([...block.blockingCodes, ...block.warningCodes])]
|
||||
})
|
||||
for (const episodeNo of pendingEpisodeNos.filter(no => !actionBlocks.some(item => item.episodeNo === no)))
|
||||
problems.push({
|
||||
key: `pending-${episodeNo}`,
|
||||
type: 'pending',
|
||||
location: { episodeNo, message: '剧集仍标记为待审核' },
|
||||
message: '该集仍标记为待审核,当前没有动作阻断明细,请重新核对审核状态。',
|
||||
codes: []
|
||||
})
|
||||
if (current && known) {
|
||||
for (const diagnostic of current.propReferenceDiagnostics) {
|
||||
if (diagnostic.beatAllowsSubject && diagnostic.shotHasSubject && diagnostic.shotHasBinding) continue
|
||||
if (problems.some(item => item.location?.episodeNo === diagnostic.episodeNo && item.location.beatNo === diagnostic.beatNo && item.location.shotNo === diagnostic.shotNo && item.message.includes(diagnostic.subjectRef))) continue
|
||||
problems.push({ key: `prop-${diagnostic.episodeNo}-${diagnostic.beatNo}-${diagnostic.shotNo}-${diagnostic.subjectRef}`, type: 'subject', location: { ...diagnostic, message: '道具引用或形态绑定缺失' }, message: `道具 ${diagnostic.subjectName}(${diagnostic.subjectRef})的节拍引用、镜头引用或形态绑定不完整。`, codes: [] })
|
||||
if (
|
||||
problems.some(
|
||||
item =>
|
||||
item.location?.episodeNo === diagnostic.episodeNo &&
|
||||
item.location.beatNo === diagnostic.beatNo &&
|
||||
item.location.shotNo === diagnostic.shotNo &&
|
||||
item.message.includes(diagnostic.subjectRef)
|
||||
)
|
||||
)
|
||||
continue
|
||||
problems.push({
|
||||
key: `prop-${diagnostic.episodeNo}-${diagnostic.beatNo}-${diagnostic.shotNo}-${diagnostic.subjectRef}`,
|
||||
type: 'subject',
|
||||
location: { ...diagnostic, message: '道具引用或形态绑定缺失' },
|
||||
message: `道具 ${diagnostic.subjectName}(${diagnostic.subjectRef})的节拍引用、镜头引用或形态绑定不完整。`,
|
||||
codes: []
|
||||
})
|
||||
}
|
||||
for (const [index, message] of current.candidateValidation.issues.entries()) {
|
||||
if (message === 'Storyboard 质量审核未通过' && structuralIssues.length || message === '仍存在待处理的分镜质量问题' && pendingEpisodeNos.length) continue
|
||||
problems.push({ key: `candidate-${index}`, type: /Form|形态|绑定/.test(message) ? 'binding' : 'structure', message, codes: [] })
|
||||
if (
|
||||
(message === 'Storyboard 质量审核未通过' && structuralIssues.length) ||
|
||||
(message === '仍存在待处理的分镜质量问题' && pendingEpisodeNos.length)
|
||||
)
|
||||
continue
|
||||
problems.push({
|
||||
key: `candidate-${index}`,
|
||||
type: /Form|形态|绑定/.test(message) ? 'binding' : 'structure',
|
||||
message,
|
||||
codes: []
|
||||
})
|
||||
}
|
||||
}
|
||||
if (known && ((validation === false && !problems.some(item => ['structure', 'subject', 'binding'].includes(item.type))) || (current?.candidateValidation.valid === false && !problems.length))) {
|
||||
problems.push({ key: 'validation-unknown', type: 'structure', message: '当前版本校验未通过,服务端未提供具体结构问题,请重新读取审核。', codes: [] })
|
||||
if (
|
||||
known &&
|
||||
((validation === false && !problems.some(item => ['structure', 'subject', 'binding'].includes(item.type))) ||
|
||||
(current?.candidateValidation.valid === false && !problems.length))
|
||||
) {
|
||||
problems.push({
|
||||
key: 'validation-unknown',
|
||||
type: 'structure',
|
||||
message: '当前版本校验未通过,服务端未提供具体结构问题,请重新读取审核。',
|
||||
codes: []
|
||||
})
|
||||
}
|
||||
const structuralCount = problems.filter(item => ['structure', 'subject', 'binding'].includes(item.type)).length
|
||||
const structureValid = validation === null ? null : validation && structuralCount === 0
|
||||
return {
|
||||
source: source.kind, checkpointId: source.checkpoint?.checkpointId, isCandidate: candidate,
|
||||
source: source.kind,
|
||||
checkpointId: source.checkpoint?.checkpointId,
|
||||
isCandidate: candidate,
|
||||
committed: source.state?.storyboardPersisted === true || source.state?.candidateCommitted === true,
|
||||
structureValid, actionStatus: known ? actionBlocks.length || pendingEpisodeNos.length ? 'blocked' : 'passed' : 'unknown',
|
||||
structuralIssues, structuralCount, actionBlocks, pendingEpisodeNos, problems,
|
||||
historyIssues: current?.previousIssues ?? [], issueCount: problems.length,
|
||||
canRequestCommitPreview: candidate && known && current!.candidateValidation.valid && structureValid === true && !problems.length && !candidateCommitIssue({ ...source.state, workflowExecution: undefined, storyboardShotValidation: { valid: true, issues: [] }, storyboardPendingQualityEpisodeNos: pendingEpisodeNos }),
|
||||
needsRefresh: candidate && (!known || !!error), loading: candidate && loading, error: candidate ? error : ''
|
||||
structureValid,
|
||||
actionStatus: known ? (actionBlocks.length || pendingEpisodeNos.length ? 'blocked' : 'passed') : 'unknown',
|
||||
structuralIssues,
|
||||
structuralCount,
|
||||
actionBlocks,
|
||||
pendingEpisodeNos,
|
||||
problems,
|
||||
historyIssues: current?.previousIssues ?? [],
|
||||
issueCount: problems.length,
|
||||
canRequestCommitPreview:
|
||||
candidate &&
|
||||
known &&
|
||||
current!.candidateValidation.valid &&
|
||||
structureValid === true &&
|
||||
!problems.length &&
|
||||
!candidateCommitIssue({
|
||||
...source.state,
|
||||
workflowExecution: undefined,
|
||||
storyboardShotValidation: { valid: true, issues: [] },
|
||||
storyboardPendingQualityEpisodeNos: pendingEpisodeNos
|
||||
}),
|
||||
needsRefresh: candidate && (!known || !!error),
|
||||
loading: candidate && loading,
|
||||
error: candidate ? error : ''
|
||||
}
|
||||
}
|
||||
@@ -72,8 +72,10 @@ export function actionDraftIssue(draft: ShotActionDraft): string {
|
||||
)
|
||||
return '阶段衔接与建议时长需填写有效秒数。'
|
||||
for (const phase of planning.phases) {
|
||||
if (phase.resourceOccupancy?.some(item => item.transition && !item.continuityRef?.trim())) return '释放或交接需要填写明确的持续对象。'
|
||||
if (phase.resourceOccupancy?.some(item => item.transition === 'release' && item.usage !== 'other')) return '明确释放不能同时声明持有或支撑,请核对资源用途。'
|
||||
if (phase.resourceOccupancy?.some(item => item.transition && !item.continuityRef?.trim()))
|
||||
return '释放或交接需要填写明确的持续对象。'
|
||||
if (phase.resourceOccupancy?.some(item => item.transition === 'release' && item.usage !== 'other'))
|
||||
return '明确释放不能同时声明持有或支撑,请核对资源用途。'
|
||||
if (!phase.action.trim()) return '请填写每个阶段的动作描述。'
|
||||
if (!Number.isFinite(phase.estimatedSeconds) || phase.estimatedSeconds <= 0) return '阶段时长必须大于 0 秒。'
|
||||
const references = [
|
||||
|
||||
@@ -17,7 +17,9 @@ export function useBreakdownQuality(projectId: Ref<string>, checkpoints: Ref<Che
|
||||
/** 当前生命周期与正式数据分别选择。 */
|
||||
const source = computed(() => selectBreakdownSource(workflowCheckpoints(checkpoints.value, 'breakdown')))
|
||||
/** 审核请求只绑定尚未提交的候选及其项目。 */
|
||||
const key = computed(() => source.value.kind === 'candidate' ? `${projectId.value}:${source.value.checkpoint?.checkpointId}` : '')
|
||||
const key = computed(() =>
|
||||
source.value.kind === 'candidate' ? `${projectId.value}:${source.value.checkpoint?.checkpointId}` : ''
|
||||
)
|
||||
/** 仅存放当前版本已验证的审核。 */
|
||||
const review = ref<CandidateRevalidation | null>(null)
|
||||
/** 审核区域的独立加载状态。 */
|
||||
@@ -56,7 +58,10 @@ export function useBreakdownQuality(projectId: Ref<string>, checkpoints: Ref<Che
|
||||
showActionFeedback(message, error.value, 'error')
|
||||
}
|
||||
} finally {
|
||||
if (version === generation) { loading.value = false; pending = null }
|
||||
if (version === generation) {
|
||||
loading.value = false
|
||||
pending = null
|
||||
}
|
||||
}
|
||||
})()
|
||||
return pending
|
||||
@@ -70,7 +75,14 @@ export function useBreakdownQuality(projectId: Ref<string>, checkpoints: Ref<Che
|
||||
loading.value = false
|
||||
error.value = ''
|
||||
}
|
||||
watch(key, () => { invalidate(); void refresh() }, { immediate: true, flush: 'sync' })
|
||||
watch(
|
||||
key,
|
||||
() => {
|
||||
invalidate()
|
||||
void refresh()
|
||||
},
|
||||
{ immediate: true, flush: 'sync' }
|
||||
)
|
||||
onScopeDispose(invalidate)
|
||||
/** 页面、问题与提交面板共用一个结论。 */
|
||||
const quality = computed(() => breakdownQuality(source.value, review.value, loading.value, error.value))
|
||||
|
||||
@@ -3,7 +3,9 @@ import { projectsApi } from '../projects/api'
|
||||
import { policyDraft } from '../projects/quality-policy'
|
||||
import type { ProjectQualityPolicy, ProjectQualityPolicyResult } from '../projects/types'
|
||||
import {
|
||||
qualityPolicyConfirmed, qualityPolicySignature, validateQualityPolicyReceipt
|
||||
qualityPolicyConfirmed,
|
||||
qualityPolicySignature,
|
||||
validateQualityPolicyReceipt
|
||||
} from '../projects/quality-policy-confirmation'
|
||||
import { errorMessage } from '../../lib/http'
|
||||
import { showActionFeedback, useActionMessage } from '../../components/ui/useActionMessage'
|
||||
@@ -57,7 +59,11 @@ export function useBreakdownStartPolicy(projectId: Ref<string>, scope: Ref<strin
|
||||
/** 用户可重试的错误反馈。 */
|
||||
const error = ref('')
|
||||
/** 编辑器只在服务端版本变化时重建,失败保留草稿。 */
|
||||
const editorKey = computed(() => policy.value ? `${policy.value.projectId}:${policy.value.revision}:${policy.value.fingerprint}:${qualityPolicySignature(policy.value.policy)}` : '')
|
||||
const editorKey = computed(() =>
|
||||
policy.value
|
||||
? `${policy.value.projectId}:${policy.value.revision}:${policy.value.fingerprint}:${qualityPolicySignature(policy.value.policy)}`
|
||||
: ''
|
||||
)
|
||||
/** 应用统一消息层。 */
|
||||
const message = useActionMessage()
|
||||
/** 取消项目或配置变更前的旧请求。 */
|
||||
@@ -105,7 +111,9 @@ export function useBreakdownStartPolicy(projectId: Ref<string>, scope: Ref<strin
|
||||
error.value = errorMessage(cause)
|
||||
showActionFeedback(message, error.value, 'error')
|
||||
}
|
||||
} finally { if (current === generation) reading.value = false }
|
||||
} finally {
|
||||
if (current === generation) reading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,7 +136,11 @@ export function useBreakdownStartPolicy(projectId: Ref<string>, scope: Ref<strin
|
||||
const draftSignature = qualityPolicySignature(draft)
|
||||
let result = await read(id, signal)
|
||||
if (current !== generation || !allowed.value) return false
|
||||
if (result.revision !== reviewed.revision || result.fingerprint !== reviewed.fingerprint || qualityPolicySignature(result.policy) !== expected) {
|
||||
if (
|
||||
result.revision !== reviewed.revision ||
|
||||
result.fingerprint !== reviewed.fingerprint ||
|
||||
qualityPolicySignature(result.policy) !== expected
|
||||
) {
|
||||
policy.value = result
|
||||
showActionFeedback(message, '质量规则已在其他位置更新,请重新核对后确认。', 'warning')
|
||||
return false
|
||||
@@ -146,16 +158,27 @@ export function useBreakdownStartPolicy(projectId: Ref<string>, scope: Ref<strin
|
||||
// 确认是独立写入;确认按钮只在用户明确核对后才调用此接口。
|
||||
reading.value = false
|
||||
saving.value = true
|
||||
const confirmed = validateQualityPolicyReceipt(await projectsApi.confirmQualityPolicy(id, result.revision), id)
|
||||
const confirmed = validateQualityPolicyReceipt(
|
||||
await projectsApi.confirmQualityPolicy(id, result.revision),
|
||||
id
|
||||
)
|
||||
if (current !== generation || !allowed.value) return false
|
||||
if (!qualityPolicyConfirmed(confirmed) || confirmed.revision !== result.revision ||
|
||||
confirmed.fingerprint !== result.fingerprint || qualityPolicySignature(confirmed.policy) !== draftSignature)
|
||||
if (
|
||||
!qualityPolicyConfirmed(confirmed) ||
|
||||
confirmed.revision !== result.revision ||
|
||||
confirmed.fingerprint !== result.fingerprint ||
|
||||
qualityPolicySignature(confirmed.policy) !== draftSignature
|
||||
)
|
||||
throw new Error('质量规则确认结果不一致,请重新核对。')
|
||||
saving.value = false
|
||||
reading.value = true
|
||||
result = await read(id, signal)
|
||||
if (current !== generation || !allowed.value) return false
|
||||
if (!qualityPolicyConfirmed(result) || result.revision !== confirmed.revision || result.fingerprint !== confirmed.fingerprint) {
|
||||
if (
|
||||
!qualityPolicyConfirmed(result) ||
|
||||
result.revision !== confirmed.revision ||
|
||||
result.fingerprint !== confirmed.fingerprint
|
||||
) {
|
||||
policy.value = result
|
||||
showActionFeedback(message, '质量规则已变化,请重新核对后确认。', 'warning')
|
||||
return false
|
||||
@@ -173,7 +196,10 @@ export function useBreakdownStartPolicy(projectId: Ref<string>, scope: Ref<strin
|
||||
}
|
||||
return false
|
||||
} finally {
|
||||
if (current === generation) { reading.value = false; saving.value = false }
|
||||
if (current === generation) {
|
||||
reading.value = false
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +220,12 @@ export function useBreakdownStartPolicy(projectId: Ref<string>, scope: Ref<strin
|
||||
const result = await read(id, controller.signal)
|
||||
if (current !== generation || !allowed.value) return false
|
||||
const signature = qualityPolicySignature(result.policy)
|
||||
if (signature !== preparedSignature || !qualityPolicyConfirmed(result) || result.revision !== policy.value?.revision || result.fingerprint !== policy.value?.fingerprint) {
|
||||
if (
|
||||
signature !== preparedSignature ||
|
||||
!qualityPolicyConfirmed(result) ||
|
||||
result.revision !== policy.value?.revision ||
|
||||
result.fingerprint !== policy.value?.fingerprint
|
||||
) {
|
||||
policy.value = result
|
||||
preparedSignature = ''
|
||||
startOpen.value = false
|
||||
@@ -202,7 +233,13 @@ export function useBreakdownStartPolicy(projectId: Ref<string>, scope: Ref<strin
|
||||
showActionFeedback(message, '质量规则已变化,请重新确认后再启动拆解。', 'warning')
|
||||
return false
|
||||
}
|
||||
permit = { projectId: id, scope: currentScope, signature, revision: result.revision, fingerprint: result.fingerprint }
|
||||
permit = {
|
||||
projectId: id,
|
||||
scope: currentScope,
|
||||
signature,
|
||||
revision: result.revision,
|
||||
fingerprint: result.fingerprint
|
||||
}
|
||||
startOpen.value = false
|
||||
return true
|
||||
} catch (cause) {
|
||||
@@ -211,7 +248,9 @@ export function useBreakdownStartPolicy(projectId: Ref<string>, scope: Ref<strin
|
||||
showActionFeedback(message, error.value, 'error')
|
||||
}
|
||||
return false
|
||||
} finally { if (current === generation) reading.value = false }
|
||||
} finally {
|
||||
if (current === generation) reading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,9 +260,16 @@ export function useBreakdownStartPolicy(projectId: Ref<string>, scope: Ref<strin
|
||||
function consumePermit(): { expectedRevision: number } | null {
|
||||
const current = permit
|
||||
permit = null
|
||||
return current && allowed.value && current.projectId === projectId.value && current.scope === scope.value &&
|
||||
policy.value && qualityPolicyConfirmed(policy.value) && current.revision === policy.value.revision &&
|
||||
current.fingerprint === policy.value.fingerprint ? { expectedRevision: current.revision } : null
|
||||
return current &&
|
||||
allowed.value &&
|
||||
current.projectId === projectId.value &&
|
||||
current.scope === scope.value &&
|
||||
policy.value &&
|
||||
qualityPolicyConfirmed(policy.value) &&
|
||||
current.revision === policy.value.revision &&
|
||||
current.fingerprint === policy.value.fingerprint
|
||||
? { expectedRevision: current.revision }
|
||||
: null
|
||||
}
|
||||
|
||||
/** 用户取消只读确认时撤销未完成请求,保存请求进行中禁止重复取消。 */
|
||||
@@ -231,7 +277,27 @@ export function useBreakdownStartPolicy(projectId: Ref<string>, scope: Ref<strin
|
||||
if (!saving.value) reset()
|
||||
}
|
||||
watch([projectId, scope], reset, { flush: 'sync' })
|
||||
watch(allowed, value => { if (!value) reset() }, { flush: 'sync' })
|
||||
watch(
|
||||
allowed,
|
||||
value => {
|
||||
if (!value) reset()
|
||||
},
|
||||
{ flush: 'sync' }
|
||||
)
|
||||
onScopeDispose(reset)
|
||||
return { policy, reviewOpen, startOpen, reading, saving, busy, error, editorKey, prepare, confirmRules, verifyStart, consumePermit, cancel }
|
||||
return {
|
||||
policy,
|
||||
reviewOpen,
|
||||
startOpen,
|
||||
reading,
|
||||
saving,
|
||||
busy,
|
||||
error,
|
||||
editorKey,
|
||||
prepare,
|
||||
confirmRules,
|
||||
verifyStart,
|
||||
consumePermit,
|
||||
cancel
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user