feat: 列表行内「查看该资源历史」快捷动作(P1-1,纯前端)
- AuditLogList 资源列行内新增「历史」小链接(仅有资源名称的记录展示), 点击预填资源类型 + 资源名关键字(关键字匹配资源名称/路径)并刷新列表, 停止冒泡避免触发行点击的详情抽屉 - 不新增后端参数,与现有筛选/导出条件共用同一套状态(buildQuery 不变) - 新增 vitest 结构性回归测试(预填与请求参数生成/行内渲染/冒泡阻止)
This commit is contained in:
@@ -176,6 +176,17 @@ function resetFilter() {
|
||||
filterEndTime.value = ''
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看该资源历史(功能评审 P1-1):行内快捷动作——预填资源类型 + 资源名关键字
|
||||
* (关键字匹配资源名称/路径)并刷新列表,与现有筛选/导出条件共用同一套状态,
|
||||
* 不新增后端参数。仅在有资源名称的记录上提供(集合级/登录操作无可回溯的具体资源)。
|
||||
*/
|
||||
function viewResourceHistory(log: AuditLog) {
|
||||
filterResourceType.value = log.spec.resourceType
|
||||
filterKeyword.value = log.spec.resourceName ?? ''
|
||||
applyFilters()
|
||||
}
|
||||
|
||||
watch([filterUsername, filterResourceType, filterMethod, filterAction, filterResult], () => {
|
||||
page.value = 1
|
||||
fetchLogs()
|
||||
@@ -348,6 +359,14 @@ onMounted(fetchLogs)
|
||||
{{ log.spec.resourceType }}
|
||||
<template v-if="log.spec.resourceName">/ {{ log.spec.resourceName }}</template>
|
||||
</span>
|
||||
<!-- 行内快捷动作(功能评审 P1-1):查看该资源的历史操作;
|
||||
stop 冒泡避免触发行点击的详情抽屉 -->
|
||||
<a
|
||||
v-if="log.spec.resourceName"
|
||||
class="resource-history-link"
|
||||
title="查看该资源的历史操作"
|
||||
@click.stop="viewResourceHistory(log)"
|
||||
>历史</a>
|
||||
</template>
|
||||
<template #description>
|
||||
<span class="row-sub">{{ log.spec.path }}</span>
|
||||
@@ -506,6 +525,16 @@ onMounted(fetchLogs)
|
||||
.resource-text {
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
/* 行内快捷动作:查看该资源历史(P1-1),主题绿小链接 */
|
||||
.resource-history-link {
|
||||
margin-left: 0.375rem;
|
||||
font-size: 0.75rem;
|
||||
color: var(--audit-green);
|
||||
cursor: pointer;
|
||||
}
|
||||
.resource-history-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.method-badge {
|
||||
display: inline-block;
|
||||
padding: 0.1rem 0.4rem;
|
||||
|
||||
Reference in New Issue
Block a user