fix: 补齐过期首帧素材定位与图库影响提示
This commit is contained in:
1 parent
f71d2bf0a4
commit
771b66cafc
11 files changed
+826
-23
No files matched your search
@@ -0,0 +1,63 @@
|
||||
import type { ProductionIssue } from './types'
|
||||
import type { ShotReferences } from '../storyboard/types'
|
||||
|
||||
/** 素材定位使用正式 Form ID;无当前关联时只保留主体引用,不猜测形态。 */
|
||||
export interface ReferenceTarget {
|
||||
subjectRef: string
|
||||
subjectId?: string
|
||||
formId?: string
|
||||
label: string
|
||||
}
|
||||
|
||||
/** 优先使用后端结构化变更引用;仅有过期标记时展示全部当前关联素材,不能称其全部已变更。 */
|
||||
export function referenceTargets(references: ShotReferences | null, issues: ProductionIssue[]): ReferenceTarget[] {
|
||||
const changed = [
|
||||
...new Set(
|
||||
issues.filter(issue => issue.code === 'stale_keyframe').flatMap(issue => issue.missingSubjects ?? [])
|
||||
)
|
||||
]
|
||||
const available = references?.references ?? []
|
||||
const refs = changed.length
|
||||
? changed
|
||||
: [
|
||||
...new Set([
|
||||
...available.map(item => item.subjectRef),
|
||||
...(references?.missing ?? []).map(item => item.subjectRef)
|
||||
])
|
||||
]
|
||||
return refs.flatMap(ref => {
|
||||
const matches = available.filter(item => item.subjectRef === ref || item.subjectId === ref)
|
||||
if (matches.length)
|
||||
return matches.map(item => ({
|
||||
subjectRef: item.subjectRef,
|
||||
subjectId: item.subjectId,
|
||||
formId: item.subjectFormId,
|
||||
label: `${item.subjectName} · ${item.subjectFormName}(${item.subjectRef})`
|
||||
}))
|
||||
const missing = references?.missing.find(item => item.subjectRef === ref || item.subjectId === ref)
|
||||
return [
|
||||
{
|
||||
subjectRef: missing?.subjectRef ?? ref,
|
||||
subjectId: missing?.subjectId,
|
||||
label: `${missing?.subjectName ? `${missing.subjectName} · ` : ''}${ref}(当前形态待核对)`
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
/** 深链接保留来源镜头,图库据此读取实时状态而不是相信 URL 的过期标记。 */
|
||||
export function referenceLocation(projectId: string, shotId: string, target: ReferenceTarget) {
|
||||
return {
|
||||
path: `/projects/${encodeURIComponent(projectId)}/subject-images`,
|
||||
query: {
|
||||
sourceShotId: shotId,
|
||||
subjectRef: target.subjectRef,
|
||||
...(target.formId ? { subjectFormId: target.formId } : {})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 从 URL 取单值查询参数,不接受多值数组或空白值。 */
|
||||
export function queryText(value: unknown): string {
|
||||
return typeof value === 'string' ? value.trim() : ''
|
||||
}
|
||||
Reference in new issue
Block a user