import conditionObjectBase from './condition-class.js'
import * as back from '@/api/webApi/back'

export default {
  ...conditionObjectBase,
  dependentKeys: ['chatGradeId', 'chatTarget'],
  key: 'chatClassId',
  title: '班级',
  isDependencyReady(params) {
    // 选择发送至班级时，班级多选
    return params.chatGradeId && params.chatTarget == 2
  },
  getList: function(param) {
    return new Promise((resolve, reject) => {
      back.getUserClasses({
        gradeId: param.chatGradeId
      }).then(res => {
        resolve(res.data)
      }).catch(e => reject(e))
    })
  }
}
