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

const userStore = useUserStore()
const option: TableOption = {
  api: {
    base: '/recruit/position',
    page: '/page/res'
  },
  permissionPrefix: 'recruit_position_',
  permissions: userStore.permissions,
  columns: [
    {
      name: '职位',
      prop: 'jobName',
      rules: [
        { required: true, message: '职位不能为空' },
        { minLength: 2, message: '职位不少于2个字符' },
        { maxLength: 40, message: '不能超过40个字符' }
      ]
    },
    {
      name: '职位地点',
      prop: 'positionLocation',
      type: 'input',
      rules: [
        { required: true, message: '职位地点不能为空' },
        { minLength: 2, message: '职位不少于2个字符' },
        { maxLength: 60, message: '不能超过60个字符' }
      ]
    },
    {
      name: '企业联系人',
      prop: 'enterpriseContactPerson',
      type: 'input',
      rules: [{ required: true, message: '企业联系人不能为空' }]
    },
    {
      name: '联系人手机号',
      prop: 'enterprisePhone',
      type: 'input',
      rules: [{ required: true, message: '联系人手机号' }]
    },
    {
      name: '附件',
      prop: 'files',
      type: 'upload',
      action: '/sys/file/upload',
      onBeforeRemove,
      stringify: true
    }
  ]
}
export default option
