import conditionObjectBase from '../condition-object-base.js'
import mxCache from '@/components/Cache/mx-cache-mixin.js'

export default {
  ...conditionObjectBase,
  key: 'subjectId',
  title: '科目',
  getList: function(param, callback) {
    return this._getList(param, callback)
  },
  _getList: function(param, callback) {
    return new Promise((resolve, reject) => {
      mxCache.methods.getUserSubjectListByCache().then(data => {
        if (data.length == 0) {
          // TODO: 这里如果没有科目，原逻辑是跳转科目绑定页
        }
        resolve(data)
      }).catch(e => reject(e))
    })
  },
  getCode: function(item) {
    return item.subjectid
  },
  getLabel: function(item) {
    return item.subjectname
  }
}
