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

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: 'Input',
    fieldName: 'officePhone',
    label: '办公电话',
  },
  {
    component: 'Input',
    fieldName: 'shortLine',
    label: '短线',
  },
  // {
  //   component: 'Input',
  //   fieldName: 'remarks',
  //   label: '备注',
  // },
];

export function useColumns(): VxeTableGridOptions<PhoneBookApi.PhoneBook>['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: 'officePhone',
    },
    {
      title: '短线',
      field: 'shortLine',
    },
    {
      title: '备注',
      field: 'remarks',
    },
    // {
    //   align: 'right',
    //   cellRender: {
    //     attrs: {
    //       nameField: 'name',
    //       nameTitle: '电话本管理',
    //       onClick: onActionClick,
    //     },
    //     name: 'CellOperation',
    //     options: [
    //       {
    //         code: 'edit',
    //         accessCode: ['hr:phoneBook:edit'],
    //       }, // 默认的编辑按钮
    //       {
    //         code: 'delete',
    //         accessCode: ['hr:phoneBook:remove'],
    //       }, // 默认的删除按钮
    //     ],
    //   },
    //   field: 'action',
    //   fixed: 'right',
    //   headerAlign: 'center',
    //   resizable: false,
    //   showOverflow: false,
    //   title: '操作',
    //   width: 'auto',
    // },
  ];
}
