import conditionObjectBase from '../condition-object-base.js'
import {
  gradeList
} from '@/api/webApi/webQue.js'

export default {
  ...conditionObjectBase,
  key: 'seniorGradeId',
  title: '学册',
  dependentKeys: ['editionId'],
  modelAsParam: true,
  isDependencyReady(params) {
    return params.editionId
  },
  getList: function(param) {
    return new Promise((resolve, reject) => {
      gradeList({
        subjectId: param.subjectId,
        editionId: param.editionId
      }).then((res) => {
        resolve(res.data)
      }).catch(e => reject(e))
    })
  },
  getCode(item) {
    return item.gradeid
  },
  getLabel(item) {
    return item.gradename
  }
}
