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 源码中的页面布局样式。
|
// 结构性回归测试:不渲染组件,仅检查 SFC 源码中的页面布局样式。
|
||||||
// 操作审计页需保持控制台默认灰底(.audit-page 不自行设置背景色),
|
// 操作审计页需保持控制台默认灰底(.audit-page 不自行设置背景色),
|
||||||
// 筛选栏、数据列表以白色卡片呈现,与控制台其他页面观感一致;
|
// 筛选栏、数据列表、分页条合并为同一张白色卡片:区块之间不留灰缝,
|
||||||
|
// 分页条白底随卡片铺满整行、与上方列表左右对齐(与控制台其他列表页观感一致);
|
||||||
// flex: 1 撑满 main-content 剩余高度,使灰底延伸到页面底部。
|
// flex: 1 撑满 main-content 剩余高度,使灰底延伸到页面底部。
|
||||||
// 分页条两端需向内留白,不贴内容区边缘。
|
// 历史上 .audit-page 曾整体铺白导致页面与其他页面观感不一致,
|
||||||
// 历史上 .audit-page 曾整体铺白导致页面与其他页面观感不一致,本测试防止回归。
|
// 分页条曾左右各留 1rem 导致白底与上方卡片错位,
|
||||||
|
// 卡片之间曾留 1rem 间距导致白色断开,本测试防止回归。
|
||||||
const sfc = readFileSync(fileURLToPath(new URL('./AuditLogList.vue', import.meta.url)), 'utf-8')
|
const sfc = readFileSync(fileURLToPath(new URL('./AuditLogList.vue', import.meta.url)), 'utf-8')
|
||||||
|
|
||||||
function styleRule(selector: string): string {
|
function styleRule(selector: string): string {
|
||||||
@@ -24,8 +26,19 @@ describe('AuditLogList 页面外观', () => {
|
|||||||
expect(rule).not.toMatch(/background\s*:/)
|
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')
|
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,8 +163,13 @@ onMounted(fetchLogs)
|
|||||||
</VPageHeader>
|
</VPageHeader>
|
||||||
|
|
||||||
<div class="audit-body">
|
<div class="audit-body">
|
||||||
|
<VAlert v-if="error" class="audit-error" type="error" :closable="true" :title="error" />
|
||||||
|
|
||||||
|
<!-- 筛选栏、数据列表、分页条合并为一张白卡:区块之间不再露出灰缝,
|
||||||
|
分页条白底随卡片铺满整行、与上方列表左右对齐(文字位置保持不变) -->
|
||||||
|
<VCard :body-class="['!p-0']">
|
||||||
<!-- 筛选栏(只读查询,无任何修改/删除入口) -->
|
<!-- 筛选栏(只读查询,无任何修改/删除入口) -->
|
||||||
<VCard :body-class="['audit-filter']">
|
<div class="audit-filter">
|
||||||
<div class="filter-grid">
|
<div class="filter-grid">
|
||||||
<label class="filter-item">
|
<label class="filter-item">
|
||||||
<span>操作者</span>
|
<span>操作者</span>
|
||||||
@@ -221,11 +226,8 @@ onMounted(fetchLogs)
|
|||||||
<VButton size="sm" :disabled="!hasActiveFilter" @click="resetFilter">重置</VButton>
|
<VButton size="sm" :disabled="!hasActiveFilter" @click="resetFilter">重置</VButton>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</VCard>
|
</div>
|
||||||
|
|
||||||
<VAlert v-if="error" class="audit-error" type="error" :closable="true" :title="error" />
|
|
||||||
|
|
||||||
<VCard :body-class="['!p-0']">
|
|
||||||
<VLoading v-if="loading && !logs.length" />
|
<VLoading v-if="loading && !logs.length" />
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<VEmpty
|
<VEmpty
|
||||||
@@ -287,8 +289,7 @@ onMounted(fetchLogs)
|
|||||||
</VEntity>
|
</VEntity>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</VCard>
|
<!-- 分页条置于卡片内部末尾:白底铺满整行,与上方列表左右对齐 -->
|
||||||
|
|
||||||
<div v-if="total > 0" class="audit-pagination">
|
<div v-if="total > 0" class="audit-pagination">
|
||||||
<VPagination
|
<VPagination
|
||||||
v-model:page="page"
|
v-model:page="page"
|
||||||
@@ -297,6 +298,7 @@ onMounted(fetchLogs)
|
|||||||
:size-options="[10, 20, 50]"
|
:size-options="[10, 20, 50]"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</VCard>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<AuditLogDetail v-model:visible="detailVisible" :log="selectedLog" />
|
<AuditLogDetail v-model:visible="detailVisible" :log="selectedLog" />
|
||||||
@@ -315,7 +317,7 @@ onMounted(fetchLogs)
|
|||||||
padding: 1rem 1.25rem 2rem;
|
padding: 1rem 1.25rem 2rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 1rem;
|
/* 筛选、数据、分页合并为一张白卡,区块之间不留灰缝 */
|
||||||
}
|
}
|
||||||
.audit-logo {
|
.audit-logo {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
@@ -365,6 +367,8 @@ onMounted(fetchLogs)
|
|||||||
}
|
}
|
||||||
.audit-error {
|
.audit-error {
|
||||||
--tw-ring-color: transparent;
|
--tw-ring-color: transparent;
|
||||||
|
/* 错误提示位于白卡上方,与卡片留出间距 */
|
||||||
|
margin-bottom: 1rem;
|
||||||
}
|
}
|
||||||
.audit-row {
|
.audit-row {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -406,9 +410,9 @@ onMounted(fetchLogs)
|
|||||||
.status-ok { color: #0f766e; background: rgba(76, 203, 160, 0.15); }
|
.status-ok { color: #0f766e; background: rgba(76, 203, 160, 0.15); }
|
||||||
.status-fail { color: var(--audit-red); background: rgba(215, 29, 29, 0.12); }
|
.status-fail { color: var(--audit-red); background: rgba(215, 29, 29, 0.12); }
|
||||||
.audit-pagination {
|
.audit-pagination {
|
||||||
display: flex;
|
/* 在白卡内铺满整行:白底与上方列表左右对齐;上下各留 1rem,
|
||||||
justify-content: center;
|
文字的垂直位置与原分页条一致;上边缘 1px 分隔线同控制台卡片 footer 观感 */
|
||||||
/* 左右各留 1rem,与内容区留白呼应 */
|
padding: 1rem;
|
||||||
padding: 0 1rem 1rem;
|
border-top: 1px solid #eaecf0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user