import {
    getToken
} from '@/utils/auth'
export const leftMenu = () => {
    return [
        {
            tag: 'el-input',
            label: '单行文本',
            key: '',
            value: '',
            default: '',
            icon: 'danhang',
            attribute: {
                clearable: true,
                placeholder: '请输入',
                required: true,
            },
        },
        {
            tag: 'el-input',
            label: '多行文本',
            key: '',
            icon: 'duohang',
            value: '',
            default: '',
            attribute: {
                type: 'textarea',
                rows: 3,
                clearable: true,
                placeholder: '请输入',
                required: true,
            },
        },
        {
            tag: 'BaseSelect',
            label: '下拉选择',
            icon: 'xiala',
            key: '',
            value: '',
            default: '',
            attribute: {//属性
                required: true,
                clearable: true,
                filterable: true,
                staticordynamic: 'fetchOptions',
                placeholder: '请选择',
                fetchOptions: {
                    baseURL: `${import.meta.env.VITE_APP_BASE_API}`,
                    url: "system/user/list",
                    method: 'get',
                    data: '{}',
                    dataType: 'json',
                    dataPath: 'data.list',
                    labelKey: "nickName",
                    valueKey: "userId",
                },
                options: [
                ]
            },
        },
        {
            tag: 'BaseRadioGroup',
            label: '单选框组',
            key: '',
            icon: 'danxuan',
            value: '',
            default: '',
            attribute: {//配置项内容
                placeholder: '请选择',
                required: true,
                options: [
                ]
            }
        },
        {
            tag: 'BaseUpload',
            label: '上传文件',
            key: '',
            value: [],
            icon: 'shangchuan',
            default: [],
            attribute: { //属性
                placeholder: '请上传文件',
                required: true,
                multiple: false,
                listType: "text",
                showFileList: true,
                limit: 1,
                accept: '', //支持的格式
                headers: {
                    Authorization: 'Bearer ' + getToken()
                }, //定义请求头
                name:"file",
                baseUrl: "",
                baseApi:import.meta.env.VITE_APP_BASE_API,
                url: "/upload",
                resKey: { //当前value数组[{}]中，对应的url/name
                    urlKey: 'url', //默认值url，相同则可不传
                    nameKey: 'name' //默认值name，相同则可不传
                },
            },
            customFormatter: null,
            // customFormatter: function (data) { //自定义提交表单时，格式化videoUrl字段
            //   if (data.length > 0) return data[0].response.url
            // }
        },
    ]
}