This commit is contained in:
@@ -20,19 +20,14 @@
|
||||
>
|
||||
精确注册资源
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-if="refs?.request_id"
|
||||
link
|
||||
type="primary"
|
||||
@click="openTimeline('request', refs.request_id)"
|
||||
>
|
||||
<ElButton v-if="requestId" link type="primary" @click="openTimeline('request', requestId)">
|
||||
请求链路
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-if="refs?.correlation_id"
|
||||
v-if="correlationId"
|
||||
link
|
||||
type="primary"
|
||||
@click="openTimeline('correlation', refs.correlation_id)"
|
||||
@click="openTimeline('correlation', correlationId)"
|
||||
>
|
||||
业务关联链路
|
||||
</ElButton>
|
||||
@@ -57,6 +52,7 @@
|
||||
AuditSearchResourceType
|
||||
} from '@/types/api'
|
||||
import { openAuditInvestigation, openAuditResourceSearch } from './investigationController'
|
||||
import { resolveInvestigationReference } from '@/utils/business/auditNavigation'
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -73,10 +69,16 @@
|
||||
'order',
|
||||
'refund'
|
||||
])
|
||||
const eventId = computed(() => {
|
||||
const id = props.refs?.event_id?.trim()
|
||||
return id && id !== props.currentEventId ? id : ''
|
||||
})
|
||||
const eventId = computed(
|
||||
() =>
|
||||
resolveInvestigationReference(props.refs?.event_id, {
|
||||
currentId: props.currentEventId
|
||||
}) || ''
|
||||
)
|
||||
const requestId = computed(() => resolveInvestigationReference(props.refs?.request_id) || '')
|
||||
const correlationId = computed(
|
||||
() => resolveInvestigationReference(props.refs?.correlation_id) || ''
|
||||
)
|
||||
const actorRef = computed(() => {
|
||||
const actor = props.refs?.actor_ref
|
||||
return actor?.kind && actor.id ? actor : null
|
||||
@@ -107,8 +109,8 @@
|
||||
Boolean(
|
||||
eventId.value ||
|
||||
actorRef.value ||
|
||||
props.refs?.request_id ||
|
||||
props.refs?.correlation_id ||
|
||||
requestId.value ||
|
||||
correlationId.value ||
|
||||
stableResourceRefs.value.length ||
|
||||
searchableResourceRefs.value.length ||
|
||||
stableIntegrationRefs.value.length
|
||||
|
||||
@@ -8,6 +8,22 @@ interface AuditResourceRouteOptions {
|
||||
businessIdentifier?: string | null
|
||||
}
|
||||
|
||||
interface AuditReferenceOptions {
|
||||
currentId?: string | null
|
||||
fidelity?: boolean | null
|
||||
}
|
||||
|
||||
/** 仅保留非空、可靠且不会回到当前目标的显式调查引用。 */
|
||||
export function resolveInvestigationReference(
|
||||
value?: string | null,
|
||||
options: AuditReferenceOptions = {}
|
||||
): string | null {
|
||||
if (options.fidelity === false) return null
|
||||
const normalizedValue = value?.trim()
|
||||
if (!normalizedValue || normalizedValue === options.currentId?.trim()) return null
|
||||
return normalizedValue
|
||||
}
|
||||
|
||||
/** 根据当前主体选择平台内部 ID 或主体安全业务标识。 */
|
||||
export function resolveAuditResourceTarget(
|
||||
options: AuditResourceRouteOptions
|
||||
|
||||
@@ -94,30 +94,28 @@
|
||||
<template #header>调查入口</template>
|
||||
<div v-if="hasAssociations" class="link-actions">
|
||||
<ElButton
|
||||
v-if="detail.linkage.request_id"
|
||||
v-if="requestReference"
|
||||
type="primary"
|
||||
plain
|
||||
@click="
|
||||
openAuditInvestigation({ mode: 'request', id: detail.linkage.request_id })
|
||||
"
|
||||
@click="openAuditInvestigation({ mode: 'request', id: requestReference })"
|
||||
>
|
||||
请求链路
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-if="detail.linkage.correlation_id"
|
||||
v-if="correlationReference"
|
||||
type="primary"
|
||||
plain
|
||||
@click="
|
||||
openAuditInvestigation({
|
||||
mode: 'correlation',
|
||||
id: detail.linkage.correlation_id
|
||||
id: correlationReference
|
||||
})
|
||||
"
|
||||
>
|
||||
业务关联链路
|
||||
</ElButton>
|
||||
<ElButton
|
||||
v-if="detail.resource?.type && detail.resource?.id"
|
||||
v-if="detail.resource?.type && resourceReference"
|
||||
type="primary"
|
||||
plain
|
||||
@click="openResourceTimeline"
|
||||
@@ -258,6 +256,7 @@
|
||||
} from '@/utils/business/audit'
|
||||
import { formatDateTime } from '@/utils/business/format'
|
||||
import { openAuditInvestigation } from '@/components/business/audit/investigationController'
|
||||
import { resolveInvestigationReference } from '@/utils/business/auditNavigation'
|
||||
|
||||
defineOptions({ name: 'AuditIntegrationDetail' })
|
||||
|
||||
@@ -272,11 +271,24 @@
|
||||
const hasResource = computed(() =>
|
||||
Boolean(detail.value?.resource?.type || detail.value?.resource?.key)
|
||||
)
|
||||
const requestReference = computed(() =>
|
||||
resolveInvestigationReference(detail.value?.linkage.request_id)
|
||||
)
|
||||
const correlationReference = computed(() =>
|
||||
resolveInvestigationReference(detail.value?.linkage.correlation_id, {
|
||||
fidelity: detail.value?.fidelity.correlation_available
|
||||
})
|
||||
)
|
||||
const resourceReference = computed(() =>
|
||||
resolveInvestigationReference(detail.value?.resource?.id, {
|
||||
fidelity: detail.value?.fidelity.resource_id_available
|
||||
})
|
||||
)
|
||||
const hasAssociations = computed(() =>
|
||||
Boolean(
|
||||
detail.value?.linkage.request_id ||
|
||||
detail.value?.linkage.correlation_id ||
|
||||
(detail.value?.resource?.type && detail.value?.resource?.id)
|
||||
requestReference.value ||
|
||||
correlationReference.value ||
|
||||
(detail.value?.resource?.type && resourceReference.value)
|
||||
)
|
||||
)
|
||||
const hasJsonContent = (value?: Record<string, unknown> | null) =>
|
||||
@@ -294,11 +306,11 @@
|
||||
integrationCategoryMeta[category as keyof typeof integrationCategoryMeta]?.type || 'info'
|
||||
const formatOptionalDate = (value?: string | null) => (value ? formatDateTime(value) : '-')
|
||||
const openResourceTimeline = () => {
|
||||
if (!detail.value?.resource?.type || !detail.value.resource.id) return
|
||||
if (!detail.value?.resource?.type || !resourceReference.value) return
|
||||
openAuditInvestigation({
|
||||
mode: 'resource',
|
||||
resourceType: detail.value.resource.type,
|
||||
id: detail.value.resource.id
|
||||
id: resourceReference.value
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user