import { FormSchema } from '@/components/Form/index';
import { getRoleAllList } from '@/api/system/role';
export const loadSelectData = async(res)=> {
  //这里可以进行数据转换处理
  return (await getRoleAllList({ ...res })).map((item, index) => {
    return {
      ...item,
      label:item.name,
      value:item.id,
      index,
    };
  });
}
export const schemas: FormSchema[] = [
  {
    field: 'realname',
    component: 'Input',
    label: '用户名',
    componentProps: {
      placeholder: '请输入用户名',
    },
  },
  // {
  //   field: 'role',
  //   component: 'BasicSelect',
  //   label: '角色',
  //   componentProps: {
  //     placeholder: '请选择角色',
  //     block:true,
  //     multiple:true,
  //     request: loadSelectData,
  //     onChange: (e: any) => {
  //       console.log(e);
  //     },
  //   },
  // },
  {
    field: 'status',
    component: 'Select',
    label: '状态',
    componentProps: {
      placeholder: '请选择状态',
      options: [
        {
          label: '正常',
          value: '1',
        },
        {
          label: '禁用',
          value: '2',
        },
      ],
    },
  },
];
