import React, { useState } from 'react'; import { PageContainer } from '@ant-design/pro-components'; import { Button, Card, Form, Input, Space, Table } from 'antd'; import { PlusCircleOutlined, ReloadOutlined, SearchOutlined } from '@ant-design/icons'; import type { ColumnsType } from 'antd/es/table'; import moment from 'moment'; interface DataType { name: string; record_id: string; } const RoleManagement: React.FC = () => { const [form] = Form.useForm(); const [loading, setLoading] = useState(false); const [searchData] = useState({}); const pagination = useState({}); const [dataList] = useState([]); const onFinish = () => {}; const onReset = () => {}; const onAdd = () => {}; const tableChange = (page: any) => { setLoading(true); const params = { q: 'page', current: page.current, pageSize: page.pageSize, ...searchData, }; console.log(params); // 请求接口 }; const columns: ColumnsType = [ { title: '序号', align: 'center', key: 'index', render: (_: any, row: any, index: number) => index + 1, }, { title: '角色名称', dataIndex: 'name', key: 'name', width: 250, }, { title: '排序值', dataIndex: 'sequence', key: 'sequence', width: 250, }, { title: '创建者', dataIndex: 'creator', key: 'creator', }, { title: '创建时间', dataIndex: 'created_at', key: 'created_at', render: (v) => v && {moment(v).format('YYYY-MM-DD HH:mm')}, }, { title: '备注', dataIndex: 'memo', key: 'memo', width: 250, }, ]; const paginationProps = { showSizeChanger: true, showQuickJumper: true, showTotal: (total: number) => { return 共 {total}条 ; }, ...pagination, }; return (
record.record_id} pagination={paginationProps} loading={loading} onChange={tableChange} /> ); }; export default RoleManagement;