fix: compact report status record table

This commit is contained in:
hectorzhao
2026-09-03 16:48:56 +08:00
parent 7b8a613afa
commit fe3c6e5b58
4 changed files with 113 additions and 32 deletions
@@ -4,6 +4,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import { MemoryRouter } from 'react-router-dom';
import { AdminReportBatchesPage } from './AdminReportBatchesPage';
import { AdminReportMaterialsPage } from './AdminReportMaterialsPage';
import { AdminReportRecordsPage } from './AdminReportRecordsPage';
import { AdminReportTasksPage } from './AdminReportTasksPage';
const { adminApi, clipboardWriteText } = vi.hoisted(() => ({
@@ -18,6 +19,7 @@ const { adminApi, clipboardWriteText } = vi.hoisted(() => ({
listReportDetailsPage: vi.fn(),
listReportMaterialBatches: vi.fn(),
listReportMaterialBatchTasks: vi.fn(),
listReportRecordsPage: vi.fn(),
preflightReportMaterialBatch: vi.fn(),
},
clipboardWriteText: vi.fn(),
@@ -171,6 +173,43 @@ describe('report workbench pages', () => {
);
});
it('keeps the report record list compact while retaining full details in the dialog', async () => {
adminApi.listReportRecordsPage.mockResolvedValue({
items: [{
id: 'record-1',
taskId: 'report-task-with-a-long-identifier-1',
channelId: 'channel-1',
action: 'manual_status_change',
statusBefore: 'pending',
statusAfter: 'approved',
reason: '通道已确认报备通过',
sourceEntry: 'report_task',
createdAt: '2026-09-03 15:30:00',
channel: { id: 'channel-1', name: '测试通道' },
operator: { id: 'operator-1', username: 'operator', displayName: '运营一' },
task: task('record-1'),
}],
total: 1,
page: 1,
pageSize: 10,
});
render(
<MemoryRouter>
<AdminReportRecordsPage />
</MemoryRouter>,
);
expect(await screen.findByRole('columnheader', { name: '变更对象' })).toBeVisible();
expect(screen.getByRole('columnheader', { name: '变更动作' })).toBeVisible();
expect(screen.getByRole('columnheader', { name: '操作人 / 时间' })).toBeVisible();
expect(screen.queryByRole('columnheader', { name: '备注' })).not.toBeInTheDocument();
expect(screen.getByText('报备任务修改')).toBeVisible();
await userEvent.click(screen.getByRole('button', { name: '详情' }));
expect((await screen.findAllByText('通道已确认报备通过')).length).toBeGreaterThan(0);
});
it('shows and copies the channel brief returned by the batch detail API', async () => {
const batch = {
id: 'batch-1',