/**
 * long description for the file
 *
 * @summary 权限判断函数
 * @author wu <308822989@qq.com>
 *
 * Created at     : 2018-08-12 14:52:51
 * Last modified  : 2018-08-18 18:11:42
 */
import store from '@/store/index.js';
import { dgTree } from '@/utils/util.js';
/**
 * 菜单树上功能权限判断函数
 * @param {String} menuCode 功能编码
 * @returns {Boolean} 菜单树上是否有这个菜单 有：true, 没有：false
 */
const checkPermission = function (menuCode) {
  let bol = false;
  let menu = store.state.routes;
  dgTree(menu, 'children', item => {
    if (item.menuCode === menuCode) {
      bol = true;
    }
  });
  return bol;
}

//  默认
export default checkPermission;
