<template>
  <div class="dashboard-container">
    <!--<div class="dashboard-text">欢迎您，{{ name }}</div>-->
    <el-row>
      <el-col :span="8">
        <wait-handle/>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import WaitHandle from './components/waitHandle'
import { caseRemind } from '@/api/callCase'

export default {
  name: 'Dashboard',
  components: { WaitHandle },
  computed: {
    ...mapGetters([
      'name',
      'roleNames',
      'roleTips',
      'wellTypes',
      'deviceTypes',
      'communications',
      'area'
    ])
  },
  mounted() {
    this.fetchCaseRemind()
  },
  methods: {
    // 工单提醒
    fetchCaseRemind() {
      caseRemind().then(response => {
        if (response.code === 200) {
          response.data = [{
            'type': '待办事件',
            'num': 1
          }, {
            'type': '待办督办',
            'num': 1
          }]
          if (response.data.length > 0) {
            let message = ''
            for (const item of response.data) {
              message += '您有' + item.num + '条' + item.type + '<br/>'
            }
            this.$notify.warning({
              title: '待办',
              dangerouslyUseHTMLString: true,
              message: message,
              duration: 0,
              position: 'bottom-right'
            })
          }
        }
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
