feat: 操作审计页筛选/列表/分页合并为一张白卡
- 筛选栏与数据列表由两张独立 VCard 合并为同一张白卡, 卡片之间不再留 1rem 灰缝,白色区域连成一体 - 分页条移入卡片内部末尾并铺满整行:白底与上方列表左右对齐, 上下各留 1rem 内边距使文字位置与原先一致,上边缘加 1px #eaecf0 分隔线(同控制台卡片 footer 观感) - 错误提示移至白卡上方并留出 1rem 间距 - 更新 AuditLogList.appearance.spec.ts 为「单张白卡」断言
This commit is contained in:
@@ -4,10 +4,12 @@ import { describe, expect, it } from 'vitest'
|
||||
|
||||
// 结构性回归测试:不渲染组件,仅检查 SFC 源码中的页面布局样式。
|
||||
// 操作审计页需保持控制台默认灰底(.audit-page 不自行设置背景色),
|
||||
// 筛选栏、数据列表以白色卡片呈现,与控制台其他页面观感一致;
|
||||
// 筛选栏、数据列表、分页条合并为同一张白色卡片:区块之间不留灰缝,
|
||||
// 分页条白底随卡片铺满整行、与上方列表左右对齐(与控制台其他列表页观感一致);
|
||||
// flex: 1 撑满 main-content 剩余高度,使灰底延伸到页面底部。
|
||||
// 分页条两端需向内留白,不贴内容区边缘。
|
||||
// 历史上 .audit-page 曾整体铺白导致页面与其他页面观感不一致,本测试防止回归。
|
||||
// 历史上 .audit-page 曾整体铺白导致页面与其他页面观感不一致,
|
||||
// 分页条曾左右各留 1rem 导致白底与上方卡片错位,
|
||||
// 卡片之间曾留 1rem 间距导致白色断开,本测试防止回归。
|
||||
const sfc = readFileSync(fileURLToPath(new URL('./AuditLogList.vue', import.meta.url)), 'utf-8')
|
||||
|
||||
function styleRule(selector: string): string {
|
||||
@@ -24,8 +26,19 @@ describe('AuditLogList 页面外观', () => {
|
||||
expect(rule).not.toMatch(/background\s*:/)
|
||||
})
|
||||
|
||||
it('.audit-pagination 左右向内留白,两端不贴内容区边缘', () => {
|
||||
it('.audit-body 不设区块间距(筛选/数据/分页之间白色连成一体)', () => {
|
||||
const rule = styleRule('.audit-body')
|
||||
expect(rule).not.toMatch(/gap\s*:/)
|
||||
})
|
||||
|
||||
it('筛选栏与数据列表合并为同一张 VCard', () => {
|
||||
expect(sfc.match(/<VCard/g)?.length).toBe(1)
|
||||
})
|
||||
|
||||
it('.audit-pagination 白底铺满整行(不再左右缩进 1rem),仅以 1px 分隔线与列表相接', () => {
|
||||
const rule = styleRule('.audit-pagination')
|
||||
expect(rule).toMatch(/padding:\s*0\s+1rem\s+1rem/)
|
||||
expect(rule).not.toMatch(/padding:\s*0\s+1rem/)
|
||||
expect(rule).toMatch(/padding:\s*1rem/)
|
||||
expect(rule).toMatch(/border-top:\s*1px\s+solid\s+#eaecf0/)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -163,69 +163,71 @@ onMounted(fetchLogs)
|
||||
</VPageHeader>
|
||||
|
||||
<div class="audit-body">
|
||||
<!-- 筛选栏(只读查询,无任何修改/删除入口) -->
|
||||
<VCard :body-class="['audit-filter']">
|
||||
<div class="filter-grid">
|
||||
<label class="filter-item">
|
||||
<span>操作者</span>
|
||||
<input
|
||||
v-model="filterUsername"
|
||||
type="text"
|
||||
placeholder="用户名,精确匹配"
|
||||
/>
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>资源类型</span>
|
||||
<select v-model="filterResourceType">
|
||||
<option value="">全部</option>
|
||||
<option v-for="t in RESOURCE_TYPES" :key="t" :value="t">{{ t }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>动作</span>
|
||||
<select v-model="filterMethod">
|
||||
<option value="">全部</option>
|
||||
<option value="POST">POST</option>
|
||||
<option value="PUT">PUT</option>
|
||||
<option value="DELETE">DELETE</option>
|
||||
<option value="PATCH">PATCH</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>结果</span>
|
||||
<select v-model="filterResult">
|
||||
<option value="">全部</option>
|
||||
<option value="success">成功</option>
|
||||
<option value="failure">失败</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>关键字</span>
|
||||
<input
|
||||
v-model="filterKeyword"
|
||||
type="text"
|
||||
placeholder="资源名称 / 路径模糊匹配"
|
||||
@keyup.enter="applyFilters"
|
||||
/>
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>开始时间</span>
|
||||
<input v-model="filterStartTime" type="datetime-local" @change="applyFilters" />
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>结束时间</span>
|
||||
<input v-model="filterEndTime" type="datetime-local" @change="applyFilters" />
|
||||
</label>
|
||||
<div class="filter-actions">
|
||||
<VButton size="sm" @click="applyFilters">查询</VButton>
|
||||
<VButton size="sm" :disabled="!hasActiveFilter" @click="resetFilter">重置</VButton>
|
||||
</div>
|
||||
</div>
|
||||
</VCard>
|
||||
|
||||
<VAlert v-if="error" class="audit-error" type="error" :closable="true" :title="error" />
|
||||
|
||||
<!-- 筛选栏、数据列表、分页条合并为一张白卡:区块之间不再露出灰缝,
|
||||
分页条白底随卡片铺满整行、与上方列表左右对齐(文字位置保持不变) -->
|
||||
<VCard :body-class="['!p-0']">
|
||||
<!-- 筛选栏(只读查询,无任何修改/删除入口) -->
|
||||
<div class="audit-filter">
|
||||
<div class="filter-grid">
|
||||
<label class="filter-item">
|
||||
<span>操作者</span>
|
||||
<input
|
||||
v-model="filterUsername"
|
||||
type="text"
|
||||
placeholder="用户名,精确匹配"
|
||||
/>
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>资源类型</span>
|
||||
<select v-model="filterResourceType">
|
||||
<option value="">全部</option>
|
||||
<option v-for="t in RESOURCE_TYPES" :key="t" :value="t">{{ t }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>动作</span>
|
||||
<select v-model="filterMethod">
|
||||
<option value="">全部</option>
|
||||
<option value="POST">POST</option>
|
||||
<option value="PUT">PUT</option>
|
||||
<option value="DELETE">DELETE</option>
|
||||
<option value="PATCH">PATCH</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>结果</span>
|
||||
<select v-model="filterResult">
|
||||
<option value="">全部</option>
|
||||
<option value="success">成功</option>
|
||||
<option value="failure">失败</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>关键字</span>
|
||||
<input
|
||||
v-model="filterKeyword"
|
||||
type="text"
|
||||
placeholder="资源名称 / 路径模糊匹配"
|
||||
@keyup.enter="applyFilters"
|
||||
/>
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>开始时间</span>
|
||||
<input v-model="filterStartTime" type="datetime-local" @change="applyFilters" />
|
||||
</label>
|
||||
<label class="filter-item">
|
||||
<span>结束时间</span>
|
||||
<input v-model="filterEndTime" type="datetime-local" @change="applyFilters" />
|
||||
</label>
|
||||
<div class="filter-actions">
|
||||
<VButton size="sm" @click="applyFilters">查询</VButton>
|
||||
<VButton size="sm" :disabled="!hasActiveFilter" @click="resetFilter">重置</VButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<VLoading v-if="loading && !logs.length" />
|
||||
<template v-else>
|
||||
<VEmpty
|
||||
@@ -287,16 +289,16 @@ onMounted(fetchLogs)
|
||||
</VEntity>
|
||||
</template>
|
||||
</template>
|
||||
<!-- 分页条置于卡片内部末尾:白底铺满整行,与上方列表左右对齐 -->
|
||||
<div v-if="total > 0" class="audit-pagination">
|
||||
<VPagination
|
||||
v-model:page="page"
|
||||
v-model:size="size"
|
||||
:total="total"
|
||||
:size-options="[10, 20, 50]"
|
||||
/>
|
||||
</div>
|
||||
</VCard>
|
||||
|
||||
<div v-if="total > 0" class="audit-pagination">
|
||||
<VPagination
|
||||
v-model:page="page"
|
||||
v-model:size="size"
|
||||
:total="total"
|
||||
:size-options="[10, 20, 50]"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<AuditLogDetail v-model:visible="detailVisible" :log="selectedLog" />
|
||||
@@ -315,7 +317,7 @@ onMounted(fetchLogs)
|
||||
padding: 1rem 1.25rem 2rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
/* 筛选、数据、分页合并为一张白卡,区块之间不留灰缝 */
|
||||
}
|
||||
.audit-logo {
|
||||
display: inline-flex;
|
||||
@@ -365,6 +367,8 @@ onMounted(fetchLogs)
|
||||
}
|
||||
.audit-error {
|
||||
--tw-ring-color: transparent;
|
||||
/* 错误提示位于白卡上方,与卡片留出间距 */
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
.audit-row {
|
||||
cursor: pointer;
|
||||
@@ -406,9 +410,9 @@ onMounted(fetchLogs)
|
||||
.status-ok { color: #0f766e; background: rgba(76, 203, 160, 0.15); }
|
||||
.status-fail { color: var(--audit-red); background: rgba(215, 29, 29, 0.12); }
|
||||
.audit-pagination {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
/* 左右各留 1rem,与内容区留白呼应 */
|
||||
padding: 0 1rem 1rem;
|
||||
/* 在白卡内铺满整行:白底与上方列表左右对齐;上下各留 1rem,
|
||||
文字的垂直位置与原分页条一致;上边缘 1px 分隔线同控制台卡片 footer 观感 */
|
||||
padding: 1rem;
|
||||
border-top: 1px solid #eaecf0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user