<template>
    <div id='equipment'>
        <div class='eq-top'>
            <span
                class='eq-system'
                v-for='(item,index) in system'
                :class='item.id==systemId?"isActive":""'
                :key='index'
                @click='tabSyatem(item)'
            >{{item.name}}</span>
        </div>
        <div class='eq-bottom'>
            <div class='eq-left'>
                <ul>
                    <li class='li-style' v-for='(eve,index) in everySystem' :key='"o"+index' @click='dialogVisible(eve)'>
                        <span class='circle'></span>
                        {{eve.label}}
                    </li>
                </ul>
            </div>
            <div class='eq-right'>
                <div class='eq-right-bottom'>
                    <div class='eq-title'>
                        <span>{{floorInfo.floorName}}</span>
                    </div>
                    <div class='eq-content'>
                        <floorMap ref='floorMap'></floorMap>
                        <bottomLayer></bottomLayer>
                    </div>
                    <floor-list :floors='floors' @emitFloor='emitFloor'></floor-list>
                </div>
            </div>
            <editList></editList>
        </div>
        <eq-dialog ref='dialog' :systemName='systemName'></eq-dialog>
    </div>
</template>

<script>
import floorList from '@/components/floorList.vue'
import floorMap from '@/components/floorMap/index.vue'
import eqDialog from './eqDialog'
import bottomLayer from './bottomLayer'
import editList from '@/components/edit.vue'
import { system, floors } from '@/utils/plugins/components.js'
export default {
    data() {
        return {
            system,
            floors,
            everySystem: [],
            systemId: 1,
            systemName: '供电系统',
            floorInfo: {
                floorName: 'F1',
                floorId: 'f1'
            },
            dialogInfo: {}
        }
    },
    components: { floorList, eqDialog, floorMap, bottomLayer, editList },
    methods: {
        tabSyatem(item) {
            this.systemId = item.id
            ;(this.everySystem = item.children), (this.systemName = item.name)
        },
        emitFloor(item) {
            this.floorInfo = item
            this.$refs.floorMap.init()
        },
        dialogVisible(eve) {
            this.$refs.dialog.showModal(eve)
            // this.dialogInfo = eve
        }
    },
    mounted() {
        this.everySystem = this.system[0].children
        this.$refs.floorMap.init()
        // this.$refs.dialog.init()
    }
}
</script>
<style lang="less" scoped>
#equipment {
    background: rgba(242, 245, 247, 1);
    display: flex;
    flex: 1;
    .eq-top {
        margin-left: 195px;
        padding-top: 24px;
        position: fixed;
        z-index: 2;
        .eq-system {
            padding: 12px 23px;
            color: #1f2429;
            background: #fff;
            font-size: 16px;
            cursor: pointer;
        }
        .isActive {
            color: #025baa;
        }
    }
    .eq-bottom {
        display: flex;
        flex: 1;
        .eq-left {
            position: fixed;
            z-index: 2;
            width: 196px;
            padding-top: 100px;
            color: #646c73;
            font-size: 14px;
            height: 100%;
            background: rgba(242, 245, 247, 1);
        }
        .li-style {
            padding: 0 0 18px 35px;
            cursor: pointer;
            .circle {
                width: 6px;
                height: 6px;
                background: linear-gradient(180deg, rgba(54, 156, 247, 1) 0%, rgba(2, 91, 170, 1) 100%);
                border-radius: 50%;
                display: inline-block;
                margin-right: 10px;
            }
        }
        .eq-right {
            flex: 1;
            .eq-right-bottom {
                display: flex;
                flex: 1;
                .eq-title {
                    position: fixed;
                    z-index: 2;
                    top: 146px;
                    left: 196px;
                    width: 141px;
                    height: 32px;
                    background: linear-gradient(270deg, rgba(199, 217, 234, 0) 0%, rgba(199, 217, 234, 1) 100%);
                    box-shadow: -6px 2px 8px 0px rgba(31, 36, 41, 0.1);
                    color: #025baa;
                    font-size: 16px;
                    &::before {
                        width: 2px;
                        height: 16px;
                        background: rgba(2, 91, 170, 1);
                        display: inline-block;
                        content: '';
                        margin-right: 10px;
                        margin-top: 8px;
                    }
                }
                .eq-content {
                    flex: 1;
                }
            }
        }
    }
}
</style> 