index.js 735 Bytes
import store from '@/store'
import dictionaries from '@/api/dictionaries'

// 证件种类全局过滤器
export function cardTypeFilter (value) {
  var name
  if (store.getters.cardTypeOption.length == 0) {
    dictionaries.getDdicByMC('证件种类').then((res) => {
      store.dispatch('dictionaries/getCardType', res.result)
    })
  }
  store.getters.cardTypeOption.map((item) => {
    if (item.id == value) {
      name = item.name
    }
  });
  if (name) {
    return name
  } else {
    return '暂无'
  }
}

// 全部字典
export function stsInfo (value) {
  if (store.getters.stsInfo.length == 0) {
    dictionaries.getDictionary().then(res => {
      store.dispatch('dictionariesAll/getDicData', res.result)
    })
  }
}