import { Button, Table } from 'antd'; import type { ColumnsType } from 'antd/es/table'; import React from 'react'; interface DeletableTableProps { dataSource: any[]; isSerial?: boolean; isAction?: boolean; scrollY: number; onDelete?: (recod: any) => void; rowKey?: string; rowSelection?: any; pagination?:any; columns: ColumnsType; } const DeletableTable: React.FC = (props) => { const { dataSource, onDelete, isSerial = true, isAction = true, scrollY = 400, ...restProps } = props; // const getColumns = (): ColumnsType => { // const columns: ColumnsType = [ // { // title: '名称', // dataIndex: 'name', // key: 'name', // }, // { // title: '类型', // dataIndex: 'type', // key: 'type', // render: (text) => ( // {text == 1 ? '用户' : text == 2 ? '用户组' : ''} // ), // }, // ]; // if (isSerial) { // columns.unshift({ // title: '序号', // dataIndex: 'order', // key: 'order', // width: 80, // render: (_, record, index) => {index + 1}, // }); // } // if (isAction) { // columns.push({ // title: '操作', // key: 'action', // render: (_, record) => ( // // ), // }); // } // return columns; // }; return (
); }; export default DeletableTable;