1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import React from "react"
- import { Row, Col, Popconfirm } from "antd"
- import { DeleteOutlined, FormOutlined } from "@ant-design/icons"
- let columns = (edit: (value: { id: number, name: string, }) => void, del: (id: number) => void) => [
- {
- title: 'ID',
- dataIndex: 'id',
- key: 'id',
- align: 'center'
- },
- {
- title: '名称',
- dataIndex: 'name',
- key: 'name',
- align: 'center'
- },
- {
- title: '操作',
- dataIndex: 'cz',
- key: 'cz',
- align: 'center',
- width: 200,
- render: (a: string, b: { id: number, name: string }) => (
- <Row justify='center' gutter={[10, 0]}>
- <Col><a onClick={() => edit(b)} style={{fontSize: "12px"}}><FormOutlined /> 编辑</a></Col>
- <Col>
- <Popconfirm
- title={`是否要删除?`}
- onConfirm={() => del(b.id)}
- okText="是"
- cancelText="否"
- >
- <a style={{color: "red", fontSize: "12px"}}><DeleteOutlined /> 删除</a>
- </Popconfirm>
- </Col>
- </Row>
- )
- }
- ]
- export default columns
|