import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { EmployeeRegularReminderApi } from '#/api/hr/regularReminder';

export const querySchema: VbenFormSchema[] = [
  {
    component: 'Input',
    fieldName: 'plate',
    label: '板块',
  },
  {
    component: 'Input',
    fieldName: 'firstLevelDepartment',
    label: '一级部门',
  },
  {
    component: 'Input',
    fieldName: 'secondLevelDepartment',
    label: '二级部门',
  },
  {
    component: 'Input',
    fieldName: 'thirdLevelDepartment',
    label: '三级部门',
  },
  // {
  //   component: 'Input',
  //   fieldName: 'deptId',
  //   label: '部门ID',
  // },
  {
    component: 'Input',
    fieldName: 'position',
    label: '主岗位',
  },
  {
    component: 'Input',
    fieldName: 'name',
    label: '姓名',
  },
  {
    component: 'Input',
    fieldName: 'phoneNumber',
    label: '手机号码',
  },
  {
    component: 'RangePicker',
    fieldName: 'entryDate',
    label: '入职时间',
  },
  {
    component: 'RangePicker',
    fieldName: 'expectedRegularDate',
    label: '转正时间',
  },
];

export function useColumns(): VxeTableGridOptions<EmployeeRegularReminderApi.EmployeeRegularReminder>['columns'] {
  return [
    {
      title: '板块',
      field: 'plate',
    },
    {
      title: '一级部门',
      field: 'firstLevelDepartment',
    },
    {
      title: '二级部门',
      field: 'secondLevelDepartment',
    },
    {
      title: '三级部门',
      field: 'thirdLevelDepartment',
    },
    // {
    //   title: '部门ID',
    //   field: 'deptId',
    // },
    {
      title: '主岗位',
      field: 'position',
    },
    {
      title: '姓名',
      field: 'name',
    },
    {
      title: '手机号码',
      field: 'phoneNumber',
    },
    {
      title: '入职时间',
      field: 'entryDate',
      formatter: 'formatDate',
    },
    {
      title: '转正时间',
      field: 'expectedRegularDate',
      formatter: 'formatDate',
    },
    {
      title: '备注',
      field: 'remarks',
    },
    {
      align: 'right',
      slots: { default: 'action' },
      // cellRender: {
      //   attrs: {
      //     nameField: 'name',
      //     nameTitle: '转正提醒',
      //     onClick: onActionClick,
      //   },
      //   name: 'CellOperation',
      //   options: [
      //     {
      //       code: 'edit',
      //       accessCode: ['employee:employeeRegularReminder:edit'],
      //     }, // 默认的编辑按钮
      //     {
      //       code: 'delete',
      //       accessCode: ['employee:employeeRegularReminder:remove'],
      //     }, // 默认的删除按钮
      //   ],
      // },
      field: 'action',
      fixed: 'right',
      headerAlign: 'center',
      resizable: false,
      showOverflow: false,
      title: '操作',
      width: 'auto',
    },
  ];
}
