From 373ad4c2a5e4574f1bbdbd17e27231c7bcdb3d5b Mon Sep 17 00:00:00 2001 From: luo Date: Mon, 10 Aug 2026 14:44:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=A1=E8=AE=A1=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../audit/AuditInvestigationLinks.vue | 18 ++- src/types/components.d.ts | 2 + src/views/audit/events/detail.vue | 114 +++++++++++++----- 3 files changed, 101 insertions(+), 33 deletions(-) diff --git a/src/components/business/audit/AuditInvestigationLinks.vue b/src/components/business/audit/AuditInvestigationLinks.vue index d2068aa..80230e9 100644 --- a/src/components/business/audit/AuditInvestigationLinks.vue +++ b/src/components/business/audit/AuditInvestigationLinks.vue @@ -3,15 +3,19 @@ 事件详情 操作者行为时间线 - 资源审计时间线 + {{ resourceTimelineLabel(resource) }} (), - { currentEventId: '', showEmpty: true } + { currentEventId: '', showEmpty: true, showResources: true } ) const searchableTypes = new Set([ 'iot_card', @@ -111,8 +117,8 @@ actorRef.value || requestId.value || correlationId.value || - stableResourceRefs.value.length || - searchableResourceRefs.value.length || + (props.showResources && + (stableResourceRefs.value.length || searchableResourceRefs.value.length)) || stableIntegrationRefs.value.length ) ) @@ -135,6 +141,10 @@ resourceType: resource.resource_type, id: resource.resource_id }) + const resourceTimelineLabel = ( + resource: AuditInvestigationResourceRef & { resource_id: string } + ) => + `资源审计时间线 · ${auditResourceTypeLabels[resource.resource_type] || resource.resource_type} · ${resource.resource_id}` const searchResource = ( resource: AuditInvestigationResourceRef & { resource_type: AuditSearchResourceType diff --git a/src/types/components.d.ts b/src/types/components.d.ts index 439fe0a..c20fcf4 100644 --- a/src/types/components.d.ts +++ b/src/types/components.d.ts @@ -99,6 +99,8 @@ declare module 'vue' { ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup'] ElCol: typeof import('element-plus/es')['ElCol'] + ElCollapse: typeof import('element-plus/es')['ElCollapse'] + ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] ElDescriptions: typeof import('element-plus/es')['ElDescriptions'] diff --git a/src/views/audit/events/detail.vue b/src/views/audit/events/detail.vue index 6f30542..e94940e 100644 --- a/src/views/audit/events/detail.vue +++ b/src/views/audit/events/detail.vue @@ -99,32 +99,11 @@ > - - - - + + + + @@ -170,6 +162,37 @@ + +
+ + +
{{ auditJson(selectedResource.identity_snapshot) }}
+
+
+ + +
{{ auditJson(selectedResource.subject_data) }}
+
+
+
+ + +
{{ auditJson(selectedResource.before_data) }}
+
+
+ + +
{{ auditJson(selectedResource.after_data) }}
+
+
+
+
+
@@ -195,6 +218,7 @@ import { formatDateTime } from '@/utils/business/format' import { useUserStore } from '@/store/modules/user' import AuditInvestigationLinks from '@/components/business/audit/AuditInvestigationLinks.vue' + import { openAuditInvestigation } from '@/components/business/audit/investigationController' defineOptions({ name: 'AuditEventDetail' }) const route = useRoute() @@ -202,6 +226,14 @@ const userStore = useUserStore() const loading = ref(false) const detail = ref() + const snapshotDialogVisible = ref(false) + const selectedResource = ref() + const snapshotDialogTitle = computed(() => { + const resource = selectedResource.value + if (!resource) return '资源快照' + const type = auditResourceTypeLabels[resource.resource_type] || resource.resource_type + return `资源快照 · ${resource.display_name || resource.resource_id || type}` + }) const scopeDisplay = computed(() => { if (!detail.value) return '-' const type = auditScopeTypeLabels[detail.value.scope_type] || detail.value.scope_type @@ -223,6 +255,18 @@ [row.resource_type, row.resource_id || row.resource_key || row.sort_order || row.display_name] .filter((item) => item !== null && item !== undefined && item !== '') .join(':') + const openSnapshotDialog = (row: AuditResourceView) => { + selectedResource.value = row + snapshotDialogVisible.value = true + } + const openResourceTimeline = (row: AuditResourceView) => { + if (!row.resource_id) return + openAuditInvestigation({ + mode: 'resource', + resourceType: row.resource_type, + id: row.resource_id + }) + } onMounted(async () => { const id = String(route.params.eventId || '') if (!id) return @@ -279,14 +323,22 @@ display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; - padding: 8px 16px 16px; + padding: 8px 0; } - .resource-snapshot-grid h4 { - margin: 0 0 8px; - font-size: 14px; - font-weight: 600; - color: var(--el-text-color-primary); + .resource-snapshot-diff { + display: grid; + grid-column: 1 / -1; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 16px; + } + + .resource-snapshot-section { + min-width: 0; + } + + .resource-snapshot-section :deep(.el-collapse-item__content) { + padding-bottom: 0; } .resource-snapshot-grid pre { @@ -319,5 +371,9 @@ .resource-snapshot-grid { grid-template-columns: 1fr; } + + .resource-snapshot-diff { + grid-template-columns: 1fr; + } }