<template>
  <div class="container">
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane v-if="hasPerm('/statics/alarmsByDept')" label="按权属单位" name="byDept">
        <alarm-statics-by-dept ref="bydept"/>
      </el-tab-pane>
      <el-tab-pane v-if="hasPerm('/statics/alarmsByArea')" label="按区域" name="byArea">
        按区域统计报警
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import AlarmStaticsByDept from './components/alarmStaticsByDept'
export default {
  name: 'AlarmStatics',
  components: { AlarmStaticsByDept },
  data() {
    return {
      activeName: 'byDept'
    }
  },
  methods: {
    handleClick(tab, event) {
      if (tab.name === 'wellcover') {
        this.$refs.bydept.fetchData()
      } else if (tab.name === 'liquid') {
        this.$refs.byarea.fetchData()
      }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  .container{
    padding: 5px;
  }
</style>
