import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
import { projectInfoList } from '@/api/basicInfo/projectsInfo';

export const formSchemas: FormSchema[] = [
  {
    label: '组织',
    field: 'organizationId',
    component: 'ApiSelect',
    componentProps: {
      api: projectInfoList,
      labelField: 'name',
      valueField: 'id',
      placeholder: '请选择项目',
      afterFetch: (res) => {
        return res.rows;
      },
    },
  },

  {
    label: '单位名称',
    field: 'name',
    component: 'Input',
  },
];

export const columns: BasicColumn[] = [
  {
    title: '主键id',
    dataIndex: 'id',
    ifShow: false,
  },

  {
    title: '用户编号',
    dataIndex: 'code',
  },
  {
    title: '用户名称',
    dataIndex: 'name',
  },

  {
    title: '电话号码',
    dataIndex: 'phone',
  },
  {
    title: '电子邮箱',
    dataIndex: 'mail',
  },

  {
    title: '是否单位管理员',
    dataIndex: 'isAdmin',
  },
];

export const modalSchemas: FormSchema[] = [
  {
    label: '主键id',
    field: 'id',
    required: false,
    component: 'Input',
    show: false,
  },
  {
    label: '用户编号',
    field: 'code',
    required: false,
    component: 'Input',
  },
  {
    label: '联系电话',
    field: 'phone',
    required: false,
    component: 'Input',
  },
  {
    label: '第三方单位code',
    field: 'unitCode',
    required: false,
    component: 'Input',
  },
  // {
  //   label: '第三方单位id',
  //   field: 'unitId',
  //   required: false,
  //   component: 'Input',
  // },
  {
    label: '单位管理员',
    field: 'isAdmin',
    required: false,
    component: 'Select',
    componentProps: {
      options: [
        { label: '是', value: 1 },
        { label: '否', value: 2 },
      ],
    },
  },
  {
    label: '用户名称',
    field: 'name',
    required: true,
    component: 'Input',
  },
  {
    label: '电子邮箱',
    field: 'mail',
    required: false,
    component: 'Input',
  },

  {
    label: '备注',
    field: 'remark',
    required: false,
    component: 'Input',
  },
];
export const energyModalSchemas: FormSchema[] = [
  {
    label: '主键id',
    field: 'id',
    required: false,
    component: 'Input',
    show: false,
  },

  {
    label: '节能停梯间隔(s) 多个;分隔',
    field: 'remark',
    required: false,
    component: 'InputTextArea',
    colProps: { span: 24 },
  },
];
