import conditionSubjectBase from './condition-subject.js'
import {
  getDicts
} from '@/api/system/dict/data'

export default {
  ...conditionSubjectBase,
  key: 'subjectCate',
  title: '分类',
  dependentKeys: ['subjects'],
  isDependencyReady(params) {
    return params.subjects
  },
  getList: function(param) {
    if (param.subjects == '单科') {
      return this._getList(param, callback)
    } else if (param.subjects == '组合') {
      return new Promise((resolve, reject) => {
        getDicts('subjects_type').then(res => {
          resolve(res.data.map(dic => ({
            subjectid: dic.dictValue,
            subjectname: dic.dictLabel
          })))
        }).catch(e => reject(e))
      })
    }
  }
}
