import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';

import { DictEnum } from '@vben/constants';

import { renderDict } from '#/utils/render';

export const tableColumns: VxeGridProps['columns'] = [
  {
    field: 'level',
    title: '类型',
    slots: {
      default: ({ row }) => {
        return renderDict(row.level, DictEnum.AWARDS_TYPE);
      },
    },
  },
  {
    field: 'oilId',
    title: '荣誉名称',
  },
  {
    field: 'name',
    title: '评选机构',
  },
  {
    field: 'createTime',
    title: '获奖日期',
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
  },
];

export const drawerFormSchema: FormSchemaGetter = () => [
  {
    component: 'Select',
    fieldName: 'configId',
    label: '类型',
    componentProps: {
      options: [
        {
          label: '主要负责人',
          value: 1,
        },
        {
          label: '安管',
          value: 2,
        },
      ],
    },
    rules: 'required',
  },
  {
    component: 'Input',
    fieldName: 'configKey',
    label: '荣誉名称',
    componentProps: {
      maxlength: 100,
    },
  },
  {
    component: 'Input',
    fieldName: 'configKey',
    label: '评选机构',
    componentProps: {
      maxlength: 100,
    },
  },
  {
    component: 'DatePicker',
    componentProps: {
      type: 'date',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
    fieldName: 'openingDate',
    label: '获奖日期',
    placeholder: '选择获奖日期',
  },
];
