import Store from '@/store'

export const reportPermission = (reportId, roles) => {
    if(!reportId){
        return true
    }
  const role = Store.state.admin.userinfo
    if(role.roleType === 1){
        return true
    }
    const permissions = Store.getters && Store.getters.permissions
    if(Object.keys(permissions).length==0){
        return true
    }
    const reportRole = permissions[reportId]
    if(!reportRole){
        return true
    }
        var result = false
        for(var item of reportRole){
            if(roles.includes(item)){
                result = true
                break
            }
        }
    return result
  }