text: /* dashboard 数据总览 */
  import storage from 'store';
  import { HANDLE_PERMISSION_IDS } from '@/store/mutation-types';
  import config from '@/config/defaultSettings';
  //  引入权限配置
  import { areaAuth, dangerAuth, positionAuth, processAuth, srcAuth, sysAuth } from '@/config/permissions/index';
  const dashboard = {
    authCode: 'dashboard'
  };
  
  /* personnel_mgt 人员管理 */
  const personnel = {
    authCode: 'personnel_mgt', // 人员管理
    personnel_info_select_menu: {
      authCode: 'personnel_info_select_menu', // 人员信息
      personnel_info_select_button: 'personnel_info_select_button', // 查询
      personnel_info_add_button: 'personnel_info_add_button', // 新增
      personnel_info_batch_delete_button: 'personnel_info_batch_delete_button', // 批量删除
      personnel_info_temp_button: 'personnel_info_temp_button', // 模板下载
      personnel_info_import_button: 'personnel_info_import_button', // 批量导入
      personnel_info_edit_button: 'personnel_info_edit_button', // 编辑
      personnel_info_delete_button: 'personnel_info_delete_button' // 删除
    },
    personnel_card_menu: {
      authCode: 'personnel_card_menu', // 人员发卡
      personnel_info_card_select_button: 'personnel_info_card_select_button', // 查询
      personnel_info_card_add_button: 'personnel_info_card_add_button', // 新增
      personnel_info_card_batch_delete_button: 'personnel_info_card_batch_delete_button', // 批量删除
      personnel_info_card_delete_button: 'personnel_info_card_delete_button' // 删除
    },
    personnel_enter_select_menu: {
      authCode: 'personnel_enter_select_menu', // 人员进出记录
      personnel_info_enter_select_button: 'personnel_info_enter_select_button' // 查询
    },
    personnel_dept_select_menu: {
      authCode: 'personnel_dept_select_menu', // 部门信息
      personnel_info_dept_select_button: 'personnel_info_dept_select_button', // 部门列表
      personnel_dept_add_button: 'personnel_dept_add_button', // 新增
      personnel_dept_edit_button: 'personnel_dept_edit_button', // 编辑
      personnel_dept_delete_button: 'personnel_dept_delete_button' // 删除
    },
    personnel_card_record_menu: {
      authCode: 'personnel_card_record_menu', // 人员发卡记录
      personnel_card_record_select_button: 'personnel_card_record_select_button', // 查询
      personnel_card_record_delete_button: 'personnel_card_record_delete_button', // 删除
      personnel_card_record_delete_batch_button: 'personnel_card_record_delete_batch_button' // 批量删除
    }
  };
  
  /* vehicle_manage_menu_top 车辆管理 */
  const vehicle = {
    authCode: 'vehicle_manage_menu_top', // 车辆管理
    vehicle_select_menu: {
      authCode: 'vehicle_select_menu', // 车辆信息
      query: 'vehicle_select_button', // 查询
      add: 'vehicle_add_button', // 新增
      batchDelete: 'vehicle_batch_delete_button', // 批量删除
      download: 'vehicle_temp_button', // 模板下载
      import: 'vehicle_import_button', // 导入
      delete: 'vehicle_delete_button', // 删除
      edit: 'vehicle_edit_button' // 编辑
    },
    vehicle_card_select_menu: {
      authCode: 'vehicle_card_select_menu', // 车辆发卡
      query: 'vehicle_card_select_button', // 查询
      add: 'vehicle_card_add_button', // 新增
      batchRecycle: 'vehicle_card_batch_recycle_button', // 批量回收
      recycle: 'vehicle_card_recycle_button' // 回收
    },
    vehicle_enter_select_menu: {
      authCode: 'vehicle_enter_select_menu', // 车辆进出记录
      query: 'vehicle_enter_select_button' // 查询
    },
    vehicle_card_record_select_menu: {
      authCode: 'vehicle_card_record_select_menu', // 车辆发卡记录
      query: 'vehicle_card_record_select_button', // 查询
      batchDelete: 'vehicle_card_record_delete_batch_button', // 批量删除
      delete: 'vehicle_card_record_delete_button' // 删除
    }
  };
  
  /* elec_rail_menu 电子围栏 */
  const rail = {
    authCode: 'elec_rail_menu', // 电子围栏
    elec_rail_select_menu: {
      authCode: 'elec_rail_select_menu', // 危险区域告警
      query: 'elec_rail_select_button', // 查询
      add: 'elec_rail_add_button', // 新增
      edit: 'elec_rail_edit_button', // 编辑
      batchDelete: 'elec_rail_delete_batch_button', // 批量回收
      delete: 'elec_rail_delete_button' // 回收
    },
    work_position_select_menu: {
      authCode: 'work_position_select_menu', // 岗位区域管理
      add: 'work_position_add_button', // 新增
      query: 'work_position_select_button', // 查询
      edit: 'work_position_edit_button', // 编辑
      batchDelete: 'work_position_delete_batch_button', // 批量删除
      delete: 'work_position_delete_button' // 删除
    }
  };
  
  /* warn_menu 告警管理 */
  const warn = {
    authCode: 'warn_menu', // 告警管理
    warn_record_stat_menu: {
      authCode: 'warn_record_stat_menu', // 告警统计
      warn_record_stat_button: 'warn_record_stat_button' // 统计
    },
    sos_record_select_menu: {
      authCode: 'sos_record_select_menu', // 求救记录
      sos_record_select_button: 'sos_record_select_button', // 查询
      sos_record_handle_button: 'sos_record_handle_button', // 处理
      sos_record_rescue_button: 'sos_record_rescue_button' // 定位
    },
    warn_select_menu: {
      authCode: 'warn_select_menu', // 告警记录
      warn_select_button: 'warn_select_button', // 查询
      work_position_edit_button: 'work_position_edit_button', // 编辑
      work_position_delete_batch_button: 'work_position_delete_batch_button', // 批量删除
      work_position_delete_button: 'work_position_delete_button' // 删除
    }
  };
  
  /* data_analy_menu 数据分析 */
  const analysis = {
    authCode: 'data_analy_menu', // 数据分析
    location_select_menu: {
      authCode: 'location_select_menu', // 轨迹回放
      query: 'location_track_button' // 查询
    },
    location_get_cameraInfo_menu: {
      authCode: 'location_get_cameraInfo_menu', // 目标跟踪
      tracer: 'location_get_cameraInfo_button' // 追踪
    },
    location_immediate_menu: {
      authCode: 'location_immediate_menu', // 即刻在线
      submit: 'location_immediate_button' // 提交
    }
  };
  
  /* device_menu 设备管理 */
  const device = {
    authCode: 'device_menu', // 设备管理
    card_select_menu: {
      authCode: 'card_select_menu', // 卡片管理
      query: 'card_select_button', // 查询
      add: 'card_add_button', // 新增
      batchDelete: 'card_delete_batch_button', // 批量删除
      download: 'card_temp_button', // 模板下载
      import: 'card_import_button', // 导入
      edit: 'card_edit_button', // 编辑
      delete: 'card_delete_button' // 删除
    },
    beacon_select_menu: {
      authCode: 'beacon_select_menu', // 信标管理
      query: 'beacon_select_button', // 查询
      add: 'beacon_add_button', // 新增
      edit: 'beacon_edit_button', // 编辑
      batchDelete: 'beacon_delete_batch_button', // 批量删除
      delete: 'beacon_delete_button' // 删除
    },
    station_select_menu: {
      authCode: 'station_select_menu', // 基站管理
      query: 'station_select_button', // 查询
      add: 'station_add_button', // 新增
      edit: 'station_edit_button', // 编辑
      batchDelete: 'station_delete_batch_button', // 批量删除
      delete: 'station_delete_button' // 删除
    },
    camera_select_menu: {
      authCode: 'camera_select_menu', // 摄像头管理
      query: 'camera_select_button', // 查询
      add: 'camera_add_button', // 新增
      edit: 'camera_edit_button', // 编辑
      play: 'camera_preview_button', // 播放
      batchDelete: 'camera_delete_batch_button', // 批量删除
      delete: 'camera_delete_button' // 删除
    },
    barrier_select_menu: {
      authCode: 'barrier_select_menu', // 卡口管理
      query: 'barrier_select_button', // 查询
      add: 'barrier_add_button', // 新增
      edit: 'barrier_edit_button', // 编辑
      batchDelete: 'barrier_delete_batch_button', // 批量删除
      delete: 'barrier_delete_button' // 删除
    }
  };
  
  /* sys_mgt_menu 系统管理 */
  const system = {
    authCode: 'sys_mgt_menu', // 系统管理
    icon_select_menu: {
      authCode: 'icon_select_menu', // 图标管理
      icon_select_button: 'icon_select_button', // 查询
      icon_edit_button: 'icon_edit_button' // 编辑
    },
    map_select_menu: {
      authCode: 'map_select_menu', // 地图管理
      map_select_button: 'map_select_button', // 查询
      map_add_button: 'map_add_button', // 新增
      map_edit_button: 'map_edit_button', // 编辑
      map_delete_button: 'map_delete_button' // 删除
    },
    role_select_menu: {
      authCode: 'role_select_menu', // 角色管理
      role_select_button: 'role_select_button', // 查询
      role_add_button: 'role_add_button', // 新增
      role_edit_button: 'role_edit_button', // 编辑
      role_edit_auth_button: 'role_edit_auth_button', // 编辑数据权限
      role_delete_batch_button: 'role_delete_batch_button', // 批量删除
      role_delete_button: 'role_delete_button' // 删除
    },
    userinfo_select_menu: {
      authCode: 'userinfo_select_menu', // 账户管理
      userinfo_select_button: 'userinfo_select_button', // 查询
      userinfo_add_button: 'userinfo_add_button', // 新增
      userinfo_edit_button: 'userinfo_edit_button', // 编辑
      userinfo_update_pass_button: 'userinfo_update_pass_button', // 修改密码
      userinfo_lock_button: 'userinfo_lock_button', // 禁用
      userinfo_delete_batch_button: 'userinfo_delete_batch_button', // 批量删除
      userinfo_delete_button: 'userinfo_delete_button' // 删除
    },
    oplog_select_menu: {
      authCode: 'oplog_select_menu', // 系统日志
      oplog_select_button: 'oplog_select_button' // 查询
    },
    workflow_select_menu: {
      authCode: 'workflow_select_menu',
      form: {
        authCode: 'workflow_form_select_menu',
        query: 'workflow_form_select_button', // 查询
        add: 'workflow_form_add_button', // 新增
        batchDelete: 'workflow_form_batch_delete_button', // 批量删除
        preview: 'workflow_form_preivew_button', // 表单预览
        turnState: 'workflow_form_turn_state_button', // 状态切换
        draw: 'workflow_form_draw_button', // 表单绘制
        sync: 'workflow_form_sync_button', // 表单同步
        delete: 'workflow_form_delete_button', // 删除
        edit: 'workflow_form_edit_button' // 编辑
      },
      process: {
        authCode: 'workflow_process_select_menu',
        query: 'workflow_process_select_button', // 查询
        add: 'workflow_process_add_button', // 新增
        batchDelete: 'workflow_process_batch_delete_button', // 批量删除
        turnState: 'workflow_process_turn_state_button', // 状态切换
        download: 'workflow_process_temp_button', // 模板下载
        import: 'workflow_process_import_button', // 导入
        delete: 'workflow_process_delete_button', // 删除
        edit: 'workflow_process_edit_button', // 编辑
        timeout: 'workflow_process_timeout_button' // 超时配置
      },
      approval: {
        authCode: 'workflow_approval_select_menu',
        query: 'workflow_approval_select_button', // 查询
        add: 'workflow_approval_add_button', // 新增
        batchDelete: 'workflow_approval_batch_delete_button', // 批量删除
        turnState: 'workflow_approval_turn_state_button', // 状态切换
        delete: 'workflow_approval_process_delete_button', // 删除
        edit: 'workflow_approval_process_edit_button', // 编辑
        config: 'workflow_approval_process_config_button' // 配置
      }
    }
  };
  
  /* message_menu 个人中心 */
  const myCenter = {
    authCode: 'message_menu', // 个人中心
    message_select_menu: {
      authCode: 'message_select_menu', // 我的消息
      message_select_button: 'message_select_button', // 查询
      message_detail_button: 'message_detail_button' // 查看
    }
  };
  
  export default {
    dashboard,
    personnel,
    vehicle,
    rail,
    warn,
    analysis,
    device,
    system,
    myCenter,
    areaAuth,
    dangerAuth,
    positionAuth,
    processAuth,
    srcAuth,
    sysAuth
  };
  
  /**
   * 判读是否具有操作权限得方法
   * @param type 传入上面每个页面中增删改查对应得字段
   * @returns {boolean}
   */
  export function hasPermission(type) {
    if (!config.permissionMode) return true;
    const handlePermissionIds = storage.get(HANDLE_PERMISSION_IDS);
    if (handlePermissionIds) {
      return handlePermissionIds.indexOf(type) > -1;
    }
    return true;
  }
  