<template>
    <div class="_energy">
        <layout>
            <template #left>
                <div style="height: 100%;display: flex;flex-direction: column;overflow: hidden;">
                    <running :resultData="leftData" style="height: 35%;" />
                    <carbonEmission :resultData="leftData.Information" style="flex:1;" />
                </div>
            </template>
            <template #content>
                <!-- <p>信息</p> -->
            </template>
            <template #right>
                <div style="height: 100%;display: flex;flex-direction: column;overflow: hidden;">
                    <tiring :resultData="leftData" style="height: 35%;" />
                    <sameDay :resultData="leftData.Large" style="flex: 1;" />
                </div>
            </template>
        </layout>
    </div>
</template>

<script setup name="Role">
import { getInformation } from "@/api/system/information"
import layout from "@/components/layout_/index.vue";
import running from './modules/running.vue'
import consume from './modules/consume.vue'
import carbonEmission from "./modules/carbonEmission.vue";
import sameDay from './modules/sameDay.vue'
import tiring from './modules/tiring.vue'

const intervalId = ref(null)
const leftData = ref({})
// 生命周期
onMounted(() => {
    intervalId.value = setInterval(getInformationData, 10000);
    getInformationData()
});
onUnmounted(() => {
    clearInterval(intervalId.value);
})
function getInformationData() {
    getInformation().then((res) => {
        if (res.code == 200) {
            leftData.value = res.data
        }
    })
}
</script>
<style lang="scss">
._energy {
    height: 100%;
}
</style>