diff --git a/src/App.vue b/src/App.vue index f4136ec..9800e90 100644 --- a/src/App.vue +++ b/src/App.vue @@ -140,6 +140,7 @@ const menuOptions = computed(() => { const sectionAccess = currentProjectAccess.value?.sections[path] const disabled = sectionAccess ? !sectionAccess.enabled : path !== 'create-drama' const target = '/projects/' + projectId.value + '/' + path + const reason = sectionAccess?.reason || '正在核对项目制作条件' return { key: target, disabled, @@ -148,11 +149,14 @@ const menuOptions = computed(() => { ? h( 'span', { - class: 'admin-menu-label', - title: sectionAccess?.reason || '请先完成前面的制作步骤', + class: 'admin-menu-label admin-menu-label-blocked', + title: reason, + 'aria-label': `${label},${reason}`, 'aria-disabled': 'true' }, - label + sectionAccess + ? [h('span', label), h('small', { class: 'admin-menu-reason' }, reason)] + : label ) : h(RouterLink, { to: target }, () => h('span', { class: 'admin-menu-label' }, label) @@ -369,6 +373,20 @@ const menuOptions = computed(() => { color 0.18s ease, opacity 0.18s ease; } +/* 保留菜单行高,在禁用项名称下展示当前步骤的简短原因。 */ +.admin-menu-label-blocked { + display: block; + line-height: 16px; + min-width: 0; +} +.admin-menu-reason { + display: block; + font-size: 10px; + line-height: 14px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} .admin-brand { @apply flex shrink-0 items-center gap-3 h-[74px] overflow-hidden py-0 px-5 text-ink whitespace-nowrap; min-width: var(--admin-sider-expanded); diff --git a/src/features/projects/ProjectLayout.vue b/src/features/projects/ProjectLayout.vue index 6dc05e7..3c54f60 100644 --- a/src/features/projects/ProjectLayout.vue +++ b/src/features/projects/ProjectLayout.vue @@ -28,11 +28,6 @@ import SubjectIdentitySkeleton from '../subject-identity/SubjectIdentitySkeleton const route = useRoute() const router = useRouter() const id = computed(() => String(route.params.projectId)) -// 图库使用手动刷新,父布局也停止轮询,避免浏览素材时被周期性更新打断。 -const isGallery = computed(() => { - const path = route.path.replace(/\/+$/, '') - return path.endsWith('/subject-images') || path.endsWith('/assets') -}) const context = useProjectData(id) provide(projectContextKey, context) /** 项目全局配置保存后更新已挂载生成表单。 */ @@ -343,7 +338,7 @@ onScopeDispose(() => { v-else-if="context.project.value?.id === id" class="project-access-gate" :title="currentAccess?.reason || '当前步骤还不能开始'" - :description="`完成前面的制作步骤后,这里会自动开放。${isGallery ? '如刚完成操作,请刷新项目状态。' : ''}`" + description="如刚完成前置步骤,请刷新项目状态。正式分镜的复检详情可在「制作前检查」查看。" > { > ) { }) const project = computed(() => query.data.value?.project ?? null) const checkpoints = computed(() => query.data.value?.checkpoints ?? []) - const stageReadiness = computed(() => query.data.value?.stageReadiness ?? null) + /** 导航只消费当前项目的准入响应。 */ + const stageReadiness = computed(() => { + const readiness = query.data.value?.stageReadiness + return readiness?.projectId === id.value ? readiness : null + }) + /** 同项目并发轻量刷新只采用最后一次请求。 */ + let readinessRefresh = 0 /** 子页面完成当前步骤后调用,只刷新轻量项目状态与导航门禁。 */ async function refreshStageReadiness() { const projectId = id.value - if (!projectId || !query.data.value) return + const snapshot = query.data.value + if (!projectId || snapshot?.project.id !== projectId) return + const request = ++readinessRefresh const nextReadiness = await projectsApi.stageReadiness(projectId) - if (id.value === projectId && query.data.value) - query.data.value = { ...query.data.value, stageReadiness: nextReadiness } + if ( + request === readinessRefresh && + id.value === projectId && + query.data.value === snapshot && + nextReadiness.projectId === projectId + ) + query.data.value = { ...snapshot, stageReadiness: nextReadiness } } return { ...query, project, checkpoints, stageReadiness, refreshStageReadiness } } diff --git a/src/features/projects/useProjectStageAccess.ts b/src/features/projects/useProjectStageAccess.ts index 4557878..7d1af1d 100644 --- a/src/features/projects/useProjectStageAccess.ts +++ b/src/features/projects/useProjectStageAccess.ts @@ -4,7 +4,7 @@ import type { ProjectAccess, ProjectSection } from './access' import type { ProjectStageReadiness } from './types' function accessState(ready: boolean | undefined, reason: string | null | undefined, fallback: string) { - return { enabled: Boolean(ready), reason: reason || fallback } + return { enabled: ready === true, reason: reason || fallback } } /** @@ -16,7 +16,12 @@ function accessState(ready: boolean | undefined, reason: string | null | undefin export function useProjectStageAccess(projectId: Ref, readiness: Ref) { /** 当前步骤能否进入及对应中文说明,不改变原始准备状态。 */ const sections = computed>(() => { - const state = readiness.value + const state = readiness.value?.projectId === projectId.value ? readiness.value : null + const preparationReady = state?.preparation?.ready === true + const preparationReason = state?.preparation?.reason + const materialReason = preparationReady + ? state?.visualStyle.reason || '请先准备视觉风格' + : preparationReason || '请先核对正式分镜的素材准备条件' const result: Record = { 'create-drama': { enabled: true, reason: '' }, breakdown: { @@ -30,18 +35,18 @@ export function useProjectStageAccess(projectId: Ref, readiness: Ref, readiness: Ref readiness.value?.script.ready === true) + /** 只认当前项目的剧本就绪状态。 */ + const scriptReady = computed( + () => readiness.value?.projectId === projectId.value && readiness.value.script.ready === true + ) return { projectId, scriptReady, sections } } diff --git a/src/features/subject-identity/SubjectIdentityPage.vue b/src/features/subject-identity/SubjectIdentityPage.vue index a7cdeeb..87eb560 100644 --- a/src/features/subject-identity/SubjectIdentityPage.vue +++ b/src/features/subject-identity/SubjectIdentityPage.vue @@ -91,6 +91,8 @@ const { confirmStableAnchor, confirmCasting, validateImage, + readSavedValidation, + readingSavedReviewId, generateStableAnchorQuality, pendingImageOperation, validationResult @@ -994,6 +996,8 @@ function runNextAction() { " :pending-operation="pendingImageOperation" :validation-result="validationResult" + :reading-saved-review-id="readingSavedReviewId" + @read-review="readSavedValidation" :retry-disabled-reason="imageRetryDisabledReason" @validate="validateImage" @anchor="chooseAnchor" diff --git a/src/features/subject-identity/api.ts b/src/features/subject-identity/api.ts index 91f2570..1cc01e9 100644 --- a/src/features/subject-identity/api.ts +++ b/src/features/subject-identity/api.ts @@ -1,6 +1,7 @@ import { request } from '../../lib/http' import type { IdentityImagePreview, + IdentityImageDetails, IdentityImageGenerationStart, IdentityValidationResult, StableAnchorQualityInput, @@ -74,6 +75,15 @@ export const subjectIdentityApi = { ), listImages: (subjectId: string, signal?: AbortSignal) => request(`${identityPath(subjectId)}/images`, { signal }), + /** + * 读取指定候选及已保存的审核记录。 + * @param subjectId 正式主体 + * @param imageId 当前候选 + * @param signal 取消过期查询 + * @returns 正式图片详情,不调用视觉模型 + */ + imageDetails: (subjectId: string, imageId: string, signal?: AbortSignal) => + request(`${identityPath(subjectId)}/images/${encodeURIComponent(imageId)}`, { signal }), generateImage: (subjectId: string, input: GenerateIdentityImageInput) => request(`${identityPath(subjectId)}/images`, { method: 'POST', diff --git a/src/features/subject-identity/components/IdentityGallery.vue b/src/features/subject-identity/components/IdentityGallery.vue index e0a6b36..167fe74 100644 --- a/src/features/subject-identity/components/IdentityGallery.vue +++ b/src/features/subject-identity/components/IdentityGallery.vue @@ -24,6 +24,8 @@ const props = defineProps<{ disabled: boolean /** 当前固定图片目标的确认或校验操作。 */ pendingOperation?: IdentityImageOperation | null + /** 当前正在读取历史审核的候选编号。 */ + readingSavedReviewId?: string /** 重新生成暂不可用的具体恢复步骤。 */ retryDisabledReason?: string /** 本主体最近一次显式图片审核结果。 */ @@ -35,6 +37,8 @@ const emit = defineEmits<{ anchor: [imageId: string] /** 校验指定图片。 */ validate: [imageId: string] + /** 只读查看已保存的审核。 */ + readReview: [imageId: string] /** 打开失败图片对应类型的生成参数弹窗。 */ regenerate: [imageId: string] }>() @@ -129,12 +133,14 @@ defineExpose({ openCandidates, closeCandidates }) :identity-locked="identityLocked" :disabled="disabled" :pending-operation="pendingOperation" + :reading-saved-review-id="readingSavedReviewId" :validation-result="validationResult" :retry-disabled-reason="retryDisabledReason" :active="true" :description="displayImage.isAnchor ? anchorDescription : undefined" @anchor="emit('anchor', $event)" @validate="emit('validate', $event)" + @read-review="emit('readReview', $event)" @regenerate="regenerate" /> @@ -171,11 +177,13 @@ defineExpose({ openCandidates, closeCandidates }) :identity-locked="identityLocked" :disabled="disabled" :pending-operation="pendingOperation" + :reading-saved-review-id="readingSavedReviewId" :validation-result="validationResult" :retry-disabled-reason="retryDisabledReason" :active="candidatesOpen" @anchor="emit('anchor', $event)" @validate="emit('validate', $event)" + @read-review="emit('readReview', $event)" @regenerate="regenerate" /> diff --git a/src/features/subject-identity/components/IdentityImageCard.vue b/src/features/subject-identity/components/IdentityImageCard.vue index 3395bfb..b011122 100644 --- a/src/features/subject-identity/components/IdentityImageCard.vue +++ b/src/features/subject-identity/components/IdentityImageCard.vue @@ -22,6 +22,8 @@ const props = defineProps<{ disabled: boolean /** 当前固定目标的图片操作。 */ pendingOperation?: IdentityImageOperation | null + /** 当前正在读取历史审核的候选编号。 */ + readingSavedReviewId?: string /** 重新生成暂不可用的具体恢复步骤。 */ retryDisabledReason?: string /** 当前母版的使用说明,候选卡片不展示。 */ @@ -37,6 +39,8 @@ const emit = defineEmits<{ anchor: [imageId: string] /** 校验指定图片。 */ validate: [imageId: string] + /** 只读查看已保存的审核。 */ + readReview: [imageId: string] /** 打开失败图片对应的生成参数弹窗。 */ regenerate: [imageId: string] }>() @@ -235,6 +239,15 @@ function regenerate() { > {{ character ? '确认选角并锁定' : '设为身份母版' }} + + 查看已保存审核 { + return value && typeof value === 'object' && !Array.isArray(value) ? (value as Record) : {} +} + +/** + * 只展示与当前候选、当次生成输入绑定的已保存审核。当前来源仍由正式确认接口复核。 + * @param detail 同一候选的只读详情 + * @param image 图库中当前候选 + * @param subjectId 当前正式主体 + * @returns 可展示的已保存审核结果 + */ +export function savedIdentityValidation( + detail: IdentityImageDetails, + image: IdentityImage, + subjectId: string +): IdentityValidationResult { + if ( + !detail || + detail.id !== image.id || + detail.identityId !== image.identityId || + detail.viewType !== 'primary' || + detail.status !== 'completed' || + detail.imageUrl !== image.imageUrl || + detail.updatedAt !== image.updatedAt + ) + throw new Error('候选图片记录已变化,请刷新图库后重新查看审核。') + + let metadata: Record + try { + metadata = record(JSON.parse(detail.rawJson ?? '{}')) + } catch { + throw new Error('候选的审核记录无法读取。') + } + + const quality = record(metadata.qualityValidation) + const validation = record(quality.validation) + const fingerprint = record(metadata.providerInputSnapshot).fingerprint + if ( + quality.imageId !== image.id || + validation.imageId !== image.id || + validation.subjectId !== subjectId || + validation.imageUrl !== image.imageUrl || + !quality.subjectFormId || + validation.subjectFormId !== quality.subjectFormId || + quality.sourceCurrent !== true || + !metadata.sourceFingerprint || + quality.generationSourceFingerprint !== metadata.sourceFingerprint || + typeof fingerprint !== 'string' || + !/^[a-f0-9]{64}$/i.test(fingerprint) || + metadata.providerInputFingerprint !== fingerprint || + quality.providerInputFingerprint !== fingerprint || + validation.providerInputFingerprint !== fingerprint || + typeof quality.passed !== 'boolean' || + typeof validation.passed !== 'boolean' || + typeof validation.summary !== 'string' || + !Array.isArray(validation.issues) || + (validation.characterCheckResults !== undefined && !Array.isArray(validation.characterCheckResults)) || + (validation.sourceVisualRequirementResults !== undefined && + !Array.isArray(validation.sourceVisualRequirementResults)) || + !Array.isArray(validation.sourceVisualRequirements) || + !validation.sourceVisualRequirements.every(item => Array.isArray(record(item).quantities)) + ) + throw new Error('此候选没有可核对的已保存审核,或审核与生成依据不一致。') + + const rejected = + ['formConsistent', 'physicalStructureValid', 'spatialLayoutValid'].some( + key => quality[key] !== undefined && quality[key] !== true + ) || + (Array.isArray(quality.issues) && quality.issues.some(issue => record(issue).severity === 'error')) + return { + ...validation, + passed: quality.passed && validation.passed && !rejected + } as unknown as IdentityValidationResult +} diff --git a/src/features/subject-identity/types.ts b/src/features/subject-identity/types.ts index 6323318..1fe6997 100644 --- a/src/features/subject-identity/types.ts +++ b/src/features/subject-identity/types.ts @@ -35,6 +35,15 @@ export interface IdentityImage { updatedAt: string } +/** 只读图片详情中核对候选和历史审核所需的字段。 */ +export interface IdentityImageDetails extends Pick< + IdentityImage, + 'id' | 'identityId' | 'viewType' | 'status' | 'imageUrl' | 'updatedAt' +> { + /** 后端保存的生成与审核元数据,仅在数据层提取结构化证据。 */ + rawJson: string | null +} + /** 普通身份生图接口的异步提交回执,图片记录位于 image 字段。 */ export interface IdentityImageGenerationStart { /** 已持久化的后台任务编号。 */ diff --git a/src/features/subject-identity/useSubjectIdentity.ts b/src/features/subject-identity/useSubjectIdentity.ts index 1925d3a..2971d7d 100644 --- a/src/features/subject-identity/useSubjectIdentity.ts +++ b/src/features/subject-identity/useSubjectIdentity.ts @@ -2,6 +2,7 @@ import { ApiError } from '../../lib/http' import { imageValidationPassed } from '../subject-images/validation' import type { ImageGenerationSubmission } from '../subject-images/generation-preview' import { computed, ref, shallowRef, watch } from 'vue' +import { useQuery } from '../../composables/useQuery' import { usePolling } from '../../composables/usePolling' import { visualStyleApi } from '../visual-style' import { useProjectGenerationRevision } from '../generation-config/context' @@ -12,6 +13,7 @@ import { batchResultNotice, getOperation, runOperation, type OperationNotice } f import { useProjectMutationGuard } from '../workflows/useProjectMutationGuard' import { useProjectContext } from '../projects/context' import { subjectIdentityApi } from './api' +import { savedIdentityValidation } from './saved-validation' import { canBeAnchor, getIdentitySession, groupIdentitySubjects, mergeCastingSubjects } from './model' import type { IdentityImageOperation, @@ -214,16 +216,54 @@ export function useSubjectIdentity() { const validationSourceKey = computed(() => JSON.stringify([projectId.value, selectedId.value, identity.value, images.value]) ) + /** 仅在用户打开已保存审核时读取当前候选。 */ + const savedReviewImageId = ref('') + /** 读取正式详情,并绑定当前候选与请求发出时的主体。 */ + const savedReview = useQuery(savedReviewImageId, async (imageId, signal) => { + if (!imageId) return null + const current = subject.value + const image = images.value.find(item => item.id === imageId) + if (current?.module !== 'character' || !image || !canBeAnchor(image)) return null + const details = await subjectIdentityApi.imageDetails(current.id, imageId, signal) + return savedIdentityValidation(details, image, current.id) + }) + /** 单独标记读审核中的候选,不锁定抽屉关闭。 */ + const readingSavedReviewId = computed(() => (savedReview.loading.value ? savedReviewImageId.value : '')) + + /** + * 打开已保存的角色审核,不发起视觉校验。 + * @param imageId 用户选择的角色候选 + */ + function readSavedValidation(imageId: string) { + if ( + subject.value?.module !== 'character' || + !images.value.some(item => item.id === imageId && canBeAnchor(item)) + ) + return + delete validationResults.value[selectedId.value] + if (savedReviewImageId.value === imageId) void savedReview.refresh() + else savedReviewImageId.value = imageId + } + /** 来源变化或切换主体后清除旧审核展示,不能沿用历史通过。 */ watch( validationSourceKey, () => { delete validationResults.value[selectedId.value] + savedReviewImageId.value = '' }, { flush: 'sync' } ) /** 当前主体的指定图片校验结果。 */ - const validationResult = computed(() => validationResults.value[selectedId.value] ?? null) + const validationResult = computed( + () => + validationResults.value[selectedId.value] ?? + (!savedReview.loading.value && + !savedReview.error.value && + savedReview.data.value?.imageId === savedReviewImageId.value + ? savedReview.data.value + : null) + ) /** 当前主体的质量闭环回执。 */ const qualityResult = computed(() => qualityResults.value[selectedId.value] ?? null) /** 固定图片请求目标,切换主体后不把旧请求的加载状态附在新图片上。 */ @@ -284,6 +324,7 @@ export function useSubjectIdentity() { const name = subject.value.name const project = projectId.value const module = subject.value.module + savedReviewImageId.value = '' delete validationResults.value[id] const sourceKey = validationSourceKey.value await runImageOperation( @@ -712,6 +753,7 @@ export function useSubjectIdentity() { { type: 'success', content: `${name} 的角色选角已确认,身份已锁定。` } ) if (!confirmed) { + if (projectId.value === project && selectedId.value === subjectId) savedReviewImageId.value = '' delete validationResults.value[subjectId] await refreshImageConfirmation(project, subjectId) } @@ -762,6 +804,8 @@ export function useSubjectIdentity() { confirmStableAnchor, confirmCasting, validateImage, + readSavedValidation, + readingSavedReviewId, pendingImageOperation, generateStableAnchorQuality, validationResult, diff --git a/tests/features/projects/access.test.ts b/tests/features/projects/access.test.ts index 84c3353..74f9628 100644 --- a/tests/features/projects/access.test.ts +++ b/tests/features/projects/access.test.ts @@ -422,6 +422,71 @@ describe('剧本完成前的下游访问限制', () => { expect(wrapper!.find(`.n-menu a[href="/projects/${id}/production"]`).exists()).toBe(false) }) + it('采用正式分镜后,导航与直达路由使用当前项目的素材准入,仍保留制作门禁', async () => { + const id = 'adopted-preparation' + const state = readiness(id) + state.breakdown = { ready: false, reason: '正式分镜尚未完成人工审核' } + state.subjectAssets = { ready: false, reason: '主体图片仍需准备' } + vi.mocked(projectsApi.stageReadiness).mockImplementation(async projectId => + projectId === id ? state : readiness(id) + ) + vi.spyOn(projectsApi, 'detail').mockImplementation(async projectId => project(projectId, 'completed')) + vi.spyOn(projectsApi, 'checkpoints').mockResolvedValue([ + { + checkpointId: 'adopted', + workflowName: 'breakdown', + createdAt: '2026-10-01T10:00:00Z', + state: { + storyboardPersisted: true, + candidateCommitted: true, + workflowExecution: { executionId: 'old', status: 'failed', startedAt: '2026-10-01T09:00:00Z' } + } + } + ]) + const { router, mounted } = await openProject(`/projects/${id}/breakdown`) + for (const section of ['visual-style', 'subject-identity', 'subject-images']) { + await wrapper!.get(`.n-menu a[href="/projects/${id}/${section}"]`).trigger('click') + await flushPromises() + expect(wrapper!.get('.workspace-probe').text()).toBe(section) + } + await router.push(`/projects/${id}/production`) + await flushPromises() + expect(wrapper!.get('.project-access-gate').text()).toContain('正式分镜尚未完成人工审核') + expect(wrapper!.get('.n-menu [aria-disabled="true"][title="正式分镜尚未完成人工审核"]').text()).toContain( + '正式分镜尚未完成人工审核' + ) + await router.push('/projects/other-project/subject-identity') + await flushPromises() + expect(wrapper!.find('.workspace-probe').exists()).toBe(false) + expect(wrapper!.find('.n-menu a[href="/projects/other-project/subject-identity"]').exists()).toBe(false) + expect(mounted.mock.calls.flat()).toEqual(['breakdown', 'visual-style', 'subject-identity', 'subject-images']) + }) + + it('候选未采用时,不以镜头存在推定素材准备通过', async () => { + const id = 'candidate-without-adoption' + const state = readiness(id) + state.preparation = { ready: false, reason: '请先采用当前候选分镜' } + state.breakdown = { ready: false, reason: '尚无正式分镜' } + vi.mocked(projectsApi.stageReadiness).mockResolvedValue(state) + vi.spyOn(projectsApi, 'detail').mockResolvedValue(project(id, 'completed')) + vi.spyOn(projectsApi, 'checkpoints').mockResolvedValue([ + { + checkpointId: 'unadopted', + workflowName: 'breakdown', + createdAt: '2026-10-01T10:00:00Z', + state: { + candidateOnly: true, + storyboardPersisted: false, + storyboardShotValidation: { valid: true, issues: [] } + } + } + ]) + const { mounted } = await openProject(`/projects/${id}/subject-identity`) + expect(mounted).not.toHaveBeenCalled() + expect(wrapper!.get('.project-access-gate').text()).toContain('请先采用当前候选分镜') + expect(wrapper!.find(`.n-menu a[href="/projects/${id}/subject-identity"]`).exists()).toBe(false) + }) + it('部分身份未齐备时可以逐项准备形态资料,但不能提前进入镜头设计或生产', async () => { const id = 'partial-asset-preparation' const state = readiness(id) diff --git a/tests/features/workflows/pages.test.ts b/tests/features/workflows/pages.test.ts index 5cfc17a..1f97cae 100644 --- a/tests/features/workflows/pages.test.ts +++ b/tests/features/workflows/pages.test.ts @@ -1313,13 +1313,34 @@ describe('视觉风格与主体身份工作区', () => { expect(fetcher.mock.calls.every(([, init]) => init?.method === 'GET')).toBe(true) }) - it('Character 确认选角原子切换 Anchor 并锁定 Identity,不调用普通母版接口', async () => { + it('Character 读取已保存审核后确认选角,刷新 Anchor、基础形态和项目准入', async () => { let locked = false let selected = false const candidate = identityImageFixture({ id: 'casting-1', isAnchor: false }) + const fingerprint = 'a'.repeat(64) + const generationSource = 'b'.repeat(64) + const validation = { + ...approvedCharacter(candidate.id), + imageUrl: candidate.imageUrl, + subjectFormId: 'form-db-1', + providerInputFingerprint: fingerprint + } const fetcher = vi.fn().mockImplementation(async (url, init) => { const path = String(url) - if (path.endsWith('/subject-forms')) return jsonResponse([formFixture()]) + if (path.endsWith('/subject-forms')) { + const form = formFixture() + if (locked) { + form.subject.identity = { id: candidate.identityId, isLocked: true, anchorImageId: candidate.id } + form.images = [ + imageFixture({ + imageUrl: candidate.imageUrl, + source: 'identity-anchor', + identityAnchorImageId: candidate.id + }) + ] + } + return jsonResponse([form]) + } if (path.endsWith('/visual-style')) return jsonResponse(styleFixture()) if (path.endsWith('/character-casting/readiness')) return jsonResponse({ @@ -1345,8 +1366,24 @@ describe('视觉风格与主体身份工作区', () => { ] }) if (path.endsWith('/identity/images')) return jsonResponse([{ ...candidate, isAnchor: selected }]) - if (init?.method === 'POST' && path.endsWith('/validate')) - return jsonResponse(approvedCharacter(candidate.id)) + if (path.endsWith('/identity/images/casting-1')) + return jsonResponse({ + ...candidate, + rawJson: JSON.stringify({ + sourceFingerprint: generationSource, + providerInputFingerprint: fingerprint, + providerInputSnapshot: { fingerprint }, + qualityValidation: { + imageId: candidate.id, + subjectFormId: 'form-db-1', + sourceCurrent: true, + generationSourceFingerprint: generationSource, + providerInputFingerprint: fingerprint, + passed: true, + validation + } + }) + }) if (init?.method === 'PUT' && path.endsWith('/casting')) { locked = true selected = true @@ -1360,12 +1397,14 @@ describe('视觉风格与主体身份工作区', () => { return jsonResponse(identityFixture({ isLocked: locked })) }) stubFetch(fetcher) - await mountAssets('identity') + const projectData = await mountAssets('identity') expect(wrapper!.text()).toContain('待确认选角') expect(wrapper!.find('.identity-anchor-grid').exists()).toBe(true) expect(button('确认选角并锁定').disabled).toBe(true) - wrapper!.findComponent(IdentityGallery).vm.$emit('validate', candidate.id) + button('查看已保存审核').click() await flushPromises() + expect(wrapper!.text()).toContain('画面交付要求') + expect(fetcher.mock.calls.every(([, init]) => init?.method === 'GET')).toBe(true) button('确认选角并锁定').click() await flushPromises() button('确认演员选择').click() @@ -1373,6 +1412,12 @@ describe('视觉风格与主体身份工作区', () => { const put = fetcher.mock.calls.find(([, init]) => init?.method === 'PUT')! expect(put[0]).toBe('/api/subjects/subject-db-1/identity/images/casting-1/casting') expect(fetcher.mock.calls.some(([url]) => String(url).endsWith('/anchor'))).toBe(false) + const confirmationIndex = fetcher.mock.calls.indexOf(put) + expect( + fetcher.mock.calls.slice(confirmationIndex + 1).some(([url]) => String(url).endsWith('/subject-forms')) + ).toBe(true) + expect(fetcher.mock.calls.some(([, init]) => init?.method === 'POST')).toBe(false) + expect(projectData.refreshStageReadiness).toHaveBeenCalled() expect(wrapper!.text()).toContain('主体身份已完成') expect(wrapper!.get('.identity-gallery').text()).toContain('已确认并锁定') })