<template>
  <div style="width: 100%;height: 100%;">
    <dashboard-person v-if="isReport && !isUnit" />
    <dashboard-expert v-if="isExpert && !isUnit" />
    <dashboard-unit v-if="isUnit" />
    <dashboard-gov v-if="isGov" />
    <dashboard-top v-if="isTop" />
    <dashboard-admin v-if="isAdmin" />
  </div>
</template>
<script>
import dashboardPerson from '@/views/home/components/dashboardPerson'
import dashboardExpert from '@/views/home/components/dashboardPerson'
import dashboardUnit from '@/views/home/components/dashboardUnit'
import dashboardGov from '@/views/home/components/dashboardGov'
import dashboardTop from '@/views/home/components/dashboardTop'
import dashboardAdmin from '@/views/home/components/dashboardAdmin'
export default {
  components: { dashboardPerson, dashboardExpert, dashboardUnit, dashboardGov, dashboardTop, dashboardAdmin },
  data () {
    return {
      isTop: false,
      isGov: false,
      isUnit: false,
      isReport: false,
      isAdmin: false,
      isExpert: false,
    };
  },
  created () {
    let user = JSON.parse(window.sessionStorage.getItem('user'))
    if (user && user.roles) {
      if (user.roles.indexOf("0") != -1) {
        this.isTop = true
      } else if (user.roles.indexOf("1") != -1) {
        this.isGov = true
      } else if (user.roles.indexOf("2") != -1) {
        this.isUnit = true
      } else if (user.roles.indexOf("3") != -1) {
        this.isReport = true
      } else if (user.roles.indexOf("4") != -1) {
        this.isAdmin = true
      } else if (user.roles.indexOf("5") != -1) {
        this.isExpert = true
      }
    }
  },
  methods: {

  },
};
</script>
<style scoped lang="less">
</style>

