import { BasicColumn, FormSchema } from '/@/components/Table';

const colProps = { xs: { span: 24 }, sm: { span: 24 }, lg: { span: 8 } };
const colPropsInDrawer = { span: 24 };

export const columns: BasicColumn[] = [
  {
    title: '姓名',
    dataIndex: 'realName',
    width: 200,
  },
  {
    title: '用户名',
    dataIndex: 'username',
    width: 180,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 180,
  },
  {
    title: '更新时间',
    dataIndex: 'updateTime',
    width: 180,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'realName',
    label: '姓名',
    component: 'Input',
    componentProps: {
      allowClear: true,
      placeholder: '姓名',
    },
    colProps
  }
];

export const formSchema: FormSchema[] = [
  {
    label: '姓名',
    field: 'realName',
    componentProps: {
      allowClear: false,
      placeholder: '姓名',
    },
    colProps: colPropsInDrawer,
    component: 'Input',
    rules: [{ required: true, message: '请输入姓名！' }],
  },
  {
    label: '用户名',
    field: 'username',
    componentProps: {
      allowClear: false,
      placeholder: '用户名',
    },
    colProps: colPropsInDrawer,
    component: 'Input',
    rules: [{ required: true, message: '请输入用户名！' }],
  },
  {
    label: '密码',
    field: 'password',
    componentProps: {
      allowClear: false,
      placeholder: '密码',
    },
    colProps: colPropsInDrawer,
    component: 'InputPassword',
    rules: [{ required: true, message: '请输入密码！' }],
  },
  {
    label: ' ',
    field: 'menu',
    slot: 'menu',
    component: 'Input',
    colProps: colPropsInDrawer,
  },
];
