import { ProColumns, ProTable } from '@ant-design/pro-components'; import { Tag } from 'antd'; import { listLogs } from '@/services/api'; const columns: ProColumns[] = [ { title: '操作人', dataIndex: 'username' }, { title: '模块', dataIndex: 'module' }, { title: '操作', dataIndex: 'operation' }, { title: '方法', dataIndex: 'method', search: false, render: (v) => {v} }, { title: '路径', dataIndex: 'path', search: false, ellipsis: true }, { title: 'IP', dataIndex: 'ip', search: false }, { title: '耗时(ms)', dataIndex: 'duration', search: false }, { title: '结果', dataIndex: 'status', search: false, render: (_, r) => {r.status === 1 ? '成功' : '失败'}, }, { title: '操作时间', dataIndex: 'createdAt', valueType: 'dateTime', search: false }, ]; const LogsPage: React.FC = () => ( { const res = await listLogs({ page: params.current, pageSize: params.pageSize, username: params.username, module: params.module, operation: params.operation, }); return { data: res?.data?.list || [], total: res?.data?.total || 0, success: res?.code === 0 }; }} search={{ defaultCollapsed: false }} /> ); export default LogsPage;