Newer
Older
CallCenterFront / src / views / assessResult / deptResult.vue
yangqianqian on 27 May 2021 2 KB 修复统计图表不显示的问题
<template>
  <div class="container">
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane label="指标统计" name="list">
        <list-dept-result ref="listDeptResult"/>
      </el-tab-pane>
      <el-tab-pane label="统计图表" name="chart">
        <chart-dept-result v-if="activeName === 'chart'" ref="chartDeptResult"/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import ListDeptResult from './components/listDeptResult'
import ChartDeptResult from './components/chartDeptResult'
export default {
  name: 'DeptResult',
  components: { ListDeptResult, ChartDeptResult },
  data() {
    return {
      activeName: 'list'
    }
  },
  created() {
    // 如果路径里带参数,自己解析deviceType参数
    // if (window.location.href) {
    //   const params = parseUrl(window.location.href)
    //   if (params && params.deviceType) {
    //     this.changeTab(params.deviceType)
    //   } else {
    //     this.caclActive()
    //   }
    // }
  },
  methods: {
    // 处理Tab点击事件,每次点击更新数据
    handleClick(tab, event) {
      if (tab.name === 'list') {
        this.activeName = 'list'
        this.$refs.listDeptResult.fetchData()
      } else if (tab.name === 'chart') {
        this.activeName = 'chart'
        this.$refs.chartDeptResult.fetchData()
      }
    },
    // 计算那个是当前第一个tab
    caclActive() {
      // if (hasPermission('/welldata/list')) {
      //   this.activeName = 'wellcover'
      // } else if (hasPermission('/liquiddata/list')) {
      //   this.activeName = 'liquid'
      // } else if (hasPermission('/gasdata/list')) {
      //   this.activeName = 'gas'
      // } else if (hasPermission('/digdata/list')) {
      //   this.activeName = 'dig'
      // } else if (hasPermission('/harmfuldata/list')) {
      //   this.activeName = 'harmful'
      // } else if (hasPermission('/tempdata/list')) {
      //   this.activeName = 'temp'
      // } else if (hasPermission('/welllocadata/list')) {
      //   this.activeName = 'wellloca'
      // } else if (hasPermission('/liquidGasData/list')) {
      //   this.activeName = 'liquidgas'
      // }
    }
  }
}
</script>

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