import { listDictModel } from '/@/api/common';
import { DescItem } from '/@/components/Description';
import { BasicColumn, FormSchema } from '/@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '目录类型',
    dataIndex: 'type',
  },
  {
    title: '目录编码',
    dataIndex: 'code',
  },
  {
    title: '菜单名称',
    dataIndex: 'name',
  },
  {
    title: '上级菜单',
    dataIndex: 'parentId',
  },
  {
    title: '排序',
    dataIndex: 'sort',
  },
  {
    title: '备注',
    dataIndex: 'remarks',
  },
  {
    title: '是否可用',
    dataIndex: 'disable',
  },
  {
    title: '备注',
    dataIndex: 'remark',
  },
];

// 表单列定义
export const searchFormSchema: FormSchema[] = [
  {
    label: '目录编码',
    field: 'code',
    component: 'Input',
    componentProps: {
      placeholder: '请输入目录编码',
    },
  },
  {
    label: '是否可用',
    field: 'disable',
    component: 'ApiRadioGroup',
    componentProps: {
      api: listDictModel,
      params: {
        dictCode: 'sys_disable_type',
      },
    },
  },
];
// 表单新增编辑
export const dataFormSchema: FormSchema[] = [
  {
    label: '目录类型',
    field: 'type',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入目录类型',
    },
  },
  {
    label: '目录编码',
    field: 'code',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入目录编码',
    },
  },
  {
    label: '菜单名称',
    field: 'name',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入菜单名称',
    },
  },
  {
    label: '上级菜单',
    field: 'parentId',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入上级菜单',
    },
  },
  {
    label: '排序',
    field: 'sort',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入排序',
    },
  },
  {
    label: '备注',
    field: 'remarks',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入备注',
    },
  },
  {
    label: '是否可用',
    field: 'disable',
    component: 'ApiRadioGroup',
    componentProps: {
      api: listDictModel,
      params: {
        dictCode: 'sys_disable_type',
      },
    },
  },
  {
    label: '备注',
    field: 'remark',
    required: true,
    component: 'Input',
    componentProps: {
      placeholder: '请输入备注',
    },
  },
];
// 表单详情查看
export const viewSchema: DescItem[] = [
  {
    label: '主键',
    field: 'id',
  },
  {
    label: '目录类型',
    field: 'type',
  },
  {
    label: '目录编码',
    field: 'code',
  },
  {
    label: '菜单名称',
    field: 'name',
  },
  {
    label: '上级菜单',
    field: 'parentId',
  },
  {
    label: '排序',
    field: 'sort',
  },
  {
    label: '备注',
    field: 'remarks',
  },
  {
    label: '创建时间',
    field: 'createTime',
  },
  {
    label: '更新时间',
    field: 'updateTime',
  },
  {
    label: '是否可用',
    field: 'disable',
  },
  {
    label: '备注',
    field: 'remark',
  },
];
