diff --git a/furniture-3d-system/src/app/api/operation-logs/route.ts b/furniture-3d-system/src/app/api/operation-logs/route.ts
index 02aecfc4..03337939 100644
--- a/furniture-3d-system/src/app/api/operation-logs/route.ts
+++ b/furniture-3d-system/src/app/api/operation-logs/route.ts
@@ -34,7 +34,7 @@ export async function GET(request: NextRequest) {
const params = request.nextUrl.searchParams
const page = Math.max(1, Number.parseInt(params.get('page') ?? '1', 10) || 1)
const pageSize = Math.min(
- 100,
+ 200,
Math.max(1, Number.parseInt(params.get('pageSize') ?? '50', 10) || 50),
)
const result = await operationLogService.list({
diff --git a/furniture-3d-system/src/app/intake/operation-logs/ProductDevelopmentOperationLogClient.tsx b/furniture-3d-system/src/app/intake/operation-logs/ProductDevelopmentOperationLogClient.tsx
index 668833bc..c6399ea2 100644
--- a/furniture-3d-system/src/app/intake/operation-logs/ProductDevelopmentOperationLogClient.tsx
+++ b/furniture-3d-system/src/app/intake/operation-logs/ProductDevelopmentOperationLogClient.tsx
@@ -92,7 +92,7 @@ export default function ProductDevelopmentOperationLogClient() {
aria-labelledby="operations-tab"
hidden={activeTab !== 'operations'}
>
-
+
{
expect(screen.getAllByText('JUSHUITAN_VIRTUAL_INVENTORY_FAILED').length).toBeGreaterThan(0)
expect(screen.getByText(/rate limited/)).toBeInTheDocument()
+ expect(screen.getByRole('navigation', { name: '操作日志分页' })).toBeInTheDocument()
+ expect(screen.getByRole('textbox', { name: '跳转页码' })).toHaveValue('1')
+ })
+
+ it('supports changing pages and page size from the floating pagination', async () => {
+ fetchMock.mockResolvedValue({
+ ok: true,
+ json: async () => ({
+ success: true,
+ data: [],
+ meta: { pagination: { page: 1, total: 101, totalPages: 3, hasMore: true } },
+ }),
+ })
+
+ const actor = userEvent.setup()
+ render(
)
+
+ await waitFor(() => expect(screen.getByText('共 101 条')).toBeInTheDocument())
+ await actor.click(screen.getByRole('button', { name: '下一页' }))
+ await waitFor(() => expect(fetchMock).toHaveBeenLastCalledWith(
+ expect.stringContaining('page=2'),
+ expect.any(Object),
+ ))
+
+ await actor.selectOptions(screen.getByRole('combobox', { name: '每页条数' }), '200')
+ await waitFor(() => expect(fetchMock).toHaveBeenLastCalledWith(
+ expect.stringContaining('pageSize=200'),
+ expect.any(Object),
+ ))
})
})
diff --git a/furniture-3d-system/src/app/operation-logs/OperationLogClient.tsx b/furniture-3d-system/src/app/operation-logs/OperationLogClient.tsx
index 6aacd71c..6d7197aa 100644
--- a/furniture-3d-system/src/app/operation-logs/OperationLogClient.tsx
+++ b/furniture-3d-system/src/app/operation-logs/OperationLogClient.tsx
@@ -3,14 +3,11 @@
import { useCallback, useEffect, useMemo, useState } from 'react'
import Link from 'next/link'
import {
- ChevronLeft,
- ChevronRight,
ExternalLink,
FileWarning,
RefreshCw,
Search,
ShieldAlert,
- X,
} from 'lucide-react'
import {
actionLabels,
@@ -22,13 +19,23 @@ import {
type OperationLog,
type OperationStatus,
} from './operationLogPresentation'
+import { OperationLogPagination } from './OperationLogPagination'
+import { OperationLogDetailDrawer } from './OperationLogDetailDrawer'
-export default function OperationLogClient({ showHeader = true }: { showHeader?: boolean }) {
+export default function OperationLogClient({
+ showHeader = true,
+ embedded = false,
+}: {
+ showHeader?: boolean
+ embedded?: boolean
+}) {
const [logs, setLogs] = useState
([])
const [selectedLog, setSelectedLog] = useState(null)
const [loading, setLoading] = useState(true)
const [error, setError] = useState(null)
const [page, setPage] = useState(1)
+ const [pageInput, setPageInput] = useState('1')
+ const [pageSize, setPageSize] = useState(50)
const [total, setTotal] = useState(0)
const [totalPages, setTotalPages] = useState(1)
const [problemOnly, setProblemOnly] = useState(true)
@@ -39,7 +46,7 @@ export default function OperationLogClient({ showHeader = true }: { showHeader?:
const [endDate, setEndDate] = useState('')
const query = useMemo(() => {
- const params = new URLSearchParams({ page: String(page), pageSize: '50' })
+ const params = new URLSearchParams({ page: String(page), pageSize: String(pageSize) })
if (problemOnly) params.set('problemOnly', 'true')
if (action) params.set('action', action)
if (status && !problemOnly) params.set('status', status)
@@ -47,7 +54,7 @@ export default function OperationLogClient({ showHeader = true }: { showHeader?:
if (startDate) params.set('startDate', startDate)
if (endDate) params.set('endDate', endDate)
return params.toString()
- }, [action, endDate, keyword, page, problemOnly, startDate, status])
+ }, [action, endDate, keyword, page, pageSize, problemOnly, startDate, status])
const loadLogs = useCallback(async () => {
setLoading(true)
@@ -82,8 +89,16 @@ export default function OperationLogClient({ showHeader = true }: { showHeader?:
callback()
}
+ const commitPageInput = () => {
+ const nextPage = Math.min(Math.max(1, totalPages), Math.max(1, Number(pageInput) || 1))
+ setPage(nextPage)
+ setPageInput(String(nextPage))
+ }
+
+ useEffect(() => setPageInput(String(page)), [page])
+
return (
-
+
{showHeader ? (