From d3bbb1a296e8747f0ed725dc99823bd53a8d0621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E8=87=AA=E8=BE=BE?= <980324341@qq.com> Date: Sat, 5 Sep 2026 23:32:21 +0800 Subject: [PATCH] =?UTF-8?q?align(=E7=94=9F=E6=88=90=E8=AE=B0=E5=BD=95):=20?= =?UTF-8?q?=E5=88=97=E5=90=8D=E5=AF=B9=E9=BD=90=E5=8F=82=E8=80=83(?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=B1=BB=E5=9E=8B=E2=86=92=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E3=80=81=E7=94=9F=E6=88=90=E6=97=B6=E9=97=B4=E2=86=92=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=97=B6=E9=97=B4)=E3=80=81=E7=A9=BA=E6=80=81?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=9A=82=E6=97=A0=E8=AE=B0=E5=BD=95=EF=BC=88?= =?UTF-8?q?=E5=AF=B9=E9=BD=90=20admin.html:5769-5770/admin.js:2866?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/records/RecordsHistoryPage.vue | 4 ++-- .../src/pages/records/history-feedback.ts | 3 ++- .../tests/align-history-copy.test.ts | 20 +++++++++++++++++++ admin-frontend-vue/tests/task-125.test.ts | 8 ++++---- 4 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 admin-frontend-vue/tests/align-history-copy.test.ts diff --git a/admin-frontend-vue/src/pages/records/RecordsHistoryPage.vue b/admin-frontend-vue/src/pages/records/RecordsHistoryPage.vue index f9d6fa9d..f0c4c4fc 100644 --- a/admin-frontend-vue/src/pages/records/RecordsHistoryPage.vue +++ b/admin-frontend-vue/src/pages/records/RecordsHistoryPage.vue @@ -165,12 +165,12 @@ onMounted(() => { - + - + diff --git a/admin-frontend-vue/src/pages/records/history-feedback.ts b/admin-frontend-vue/src/pages/records/history-feedback.ts index 7e8b9ab7..a19127d2 100644 --- a/admin-frontend-vue/src/pages/records/history-feedback.ts +++ b/admin-frontend-vue/src/pages/records/history-feedback.ts @@ -1,9 +1,10 @@ /** 历史记录列表空/错误反馈(任务 125):空态文案与请求错误归一;纯逻辑。 */ import { requestErrorMessage } from '../../api/envelope.ts' +/** 空态文案(对齐 admin.js:2866 统一「暂无记录」)。 */ export function historyEmptyText(input: { hasFilter: boolean; total: number }): string { if (typeof input.total === 'number' && input.total > 0) return '' - return input.hasFilter ? '暂无符合条件的生成记录,请调整筛选条件' : '暂无生成记录' + return '暂无记录' } /** 请求失败归一为可展示文案,空则回兜底。 */ diff --git a/admin-frontend-vue/tests/align-history-copy.test.ts b/admin-frontend-vue/tests/align-history-copy.test.ts new file mode 100644 index 00000000..8755327f --- /dev/null +++ b/admin-frontend-vue/tests/align-history-copy.test.ts @@ -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 }), '') +}) diff --git a/admin-frontend-vue/tests/task-125.test.ts b/admin-frontend-vue/tests/task-125.test.ts index 760606d8..1d08da30 100644 --- a/admin-frontend-vue/tests/task-125.test.ts +++ b/admin-frontend-vue/tests/task-125.test.ts @@ -4,13 +4,13 @@ import { readSource } from './helpers.ts' import { historyEmptyText, historyErrorText } from '../src/pages/records/history-feedback.ts' test('test_task_125_history_feedback_normal_primary_path', () => { - // 正常主路径:无数据且有筛选给提示。 - assert.equal(historyEmptyText({ hasFilter: true, total: 0 }), '暂无符合条件的生成记录,请调整筛选条件') + // 正常主路径:无数据空态统一「暂无记录」(对齐 admin.js:2866)。 + assert.equal(historyEmptyText({ hasFilter: true, total: 0 }), '暂无记录') }) 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', () => {