<template>
  <div>
    <el-button type="primary" plain icon="el-icon-s-data" size="mini" @click="goto">
      监控平台</el-button>
  </div>
</template>

<script>
import {selectSecnes} from '@/api/board/nav'
export default {
  name: 'RuoYiGit',
  data() {
    return {
      url: 'https://gitee.com/y_project/RuoYi-Cloud'
    }
  },
  methods: {
    goto() {
      if (this.$store.state.user.permissions.includes('business:monitor:index') || this.$store.state.user.permissions.includes('*:*:*')) {
        this.$router.push({path: "/board/index"});
      } else {
        selectSecnes().then((e)=>{
         let data = e.data.find(e=> e.defaultFlag === '1') || null
          debugger
          if(!data){
            data = e.data[0]
          }
          debugger
          this.$store.dispatch('app/setSceneId', data.sceneId)
          this.$router.push({path: '/board/'+data.router+'?name='+data.sceneName})
        })
        // this.$router.push({path: '/board/smartScene'})
      }
    }
  }
}
</script>
