import conditionObjectBase from '../condition-object-base.js'
import { getClass } from '@/api/webApi/elective/dispatch.js'
export default {
  ...conditionObjectBase,
  dependentKeys: ['localGroupId'],
  key: 'dispatchClassId',
  title: '班级',
  isDependencyReady(params) {
    return params.localGroupId
  },
  getList: function(param, $vue) {
    return new Promise((resolve, reject) => {
      getClass({
        groupId: param.localGroupId,
        roundId: $vue.model.dispatchRoundId
      }).then(res => {
        resolve(res.data)
      })
      .catch(e => reject(e))
    })
  },
  getCode: function(item) {
    return item.id
  },
  getLabel: function(item) {
    return item.name
  }
}
