import { Popconfirm, Space } from "antd";
import React from "react";

function columnsAdd(del: (id: number) => void, edit: (value: any) => void) {

    const columns: any = [
        {
            title: '操作',
            dataIndex: 'cz',
            key: 'cz',
            align: 'center',
            width: 90,
            render: (a: any[], b: any) => {
                return <Space>
                    <a style={{ fontSize: 12 }} onClick={() => edit(b)}>修改</a>
                    <Popconfirm
                        title="确定删除?"
                        onConfirm={() => { del(b.id) }}
                        okText="是"
                        cancelText="否"
                    >
                        <a style={{ fontSize: 12, color: 'red' }}>删除</a>
                    </Popconfirm>
                </Space>
            }
        },
        {
            title: '序号',
            dataIndex: 'id',
            key: 'id',
            align: 'center',
            width: 50
        },
        {
            title: '组名',
            dataIndex: 'name',
            key: 'name',
            align: 'center',
            width: 85,
            ellipsis: true
        },
        {
            title: '账号',
            dataIndex: 'users',
            key: 'users',
            render: (a: any[]) => {
                return <span>{a?.toString()}</span>
            }
        }
    ];

    return columns
}

export default columnsAdd