import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
import { TRUE_RIGHT } from '@/utils/lib/commonMap';

export const formSchemas: FormSchema[] = [
  {
    label: '注册代码',
    field: 'registerCode',
    component: 'Input',
  },
  {
    label: '电梯编号',
    field: 'elevatorNum',
    component: 'Input',
  },
  {
    label: '二维码编号',
    field: 'qrCode',
    component: 'Input',
  },
  {
    label: '电梯名称',
    field: 'elevatorName',
    component: 'Input',
  },
  {
    label: '电梯地址',
    field: 'elevatorAddress',
    component: 'Input',
  },
  {
    label: '关联日期起',
    field: 'startTime',
    component: 'Input',
  },
  {
    label: '关联日期止',
    field: 'endTime',
    component: 'Input',
  },
  {
    label: '项目',
    field: 'projectId',
    component: 'Input',
  },
  {
    label: '项目名称',
    field: 'projectName',
    component: 'Input',
  },
  {
    label: '联系人',
    field: 'contacts',
    component: 'Input',
  },
  {
    label: '联系方式',
    field: 'contactsPhone',
    component: 'Input',
  },
  {
    label: '关联账号',
    field: 'relevancyAccount',
    component: 'Input',
  },
  {
    label: '是否关联二维码',
    field: 'isRelevancy',
    component: 'Select',
    componentProps: {
      options: TRUE_RIGHT,
    },
  },
];

export const columns: BasicColumn[] = [
  {
    title: '主键id',
    dataIndex: 'id',
    ifShow: false,
  },
  {
    title: '注册代码',
    dataIndex: 'registerCode',
  },
  {
    title: '电梯编号',
    dataIndex: 'elevatorNum',
  },
  {
    title: '二维码编号',
    dataIndex: 'qrCode',
  },
  {
    title: '电梯名称',
    dataIndex: 'elevatorName',
  },
  {
    title: '电梯地址',
    dataIndex: 'elevatorAddress',
  },
  {
    title: '关联日期起',
    dataIndex: 'startTime',
  },
  {
    title: '关联日期止',
    dataIndex: 'endTime',
  },
  // {
  //   title: '项目',
  //   dataIndex: 'projectId',
  // },
  {
    title: '项目名称',
    dataIndex: 'projectName',
  },
  {
    title: '联系人',
    dataIndex: 'contacts',
  },
  {
    title: '联系方式',
    dataIndex: 'contactsPhone',
  },
  {
    title: '关联账号',
    dataIndex: 'relevancyAccount',
  },
  {
    title: '是否关联二维码',
    dataIndex: 'isRelevancy',
  },
];

export const modalSchemas: FormSchema[] = [
  {
    label: '主键id',
    field: 'id',
    required: false,
    component: 'Input',
    show: false,
  },
  {
    label: '注册代码',
    field: 'registerCode',
    required: true,
    component: 'Input',
  },
  {
    label: '电梯编号',
    field: 'elevatorNum',
    required: true,
    component: 'Input',
  },
  {
    label: '二维码编号',
    field: 'qrCode',
    required: true,
    component: 'Input',
  },
  {
    label: '电梯名称',
    field: 'elevatorName',
    required: true,
    component: 'Input',
  },
  {
    label: '电梯地址',
    field: 'elevatorAddress',
    required: true,
    component: 'Input',
  },
  {
    label: '关联日期起',
    field: 'startTime',
    required: true,
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    label: '关联日期止',
    field: 'endTime',
    required: true,
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    label: '项目',
    field: 'deptId',
    required: true,
    component: 'TreeSelect',
    helpMessage: ['注意绑定的角色要带相应的部门权限, 否则无法正常登录'],
  },
  {
    label: '项目名称',
    field: 'projectName',
    required: true,
    component: 'Input',
  },
  {
    label: '联系人',
    field: 'contacts',
    required: true,
    component: 'Input',
  },
  {
    label: '联系方式',
    field: 'contactsPhone',
    required: true,
    component: 'Input',
  },
  {
    label: '关联账号',
    field: 'relevancyAccount',
    required: true,
    component: 'Input',
  },
  {
    label: '是否关联二维码;',
    field: 'isRelevancy',
    required: false,
    component: 'Select',
    componentProps: {
      options: TRUE_RIGHT,
    },
  },
];
