

import { Row, Col, Popconfirm } from "antd"
import { DeleteOutlined, EditOutlined } from "@ant-design/icons"
import WidthEllipsis from "@/components/widthEllipsis"
import React from "react"

function columnsPos(editGameServer: (data: any) => void, del: (id: number) => void) {

    let newArr: any = [
        {
            title: '游戏名称',
            dataIndex: 'gameName',
            key: 'gameName',
            align: 'center',
            width: 90,
            render: (a: string, b: any) => (<WidthEllipsis value={a} />)
        },
        {
            title: '角色等级',
            dataIndex: 'roleLevel',
            key: 'roleLevel',
            align: 'center',
            width: 100
        },
        {
            title: '创建时间',
            dataIndex: 'createTime',
            key: 'createTime',
            align: 'center',
            width: 135,
            render: (a: string, b: any) => (<WidthEllipsis value={a} />)
        },
        {
            title: '更新时间',
            dataIndex: 'updateTime',
            key: 'updateTime',
            align: 'center',
            width: 135,
            render: (a: string, b: any) => (<WidthEllipsis value={a} />)
        },
        {
            title: '操作',
            dataIndex: 'cz',
            key: 'cz',
            align: 'center',
            width: 100,
            fixed: 'right',
            render: (a: string, b: any) => (
                <Row justify='center' gutter={[10, 0]}>
                    <Col><a style={{ fontSize: "12px" }} onClick={() => { editGameServer(b) }}><EditOutlined /> 修改</a></Col>
                    <Col><Popconfirm
                        title="确定删除?"
                        onConfirm={() => { del(b.id) }}
                        okText="是"
                        cancelText="否"
                    >
                        <a style={{ fontSize: "12px", color: 'red' }}><DeleteOutlined /> 删除</a>
                    </Popconfirm></Col>
                </Row>
            )
        }
    ]
    return newArr
}


export default columnsPos