import { useUserStore } from '@/store/user'
import { TableOption } from '@/types'
import { onBeforeRemove } from '@/utils/upload-event'

const userStore = useUserStore()
const option: TableOption = {
  api: {
    base: '/recruit/resume',
    page: '/page/res'
  },
  permissionPrefix: 'recruit_resume_',
  permissions: userStore.permissions,
  columns: [
    {
      name: '姓名',
      prop: 'fullName',
      rules: [
        { required: true, message: '姓名不能为空' },
        { minLength: 2, message: '姓名不少于2个字符' },
        { maxLength: 20, message: '不能超过20个字符' }
      ]
    },
    {
      name: '附件',
      prop: 'files',
      type: 'upload',
      action: '/sys/file/upload',
      onBeforeRemove,
      stringify: true
    },
    {
      name: '简历来源',
      prop: 'resumeSource',
      type: 'select',
      dicUrl: '/sys/dict/resume_source'
    },
    {
      name: '创建人',
      prop: 'createName',
      addDisplay: false,
      editDisplay: false
    },
    {
      name: '创建人手机号',
      prop: 'createPhone',
      addDisplay: false,
      editDisplay: false
    }
  ]
}
export default option
