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: 'tenementName',
  },

  {
    title: '地址',
    dataIndex: 'address',
  },
];

export const modalSchemas: FormSchema[] = [
  {
    label: '主键id',
    field: 'id',
    required: false,
    component: 'Input',
    show: false,
  },
  {
    label: '用户编号',
    field: 'code',
    required: false,
    component: 'Input',
  },
  {
    label: '单位管理员',
    field: 'organizationId',
    required: false,
    component: 'Select',
    componentProps: {
      options: [
        { label: '是', value: 1 },
        { label: '否', value: 2 },
      ],
    },
  },
  {
    label: '用户名称',
    field: 'name',
    required: true,
    component: 'Input',
  },
  {
    label: '电子邮箱',
    field: 'address',
    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 },
  },
];

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

  {
    title: '单位名称',
    dataIndex: 'name',
  },
  {
    title: '单位地址',
    dataIndex: 'address',
  },

  {
    title: '联系人',
    dataIndex: 'contacts',
  },
  {
    title: '联系电话',
    dataIndex: 'phone',
  },

  {
    title: '组织',
    dataIndex: 'organizationId',
  },
];
