export default {
  id: 'education',
  title: '教育背景',
  showProgress: true,
  progress: 0,
  get: {
    action: '/zws/v1/enrollment/educations?project_id=1001',
    callback(data) {
      const { start_date: startDate, end_date: endDate } = data
      if (startDate) {
        data.times = [startDate + '', endDate + '']
      }
      return data
    }
  },
  update: {
    action: '/zws/v1/enrollment/educations/batch-upload',
    data: { project_id: 1001 },
    callback(data) {
      console.log(data)
      let [startDate, endDate] = data.times
      data.start_date = startDate
      data.end_date = endDate
      return data
    }
  },
  form: {
    hasAdd: true,
    options: {
      labelWidth: '160px'
    },
    model: [
      {
        start_date: null,
        end_date: null,
        school_name_cn: '',
        school_city: '',
        major_cn: '',
        degree: 0
      }
    ],
    items: [
      {
        type: 'date-picker-form',
        elemType: 'monthrange',
        label: '教育时间',
        model: 'times',
        required: true,
        attrs: { 'value-format': 'yyyy-MM' }
      },
      {
        type: 'input-form',
        label: '学校名称',
        model: 'school_name_cn',
        rules: [
          {
            required: true,
            message: '请输入学校名称',
            trigger: 'blur'
          }
        ]
      },
      {
        type: 'input-form',
        label: '学校所在国家',
        model: 'school_country',
        rules: [
          {
            required: true,
            message: '请输入学校所在国家',
            trigger: 'blur'
          }
        ]
      },
      {
        type: 'input-form',
        label: '学校所在城市',
        model: 'school_city',
        rules: [
          {
            required: true,
            message: '请输入学校所在城市',
            trigger: 'blur'
          }
        ]
      },
      {
        type: 'input-form',
        label: '专业名称',
        model: 'major_cn',
        rules: [
          {
            required: true,
            message: '请输入专业名称',
            trigger: 'blur'
          }
        ]
      },
      {
        type: 'select-form',
        values: [
          { label: '请选择', value: 0 },
          { label: '专科', value: 1 },
          { label: '本科', value: 2 },
          { label: '本科/学士', value: 3 },
          { label: '硕士研究生', value: 4 },
          { label: '研究生/硕士', value: 5 },
          { label: '博士研究生', value: 6 },
          { label: '研究生/博士', value: 7 },
          { label: '其他', value: 9 }
        ],
        label: '学历/学位',
        model: 'degree'
      }
    ]
  }
}
