<template>
    <div class="pa10">
        <el-tabs type="border-card" v-model="activeName" @tab-click="handleClick" :style="'height:' + vh">
            <el-tab-pane label="在线监测点" name="first">
                <onlineData v-if="activeName == 'first'"></onlineData>
            </el-tab-pane>
            <el-tab-pane label="监测点台账信息" name="second">
                <devicemessage v-if="activeName == 'second'"></devicemessage>
            </el-tab-pane>
            <el-tab-pane label="终端台账信息" name="third">
                <terminalmessage v-if="activeName == 'third'"></terminalmessage>
            </el-tab-pane>
            <el-tab-pane label="终端状态统计" name="fourth">
                <terminalonlinerate v-if="activeName == 'fourth'"></terminalonlinerate>
            </el-tab-pane>
            <el-tab-pane label="终端数量统计" name="sex">
                <terminalconst v-if="activeName == 'sex'"></terminalconst>
            </el-tab-pane>
            <el-tab-pane label="数据完整性统计" name="sen">
                <integralitytable v-if="activeName == 'sen'"></integralitytable>
            </el-tab-pane>
        </el-tabs>
    </div>
</template>
<script>
import Muentree from '@/views/components/menuTree/index1'
import onlineData from '@/views/harmonic-boot/monitor/onlineData'
import terminalmessage from '@/views/harmonic-boot/runmange/terminalmessage'
import devicemessage from '@/views/harmonic-boot/runmange/devicemessage'
import terminalonlinerate from '@/views/harmonic-boot/area/terminalonlinerate'
import terminalconst from '@/views/harmonic-boot/runmange/terminalconst'
import integralitytable from '@/views/harmonic-boot/area/integralitytable'
import api1 from '@/api/pollution/pollution'
export default {
    components: {
        onlineData,
        devicemessage,
        terminalmessage,
        terminalonlinerate,
        terminalconst,
        integralitytable,
        Muentree
    },
    data() {
        return {
            activeName: 'first',
            vh: null
        }
    },
    created() {
     if (process.env.VUE_APP_KEY != 'scqr') {
                this.guanzhou()
            }
    },
    mounted() {
        this.setHeight()
        window.addEventListener('resize', this.setHeight)
    },
    beforeDestroy() {
        window.removeEventListener('resize', this.setHeight)
    },
    methods: {
        setHeight() {
            this.vh = window.sessionStorage.getItem('appheight') - 10 + 'px'
        },
        guanzhou() {
            var data = {
                token: this.$route.query.token
            }
            api1.guanzhou(data).then(res => {
                if (res.code == 'A0000') {
                    return
                } else {
                    this.$router.push('/error/massege/403')
                }
            })
        },
        handleClick(tab, event) {
            // console.log(tab, event);
            this.activeName = tab.name
        }
    }
}
</script>
<style lang="less" scoped>
.pa10 {
    padding: 10px;
}
::v-deep .el-tabs--border-card > .el-tabs__content {
    padding: 10px;
}
</style>
