<template>
  <div class="container">
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane v-if="hasPerm('/smartAnalysis')" label="内涝评估分析记录" name="water">
        <list-water ref="watercomp"/>
      </el-tab-pane>
      <el-tab-pane v-if="hasPerm('/smartAnalysis')" label="燃气管线泄漏分析记录" name="gas">
        <list-gas-leakage ref="gascomp"/>
      </el-tab-pane>
      <el-tab-pane v-if="hasPerm('/smartAnalysis')" label="热力管线泄漏分析记录" name="hot">
        <list-hot-leakage ref="hotcomp"/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import ListWater from './components/listWater'
import ListGasLeakage from './components/listGasLeakage'
import ListHotLeakage from './components/listHotLeakage'
export default {
  name: 'DataManage',
  components: { ListHotLeakage, ListGasLeakage, ListWater },
  data() {
    return {
      activeName: 'water'
    }
  },
  methods: {
    handleClick(tab, event) {
      if (tab.name === 'water') {
        this.$refs.watercomp.fetchData()
      } else if (tab.name === 'gas') {
        this.$refs.gascomp.fetchData()
      } else if (tab.name === 'hot') {
        this.$refs.hotcomp.fetchData()
      }
    }
  }
}
</script>

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