import { BasicColumn } from '@/components/Table';
import { FormSchema } from '@/components/Form';
import { getDictOptions } from '@/utils/dict';

export const formSchemas: FormSchema[] = [
  {
    label: '电梯编号',
    field: 'elevatorNum',
    component: 'Input',
  },
  {
    label: '维保人员',
    field: 'maintainer',
    component: 'Input',
  },
  {
    label: '维保类型',
    field: 'maintenanceType',
    component: 'Select',
    componentProps: {
      options: getDictOptions('maintenance_type'),
    },
  },
  {
    label: '描述',
    field: 'description',
    component: 'Input',
  },
  {
    label: '完成时间',
    field: 'finishTime',
    component: 'DatePicker',
  },
];

import { useRender } from '@/hooks/component/useRender';
const { renderDict } = useRender();
export const columns: BasicColumn[] = [
  {
    title: '主键id',
    dataIndex: 'id',
    ifShow: false,
  },
  {
    title: '电梯编号',
    dataIndex: 'elevatorNum',
  },
  {
    title: '维保人员',
    dataIndex: 'maintainer',
  },
  {
    title: '维保类型',
    dataIndex: 'maintenanceType',
    customRender: ({ value }) => renderDict(value, 'maintenance_type'),
  },
  {
    title: '描述',
    dataIndex: 'description',
  },
  {
    title: '完成时间',
    dataIndex: 'DatePicker',
  },
];

export const modalSchemas: FormSchema[] = [
  {
    label: '主键id',
    field: 'id',
    required: false,
    component: 'Input',
    show: false,
  },
  {
    label: '电梯编号',
    field: 'elevatorNum',
    required: true,
    component: 'Input',
  },
  {
    label: '维保人员',
    field: 'maintainer',
    required: true,
    component: 'Input',
  },
  {
    label: '维保类型',
    field: 'maintenanceType',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('maintenance_type'),
    },
  },
  {
    label: '描述',
    field: 'description',
    required: true,
    component: 'Input',
  },
  {
    label: '完成时间',
    field: 'finishTime',
    required: false,
    component: 'DatePicker',
  },
];

export const formEvaSchemas: FormSchema[] = [
  {
    label: '电梯名称',
    field: 'elevatorName',
    component: 'Input',
  },
];

export const evaColumns: BasicColumn[] = [
  {
    title: '电梯名称',
    dataIndex: 'elevatorName',
  },
];

export const modalEvaSchemas: FormSchema[] = [
  {
    label: '工作类型',
    field: 'workType',
    required: false,
    component: 'Select',
    defaultValue: '1',
    componentProps: {
      options: getDictOptions('sys_work_type'),
    },
  },
  {
    label: '期望时间',
    field: 'exceptTime',
    required: true,
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
  },
];
