import { PlusOutlined } from "@ant-design/icons"
import React from "react"
import { FormConfig } from '@/components/Formitem/type'

let config = (fnc: () => void, seek: (bookName: string) => void, seekType: (typeId: string) => void, seekPlatform: (platformId: string) => void, platform: any[], access: any, bookify: any[], handleTypeId: (id: number) => void): FormConfig[] => {
    let arr: any = [
        {
            label: '书名',
            tag: 'inputSearch',
            name: 'bookName',
            children: [{ value: '1', text: '全部分组' }],
            change: true,
            width: 200,
            callback: seek
        },
        {
            label: '状态',
            tag: 'inputSearch',
            name: 'status',
            change: true,
            width: 200,
            callback: seekType
        },
        {
            label: '平台',
            tag: 'select',
            name: 'platformId',
            children: platform,
            change: true,
            width: 200,
            callback: seekPlatform
        },
        {
            label: '分类',
            tag: 'select',
            name: 'typeId',
            children: bookify,
            change: true,
            width: 200,
            callback: handleTypeId
        },
    ]
    return access['新增小说'] ? [...arr, {
        label: '添加书籍',
        icon: <PlusOutlined />,
        tag: 'button',
        htmlType: 'button',
        btnType: 'primary',
        name: 'zx',
        callback: fnc,
    }] : arr
}

export default config