import { BasicColumn, FormSchema } from '/@/components/Table';
import { list } from "../reviewOrg/api";

export const columns: BasicColumn[] = [
  {
    title: '姓名',
    dataIndex: 'ryxm',
  },
  {
    title: '性别',
    dataIndex: 'sex',
  },
  {
    title: '地址',
    dataIndex: 'address',
  },
  {
    title: '手机号',
    dataIndex: 'phone',
  },
  {
    title: '邮箱',
    dataIndex: 'email',
  },
];

export const searchFormSchema: FormSchema[] = [

  {
    label: '姓名',
    field: 'ryxm',
    component: 'Input',
  },
  {
    label: '手机号',
    field: 'phone',
    component: 'Input',
  },
  {
    label: '地址',
    field: 'address',
    component: 'Input',
  },
];

export const formSchema: formSchema[] = [
  {
    label: '主键',
    field: 'id',
    component: 'Input',
    ifShow: false,
  },
  {
    label: '姓名',
    field: 'ryxm',
    component: 'Input',
    required: true,
  },
  {
    label: '所属评审机构',
    field: 'psjgId',
    required: true,
    component: 'ApiSelect',
    componentProps: {
      api: list,
      labelField: 'psjg',
      valueField: 'id',
      resultField:'records'
    },
  },

  {
    label: '性别',
    field: 'dklx',
    component: 'JSearchSelect',
    componentProps: {
      dict: 'sex',
    },
  },
  {
    label: '地址',
    field: 'address',
    required: true,
    component: 'Input',
  },
  {
    label: '生日',
    field: 'birthday',
    component: 'DatePicker',
    componentProps: {
      //日期格式化，页面上显示的值
      format: 'YYYY-MM-DD',
      //返回值格式化（绑定值的格式）
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    label: '座机号',
    required: true,
    field: 'mobile',
    component: 'Input',
  },
  {
    label: '手机号',
    required: true,
    field: 'phone',
    component: 'Input',
    rules: [{ required: false, message: '请输入正确的手机号', pattern: /^1[3456789]\d{9}$/ }],
  },
  {
    label: '邮箱',
    required: true,
    field: 'email',
    component: 'Input',
    rules: [{ required: false, message: '请输入正确的邮箱', pattern: /^(\w-*\.*)+@(\w-?)+(\.\w{2,})+$/ }],
  },
  {
    label: '工作',
    required: true,
    field: 'job',
    component: 'Input',
  },
]
