Newer
Older
smartwell_front / src / views / deviceConfig / deviceConfig.vue
Stephanie on 28 Nov 2022 5 KB feat<*>:增加井盖液位一体机
<template>
  <div class="container">
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane v-if="hasPerm('/busConfig/wellcoverConfig/list')" label="井盖状态监测仪" name="wellcover">
        <list-wellcover-config ref="wellcoverConfig" />
      </el-tab-pane>
      <el-tab-pane v-if="hasPerm('/busConfig/liquidConfig/list')" label="液位监测仪" name="liquid">
        <list-liquid-config ref="liquidConfig" />
      </el-tab-pane>
      <el-tab-pane v-if="hasPerm('/busConfig/gasConfig/list')" label="燃气智能监测终端" name="gas">
        <list-gas-config ref="gasConfig" />
      </el-tab-pane>
      <el-tab-pane v-if="hasPerm('/busConfig/harmfulConfig/list')" label="有害气体监测仪" name="harmful">
        <list-harmful-config ref="harmfulConfig" />
      </el-tab-pane>
      <el-tab-pane v-if="hasPerm('/busConfig/tempConfig/list')" label="温湿度监测仪" name="temphumidity">
        <list-temp-config ref="tempConfig" />
      </el-tab-pane>
      <el-tab-pane v-if="hasPerm('/busConfig/digConfig/list')" label="开挖监测仪" name="dig">
        <list-dig-config ref="digConfig" />
      </el-tab-pane>
      <el-tab-pane v-if="hasPerm('/busConfig/noiseConfig/list')" label="噪声监测仪" name="noise">
        <list-noise-config ref="noiseConfig" />
      </el-tab-pane>
      <el-tab-pane v-if="hasPerm('/busConfig/liquidGasConfig/list')" label="燃气智能监测终端(一体化)" name="liquidgas">
        <list-liquid-gas-config ref="liquidGasConfig" />
      </el-tab-pane>
      <el-tab-pane v-if="hasPerm('/busConfig/tubeConfig/list')" label="管盯" name="tube">
        <list-tube-config ref="tubeConfig" />
      </el-tab-pane>
      <el-tab-pane v-if="hasPerm('/busConfig/H2sConfig/list')" label="硫化氢检测终端" name="h2s">
        <list-h2s-config ref="h2sConfig" />
      </el-tab-pane>
      <el-tab-pane v-if="hasPerm('/busConfig/wellliquidConfig/list')" label="井盖液位一体机" name="wellliquid">
        <list-wellliquid-config ref="wellliquidConfig" />
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import { hasPermission } from '@/utils/permission'
import ListLiquidConfig from './components/listLiquidConfig'
import ListGasConfig from './components/listGasConfig'
import ListHarmfulConfig from './components/listHarmfulConfig'
import ListTempConfig from './components/listTempConfig'
import ListDigConfig from './components/listDigConfig'
import ListNoiseConfig from './components/listNoiseConfig'
import ListLiquidGasConfig from './components/listLiquidGasConfig'
import ListTubeConfig from './components/listTubeConfig'
import ListH2sConfig from './components/listH2sConfig'
import ListWellcoverConfig from '@/views/deviceConfig/components/listWellCoverConfig'
import ListWellliquidConfig from '@/views/deviceConfig/components/listWellLiquidConfig'
export default {
  name: 'DeviceConfig',
  components: { ListWellliquidConfig, ListWellcoverConfig, ListH2sConfig, ListTubeConfig, ListLiquidGasConfig, ListNoiseConfig, ListDigConfig, ListTempConfig, ListHarmfulConfig, ListGasConfig, ListLiquidConfig },
  data() {
    return {
      activeName: 'liquid'
    }
  },
  created() {
    this.caclActive()
  },
  methods: {
    handleClick(tab, event) {
      if (tab.name === 'wellcover') {
        this.$refs.wellcoverConfig.fetchData()
      } else if (tab.name === 'liquid') {
        this.$refs.liquidConfig.fetchData()
      } else if (tab.name === 'harmful') {
        this.$refs.harmfulConfig.fetchData()
      } else if (tab.name === 'gas') {
        this.$refs.gasConfig.fetchData()
      } else if (tab.name === 'temp') {
        this.$refs.tempConfig.fetchData()
      } else if (tab.name === 'dig') {
        this.$refs.digConfig.fetchData()
      } else if (tab.name === 'noise') {
        this.$refs.noiseConfig.fetchData()
      } else if (tab.name === 'liquidgas') {
        this.$refs.liquidGasConfig.fetchData()
      } else if (tab.name === 'tube') {
        this.$refs.tubeConfig.fetchData()
      } else if (tab.name === 'h2s') {
        this.$refs.h2sConfig.fetchData()
      } else if (tab.name === 'wellliquid') {
        this.$refs.wellliquidConfig.fetchData()
      }
    },
    // 计算那个是当前第一个tab
    caclActive() {
      if (hasPermission('/busConfig/wellcoverConfig/list')) {
        this.activeName = 'wellcover'
      } else if (hasPermission('/busConfig/liquidConfig/list')) {
        this.activeName = 'liquid'
      } else if (hasPermission('/busConfig/gasConfig/list')) {
        this.activeName = 'gas'
      } else if (hasPermission('/busConfig/harmfulConfig/list')) {
        this.activeName = 'harmful'
      } else if (hasPermission('/busConfig/tempConfig/list')) {
        this.activeName = 'temp'
      } else if (hasPermission('/busConfig/digConfig/list')) {
        this.activeName = 'dig'
      } else if (hasPermission('/busConfig/noiseConfig/list')) {
        this.activeName = 'noise'
      } else if (hasPermission('/busConfig/liquidGasConfig/list')) {
        this.activeName = 'liquidgas'
      } else if (hasPermission('/busConfig/tubeConfig/list')) {
        this.activeName = 'tube'
      } else if (hasPermission('/busConfig/h2sConfig/list')) {
        this.activeName = 'h2s'
      } else if (hasPermission('/busConfig/wellliquidConfig/list')) {
        this.activeName = 'wellliquid'
      }
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>

</style>