import { CatalogScaleType, CatalogType, IndustryType } from '@/services/launchAdq/enum'
import { CopyOutlined, DeleteOutlined, EditOutlined } from '@ant-design/icons'
import { Button, Popconfirm, Space } from 'antd'
import React from 'react'
function tableConfig(handle: (type: 1 | 2 | 3, data: any) => void): any {
    return () => {
        return [
            {
                title: 'ID',
                dataIndex: 'id',
                key: 'id',
                align: 'center',
                width: 60
            },
            {
                title: '商品库名称',
                dataIndex: 'catalogName',
                key: 'catalogName',
                align: 'center',
                width: 150
            },
            {
                title: '商品库规模',
                dataIndex: 'catalogScaleType',
                key: 'catalogScaleType',
                align: 'center',
                width: 250,
                render: (a: string | number) => {
                    return CatalogScaleType[a]
                }
            },
            {
                title: '商品库类型',
                dataIndex: 'catalogType',
                key: 'catalogType',
                align: 'center',
                width: 120,
                render: (a: string | number) => {
                    return CatalogType[a]
                }
            },
            {
                title: '商品库行业类型',
                dataIndex: 'industryType',
                key: 'industryType',
                align: 'center',
                width: 120,
                render: (a: string | number) => {
                    return IndustryType[a]
                }
            },
            {
                title: '创建时间',
                dataIndex: 'createTime',
                key: 'createTime',
                align: 'center',
                width: 150,
            },
            {
                title: '操作',
                dataIndex: 'cz',
                key: 'cz',
                render: (a: any, b: any) => {
                    return <Space>
                        <Button type="link" style={{ padding: 0 }} size="small" icon={<EditOutlined />} onClick={() => handle(1, b)}>修改</Button>
                        <Button type="link" style={{ padding: 0 }} size="small" icon={<CopyOutlined />} onClick={() => handle(2, b)}>商品管理</Button>
                        <Popconfirm
                            title="确定删除?"
                            onConfirm={() => handle(3, b)}
                            okText="是"
                            cancelText="否"
                        >
                            <Button type="link" style={{ padding: 0 }} size="small" danger icon={<DeleteOutlined />}>删除</Button>
                        </Popconfirm>
                    </Space>
                }
            }
        ]
    }
}
export default tableConfig