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

export const formSchemas: FormSchema[] = [
  {
    label: '咨询类型',
    field: 'consultType',
    component: 'Select',
    componentProps: {
      options: getDictOptions('sys_work_type'),
    },
  },

  {
    label: '期望时间',
    field: 'expectTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    label: '创建人名称',
    field: 'createName',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'state',
    component: 'Select',
    componentProps: {
      options: getDictOptions('workinfo_status'),
    },

  },
  {
    label: '期望方式',
    field: 'expectMode',
    component: 'Select',
    componentProps: {
      options: getDictOptions('except_type'),
    },
  },
  {
    label: '电梯编号',
    field: 'elevatorNum',
    component: 'Input',
  },
  {
    label: '电梯地址',
    field: 'elevatorAddress',
    component: 'Input',
  },
  {
    label: '接收时间',
    field: 'receiveTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '接收人名称',
    field: 'receiveName',
    component: 'Input',
  },


  {
    label: '完成时间',
    field: 'finishTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '是否审核',
    field: 'auditState',
    component: 'Select',
    componentProps: {
      options: getDictOptions('sys_is_check'),
    },
  },
  {
    label: '审核时间',
    field: 'auditTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
];

const { renderDict } = useRender();
export const columns: BasicColumn[] = [
  {
    title: '主键id',
    dataIndex: 'id',
    ifShow: false
  },
  {
    title: '咨询类型',
    dataIndex: 'consultType',
    customRender: ({ value }) => renderDict(value, 'sys_work_type'),
  },
  // {
  //   title: '咨询描述',
  //   dataIndex: 'consultDesc',
  // },
  // {
  //   title: '咨询附件',
  //   dataIndex: 'consultAttachment',
  // },
  {
    title: '期望时间',
    dataIndex: 'expectTime',
  },
  {
    title: '创建人名称',
    dataIndex: 'createName',
  },
  {
    title: '状态',
    dataIndex: 'state',
    customRender: ({ value }) => renderDict(value, 'workinfo_status'),
  },
  {
    title: '期望方式',
    dataIndex: 'expectMode',
    customRender: ({ value }) => renderDict(value, 'except_type'),
  },
  {
    title: '电梯编号',
    dataIndex: 'elevatorNum',
  },
  {
    title: '电梯地址',
    dataIndex: 'elevatorAddress',
  },
  // {
  //   title: '接收人id',
  //   dataIndex: 'receiveId',
  // },
  {
    title: '接收时间',
    dataIndex: 'receiveTime',
  },
  {
    title: '接收人名称',
    dataIndex: 'receiveName',
  },
  // {
  //   title: '处理描述',
  //   dataIndex: 'sloveDesc',
  // },
  // {
  //   title: '处理附件',
  //   dataIndex: 'sloveAttachment',
  // },
  {
    title: '完成时间',
    dataIndex: 'finishTime',
  },
  {
    title: '是否审核',
    dataIndex: 'auditState',
    customRender: ({ value }) => renderDict(value, 'sys_is_check'),
  },
  {
    title: '审核时间',
    dataIndex: 'auditTime',
  },
];

export const modalSchemas: FormSchema[] = [
  {
    label: '主键id',
    field: 'id',
    required: false,
    component: 'Input',
    show: false,
  },
  {
    label: '咨询类型',
    field: 'consultType',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('sys_work_type'),
    },
  },
  {
    label: '咨询描述',
    field: 'consultDesc',
    required: true,
    component: 'Input',
  },
  {
    label: '咨询附件',
    field: 'consultAttachment',
    required: true,
    component: 'Upload',
  
  },
  {
    label: '期望时间',
    field: 'expectTime',
    required: true,
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
  },
  {
    label: '创建人名称',
    field: 'createName',
    required: true,
    component: 'Input',
  },
  {
    label: '状态',
    field: 'state',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('workinfo_status'),
    },
  },
  {
    label: '期望方式',
    field: 'expectMode',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('except_type'),
    },
  },
  {
    label: '电梯编号',
    field: 'elevatorNum',
    required: true,
    component: 'Input',
  },
  {
    label: '电梯地址',
    field: 'elevatorAddress',
    required: true,
    component: 'Input',
  },
  {
    label: '接收人id',
    field: 'receiveUserId',
    required: true,
    component: 'Input',
  },
  {
    label: '接收时间',
    field: 'receiveTime',
    required: true,
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '接收人名称',
    field: 'receiveUserName',
    required: true,
    component: 'Input',
  },
  {
    label: '处理描述',
    field: 'sloveDesc',
    required: true,
    component: 'Input',
  },
  {
    label: '处理附件',
    field: 'sloveAttachment',
    required: true,
    component: 'Upload',
  },
  {
    label: '完成时间',
    field: 'finishTime',
    required: true,
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '是否审核',
    field: 'auditState',
    required: true,
    component: 'Select',
    componentProps: {
      options: getDictOptions('sys_is_check'),
    },
  },
  {
    label: '审核时间',
    field: 'auditTime',
    required: true,
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD HH:mm:ss',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
];

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',
    componentProps: {
      options: getDictOptions('sys_work_type'),
    },
  },
  {
    label: '援助类型',
    field: 'rescueType',
    required: false,
    component: 'RadioGroup',
    componentProps: {
      options: [
        {
          label: '线上',
          value: 1,
        },
        {
          label: '线下',
          value: 2,
        },
      ],
    },

  },
  {
    label: '期望时间',
    field: 'expectTime',
    required: true,
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
  },
];
