<template>
    <div class="_energy">
        <layout>
            <template #left>
                <div style="height: 100%;display: flex;flex-direction: column;overflow: hidden;">
                    <consume :resultData="leftData" style="height: 35%;" />
                    <running :resultData="leftData.temperatureDevice" style="flex: 1;" />
                </div>
            </template>
            <template #content>
                <!-- <p>空调系统</p> -->
            </template>
            <template #right>
                <div style="height: 100%;display: flex;flex-direction: column;overflow: hidden;">
                    <blowingIn :resultData="leftData" style="flex: 1;" />
                    <energy :resultData="leftData.RunAnalyse" style="flex: 1;" />
                    <temperatureTrend :resultData="leftData.EventList?.alarm" style="flex: 1;" />
                </div>
            </template>
        </layout>
    </div>
</template>

<script setup name="Air">
import { getTemperature } from "@/api/system/airconditioner"
import layout from "@/components/layout_/index.vue";
import consume from './modules/consume.vue'
import running from './modules/running.vue'
import blowingIn from './modules/blowingIn.vue'
import energy from './modules/energy.vue'
import temperatureTrend from './modules/temperatureTrend.vue'

const intervalId = ref(null)
const leftData = ref({})
const MonitorList = ref([])
// 生命周期
onMounted(() => {
    intervalId.value = setInterval(getEnergyData, 10000);
    getEnergyData()
});
onUnmounted(() => {
    clearInterval(intervalId.value);
})
function getEnergyData() {
    getTemperature().then((res) => {
        if (res.code == 200) {
            leftData.value = res.data
        }
    })
}

</script>
<style lang="scss">
._energy {
    height: 100%;
}
</style>