<template>
    <div class="mainContainer">
        <div class="lt">
            <Console @refreshList="changPanel"></Console>
        </div>
        <div class="center">
            <div class="cube">
                <Total :post-title="pageLevel" :region-id="regionId"></Total>
            </div>
            <div class="cube">
                <WifiSign></WifiSign>
            </div>
            <Scan></Scan>
        </div>
        <div class="rt">
            <div class="cube" v-if="pageLevel == 0||pageLevel == 4">
                <HistoryRecord></HistoryRecord>
            </div>
            <div class="cube" v-if="pageLevel == 1||pageLevel == 2||pageLevel == 3">
                <runTimeRecord></runTimeRecord>
            </div>
            <div v-if="pageLevel != 4">
                <EquipInfo></EquipInfo>
            </div>
            <!--单个设备情况-->
            <div v-if="pageLevel == 4">
                <SingleEquipInfo></SingleEquipInfo>
            </div>
        </div>
    </div>
</template>

<script>
    import Console from '@/components/Console.vue'
    import WifiSign from '@/components/WifiSign.vue'
    import Scan from '@/components/Scan.vue'
    import HistoryRecord from '@/components/HistoryRecord.vue'
    import EquipInfo from '@/components/EquipInfo.vue'
    import SingleEquipInfo from '@/components/SingleEquipInfo.vue'
    import Total from '@/components/Total.vue'
    import runTimeRecord from '@/components/runTimeRecord.vue'

    export default {
        data() {
            return {
                loadingState: false,
                pageLevel: 0,//默认查全部
                regionId: 0,//默认查全部
                // pageLevel: 1,//当前为楼层
                // pageLevel: 2,//当前为楼层区域
                // pageLevel: 3,//当前为房间
                // pageLevel: 4,//当前为单个设备
            }
        },
        mounted() {
            this.init();
        },
        methods: {
            // 初始化
            init() {
                this.loadingState = false;
            },
            changPanel(level, btn) {
                this.BtnId = btn.Id ? btn.Id : 0;
                if (btn == 0) {
                    // 首页单独处理
                    this.pageLevel = 0
                } else {
                    this.pageLevel = parseInt(level);
                }
            },
        },
        components: {
            Console, WifiSign, Scan, HistoryRecord, EquipInfo, Total, runTimeRecord, SingleEquipInfo
        }
    }
</script>

<style scoped>
    @import "../assets/css/cube.css";

    ul, li {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    em, s, i {
        font-style: normal;
    }

    .mainContainer {
        width: 100%;
        overflow: hidden;
        display: block;
        margin: 0 auto;
    }

    .lt {
        width: 365px;
        float: left;
        overflow: hidden;
        margin-right: 10px;
    }

    .center {
        width: 976px;
        /*height: 906px;*/
        float: left;
        overflow: hidden;
    }

    .rt {
        width: 452px;
        float: right;
        overflow: hidden;
        margin-right: 0px;
    }

    .cube {
        width: 100%;
        overflow: hidden;
        display: block;
        margin: 0 auto;
        margin-bottom: 5px;
    }
</style>
