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

export const columns: BasicColumn[] = [
  {
    title: '账号',
    dataIndex: 'Account',
  },
  {
    title: '姓名',
    dataIndex: 'Name',
  },
  {
    title: '性别',
    dataIndex: 'Sex',
    customRender: ({ record }) => {
      const status = record.Sex;
      const enable = ~~status === 0;
      const text = enable ? '男' : '女';
      return text;
    },
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'key',
    label: '关键字',
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: '角色名称',
    required: true,
    component: 'Input',
    ifShow: false,
  },
  {
    field: 'name',
    label: '人员姓名',
    required: true,
    component: 'Input',
  },
  {
    field: 'account',
    label: '账号/手机号',
    required: true,
    component: 'Input',
  },
  {
    field: 'sex',
    component: 'RadioGroup',
    label: '人员性别',
    colProps: {
      span: 8,
    },
    componentProps: {
      options: [
        {
          label: '男',
          value: 0,
        },
        {
          label: '女',
          value: 1,
        },
      ],
    },
  },
  {
    field: 'areaId',
    label: '所属机构',
    slot: 'areaId',
  },
  {
    field: 'time',
    label: '打卡时间',
    slot: 'time',
  },
];
