align(生成记录): 列名对齐参考(记录类型→类型、生成时间→创建时间)、空态统一暂无记录(对齐 admin.html:5769-5770/admin.js:2866)
This commit is contained in:
@@ -165,12 +165,12 @@ onMounted(() => {
|
|||||||
<el-table v-loading="loading" :data="rows" stripe :empty-text="emptyText">
|
<el-table v-loading="loading" :data="rows" stripe :empty-text="emptyText">
|
||||||
<el-table-column prop="id" label="ID" width="90" />
|
<el-table-column prop="id" label="ID" width="90" />
|
||||||
<el-table-column prop="username" label="用户" width="140" />
|
<el-table-column prop="username" label="用户" width="140" />
|
||||||
<el-table-column label="记录类型" min-width="150">
|
<el-table-column label="类型" min-width="150">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
{{ historyPanelTypeLabel((row as HistoryRecordItem).panelType) }}
|
{{ historyPanelTypeLabel((row as HistoryRecordItem).panelType) }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="createdAt" label="生成时间" min-width="180">
|
<el-table-column prop="createdAt" label="创建时间" min-width="180">
|
||||||
<template #default="{ row }">{{ formatDateTime((row as HistoryRecordItem).createdAt) }}</template>
|
<template #default="{ row }">{{ formatDateTime((row as HistoryRecordItem).createdAt) }}</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="结果预览" min-width="220">
|
<el-table-column label="结果预览" min-width="220">
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
/** 历史记录列表空/错误反馈(任务 125):空态文案与请求错误归一;纯逻辑。 */
|
/** 历史记录列表空/错误反馈(任务 125):空态文案与请求错误归一;纯逻辑。 */
|
||||||
import { requestErrorMessage } from '../../api/envelope.ts'
|
import { requestErrorMessage } from '../../api/envelope.ts'
|
||||||
|
|
||||||
|
/** 空态文案(对齐 admin.js:2866 统一「暂无记录」)。 */
|
||||||
export function historyEmptyText(input: { hasFilter: boolean; total: number }): string {
|
export function historyEmptyText(input: { hasFilter: boolean; total: number }): string {
|
||||||
if (typeof input.total === 'number' && input.total > 0) return ''
|
if (typeof input.total === 'number' && input.total > 0) return ''
|
||||||
return input.hasFilter ? '暂无符合条件的生成记录,请调整筛选条件' : '暂无生成记录'
|
return '暂无记录'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 请求失败归一为可展示文案,空则回兜底。 */
|
/** 请求失败归一为可展示文案,空则回兜底。 */
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import test from 'node:test'
|
||||||
|
import assert from 'node:assert/strict'
|
||||||
|
import { readSource } from './helpers.ts'
|
||||||
|
import { historyEmptyText } from '../src/pages/records/history-feedback.ts'
|
||||||
|
|
||||||
|
/** 对齐 admin.html:5769-5770(类型/创建时间列名) 与 admin.js:2866(暂无记录)。 */
|
||||||
|
|
||||||
|
test('align_history_column_labels', () => {
|
||||||
|
const page = readSource('src/pages/records/RecordsHistoryPage.vue')
|
||||||
|
assert.match(page, /label="类型"/, '列名对齐参考「类型」')
|
||||||
|
assert.match(page, /label="创建时间"/, '列名对齐参考「创建时间」')
|
||||||
|
assert.doesNotMatch(page, /记录类型/, '去掉“记录类型”列名')
|
||||||
|
assert.doesNotMatch(page, /label="生成时间"/, '去掉“生成时间”列名')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('align_history_empty_text', () => {
|
||||||
|
assert.equal(historyEmptyText({ hasFilter: true, total: 0 }), '暂无记录')
|
||||||
|
assert.equal(historyEmptyText({ hasFilter: false, total: 0 }), '暂无记录')
|
||||||
|
assert.equal(historyEmptyText({ hasFilter: false, total: 2 }), '')
|
||||||
|
})
|
||||||
@@ -4,13 +4,13 @@ import { readSource } from './helpers.ts'
|
|||||||
import { historyEmptyText, historyErrorText } from '../src/pages/records/history-feedback.ts'
|
import { historyEmptyText, historyErrorText } from '../src/pages/records/history-feedback.ts'
|
||||||
|
|
||||||
test('test_task_125_history_feedback_normal_primary_path', () => {
|
test('test_task_125_history_feedback_normal_primary_path', () => {
|
||||||
// 正常主路径:无数据且有筛选给提示。
|
// 正常主路径:无数据空态统一「暂无记录」(对齐 admin.js:2866)。
|
||||||
assert.equal(historyEmptyText({ hasFilter: true, total: 0 }), '暂无符合条件的生成记录,请调整筛选条件')
|
assert.equal(historyEmptyText({ hasFilter: true, total: 0 }), '暂无记录')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('test_task_125_history_feedback_normal_variant_input', () => {
|
test('test_task_125_history_feedback_normal_variant_input', () => {
|
||||||
// 正常变体:无筛选空态。
|
// 正常变体:无筛选空态同文案。
|
||||||
assert.equal(historyEmptyText({ hasFilter: false, total: 0 }), '暂无生成记录')
|
assert.equal(historyEmptyText({ hasFilter: false, total: 0 }), '暂无记录')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('test_task_125_history_feedback_repeated_is_idempotent', () => {
|
test('test_task_125_history_feedback_repeated_is_idempotent', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user