import { BasicColumn, FormSchema } from '/@/components/Table';
import { getDataOption } from '/@/api/system/dic';

import { requestMagicApi } from '/@/api/magicApi';

export const tableColumns: BasicColumn[] = [
  // {
  //   title: '招生名称',
  //   dataIndex: 'name',
  //   align: 'left',
  // },
  {
    title: '年级',
    dataIndex: 'gradeName',
    align: 'left',
    // width: 100,
  },
  {
    title: '招生类型',
    dataIndex: 'enrollTypeCn',
    align: 'left',
    width: 100,
  },
  {
    title: '已录取人数',
    dataIndex: 'ab',
    align: 'left',
    width: 100,
  },
  {
    title: '已分班人数',
    dataIndex: 'abc',
    align: 'left',
    width: 100,
  },
];

export const searchFormSchema: FormSchema[] = [
  // {
  //   field: 'name',
  //   label: '招生名称',
  //   component: 'Input',
  //   colProps: { span: 8 },
  // },
  {
    field: 'enrollType',
    label: '招生类型',
    component: 'ApiSelect',
    colProps: { span: 8 },
    componentProps: {
      getPopupContainer: () => document.body,
      api: getDataOption,
      params: { code: 'enroll_type' },
    },
  },
];

export const formSchema: FormSchema[] = [
  {
    label: '所属年级',
    field: 'gradeId',
    component: 'ApiSelect',
    required: true,
    componentProps: {
      getPopupContainer: () => document.body,
      api: requestMagicApi,
      params: { url: 'baseData/grade/option' },
    },
    colProps: { span: 24 },
  },
  {
    label: '招生类型',
    field: 'enrollType',
    component: 'ApiSelect',
    required: true,
    componentProps: {
      getPopupContainer: () => document.body,
      api: getDataOption,
      params: { code: 'enroll_type' },
    },
    colProps: { span: 24 },
  },
];