import store from '../store'
/**
 * 判断是否有权限
  */
export function hasPermission(permission) {
  const btns = store.getters.btns
  return btns.some(btn => { // 遍历btns，查找btn.url是否有匹配的permission，有则返回true，否则返回false
    return btn.url === permission
  })
}

// 判断用户是否为受理员，允许接电话的
export function isReceiver() {
  const roleTips = store.getters.roleTips
  return roleTips.some(tip => { // 遍历tips，找到符合要求的返回true，否则返回false
    return (tip === 'receiver' || tip === 'monitor' || tip === 'administrator')
  })
}
