import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
import { IS_ENERGY, IS_ONLINE, START_TYPE, TRUE_RIGHT } from '@/utils/lib/commonMap';
import { getDictOptions } from '@/utils/dict';

export const formSchemas: FormSchema[] = [
  {
    label: '设备编号',
    field: 'deviceCode',
    component: 'Input',
  },
  {
    label: '设备名称',
    field: 'deviceName',
    component: 'Input',
  },
  {
    label: '注册代码',
    field: 'registerCode',
    component: 'Input',
  },
  {
    label: '关联电梯名称',
    field: 'elevatorName',
    component: 'Input',
  },
  {
    label: '设备版本类型',
    field: 'deviceVersion',
    component: 'Select',
    componentProps: {
      options: getDictOptions('device_brand_type'),
    },
  },
  {
    label: '在线状态',
    field: 'isLine',
    component: 'Select',
    componentProps: {
      options: IS_ONLINE,
    },
  },
  {
    label: '最后在线时间',
    field: 'finallyTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD ',
      valueFormat: 'YYYY-MM-DD',
    },
  },
  // {
  //   label: '项目',
  //   field: 'projectId',
  //   component: 'Input',
  // },
  {
    label: '是否关联电梯',
    field: 'isElevator',
    component: 'Select',
    componentProps: {
      options: TRUE_RIGHT,
    },
  },
  {
    label: '节能类型',
    field: 'energyType',
    component: 'Select',
    componentProps: {
      options: IS_ENERGY,
    },
  },
  {
    label: '启动类型',
    field: 'startType',

    component: 'Select',
    componentProps: {
      options: START_TYPE,
    },
  },
  {
    label: '物业单位',
    field: 'tenementName',
    component: 'Input',
  },
];

import { useRender } from '@/hooks/component/useRender';
const { renderTag, renderDict } = useRender();
export const columns: BasicColumn[] = [
  {
    title: '主键id',
    dataIndex: 'id',
    ifShow: false,
  },
  {
    title: '设备编号',
    dataIndex: 'deviceCode',
  },
  {
    title: '设备名称',
    dataIndex: 'deviceName',
  },
  {
    title: '注册代码',
    dataIndex: 'registerCode',
  },
  {
    title: '关联电梯名称',
    dataIndex: 'elevatorName',
  },
  {
    title: '设备版本类型',
    dataIndex: 'deviceVersion',
  },
  {
    title: '当前版本号',
    dataIndex: 'currentVersion',
  },
  {
    title: '采集(FOTA)版本',
    dataIndex: 'fotaVersion',
  },

  {
    title: '在线状态',
    dataIndex: 'isLine',
  },
  {
    title: '最后在线时间起止',
    dataIndex: 'finallyTime',
  },
  // {
  //   title: '项目',
  //   dataIndex: 'projectId',
  // },
  {
    title: '是否关联电梯',
    dataIndex: 'isElevator',
  },
  // {
  //   title: '节能类型',
  //   dataIndex: 'energyType',
  // },
  // {
  //   title: '启动类型',
  //   dataIndex: 'startType',
  // },
  {
    title: '离线时长',
    dataIndex: 'offlineTime',
  },
  // {
  //   title: '备注',
  //   dataIndex: 'remark',
  // },
];

export const modalSchemas: FormSchema[] = [
  {
    label: '主键id',
    field: 'id',
    required: false,
    component: 'Input',
    show: false,
  },
  {
    label: '设备编号',
    field: 'deviceCode',
    required: true,
    component: 'Input',
  },
  {
    label: '设备名称',
    field: 'deviceName',
    required: true,
    component: 'Input',
  },
  {
    label: '注册代码',
    field: 'registerCode',
    required: true,
    component: 'Input',
  },
  {
    label: '关联电梯名称',
    field: 'elevatorName',
    required: true,
    component: 'Input',
  },
  {
    label: '设备版本类型',
    field: 'deviceVersion',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('device_brand_type'),
    },
  },
  {
    label: '在线状态',
    field: 'isLine',
    required: true,
    component: 'Select',
    componentProps: {
      options: IS_ONLINE,
    },
  },
  {
    label: '最后在线时间起止',
    field: 'finallyTime',
    required: true,
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '项目',
    field: 'deptId',
    required: true,
    component: 'TreeSelect',
    helpMessage: ['注意绑定的角色要带相应的部门权限, 否则无法正常登录'],
  },
  {
    label: '是否关联电梯',
    field: 'isElevator',
    required: true,
    component: 'Select',
    componentProps: {
      options: TRUE_RIGHT,
    },
  },
  {
    label: '节能类型',
    field: 'energyType',
    required: true,
    component: 'Select',
    componentProps: {
      options: IS_ENERGY,
    },
  },
  {
    label: '启动类型',
    field: 'startType',
    required: true,
    component: 'Select',
    componentProps: {
      options: START_TYPE,
    },
  },
  {
    label: '物业单位',
    field: 'tenementId',
    required: true,
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remark',
    required: true,
    component: 'Input',
  },
];
