import { optionsFilter } from '@/quickComponents/utils'
// import TableImage from '@/quickComponents/TableImage'
import TableDes from '@/quickComponents/TableDes'
// 二级类型
export const typeOptions = [
  {
    label: '学历',
    value: 'ACADEMIC_EDUCATION',
  },
  {
    label: '非学历',
    value: 'NON_ACADEMIC_EDUCATION',
  },
  {
    label: '用人单位',
    value: 'EMPLOYER',
  },
]
// 性别
export const sexOptions = [
  {
    label: '女',
    value: -1,
  },
  {
    label: '男',
    value: 1,
  },
]
// 状态
export const statusOptions = [
  {
    label: '在职',
    value: '1',
  },
  {
    label: '离职',
    value: '0',
  },
]
// 表格字段
export const tableFields = {
  id: '机构ID',
  businessName: '机构名称',
  secondaryType: {
    label: '机构类型',
    filter: (type) => optionsFilter(type, typeOptions),
  },
  businessDescribe: {
    label: '机构描述',
    slot: TableDes,
  },
  // 'avatar': {
  //   slot: TableImage,
  //   label: '头像',
  //   props: {
  //     width: '140px'
  //   }
  // },
  email: '邮箱',
  username: '账号',
  name: '联系人姓名',
  phone: '联系电话',
  // 'sex': {
  //   'label': '性别',
  //   filter: (sex) => optionsFilter(sex, sexOptions)
  // },
  status: {
    label: '用户状态',
    filter: (status) => optionsFilter(status, statusOptions),
  },
}
// 头部筛选字段
export const filterFields = [
  {
    prop: 'title',
    props: {
      placeholder: '请输入关键字',
    },
  },
  // {
  //   prop: 'type',
  //   type: 'select',
  //   props: {
  //     options: [
  //       {
  //         label: '主账号',
  //         value: 'SYSTEM'
  //       }
  //     ],
  //     placeholder: '请选择账号类型'
  //   },
  //   permission: ['root']
  // },
  {
    prop: 'businessInfoId',
    type: 'select',
    props: {
      valueKey: 'id',
      labelKey: 'name',
      options: [],
      placeholder: '请选择机构',
    },
  },
]
// 修改表单字段
export const updateFields = {
  avatar: {
    type: 'image',
    label: '头像',
  },
  email: {
    label: '邮箱',
  },
  name: '姓名',
  // 'sex': {
  //   'type': 'select',
  //   'label': '性别',
  //   props: {
  //     options: sexOptions
  //   }
  // },
  status: {
    type: 'select',
    label: '用户状态',
    props: {
      options: statusOptions,
    },
  },
  username: {
    label: '账号',
  },
}

export const createFields = {
  avatar: {
    type: 'image',
    label: '头像',
  },
  email: {
    label: '邮箱',
  },
  name: {
    label: '姓名',
    required: true,
  },
  username: {
    label: '账号',
    hidden: false,
    required: true,
  },
  password: {
    label: '密码',
    hidden: false,
    required: true,
  },
  secondaryType: {
    type: 'select',
    label: '机构类型',
    required: true,
    hidden: true,
    props: {
      options: typeOptions,
    },
  },
  // 'sex': {
  //   'type': 'select',
  //   'label': '性别',
  //   props: {
  //     options: sexOptions
  //   }
  // },
  status: {
    type: 'select',
    label: '用户状态',
    props: {
      options: statusOptions,
    },
  },
  // 'businessInfo': {
  //   type: 'none',
  //   'label': '机构信息:'
  // },
}
export const businessInfoFields = {
  name: {
    label: '机构名称',
    required: true,
  },
  phone: {
    label: '联系电话(勘误)',
    required: true,
  },
  unifiedSocialCreditCode: {
    label: '统一社会信用代码',
    required: true,
  },
  feeRefundAgreement: {
    label: '费用返还约定',
    props: {
      type: 'textarea',
      rows: 5,
      maxlength: 1000,
    },
    // required: true
  },
  businessDescribe: {
    label: '机构描述',
    props: {
      type: 'textarea',
      rows: 5,
      maxlength: 1000,
    },
    required: true,
  },
}
