<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <div class="company-home">
    <div style="width: 100%; height: 100%; position: absolute; left: 0; top: 0; z-index: 0">
      <VentModal />
    </div>
    <div class="top-bg">
      <!-- <img style="width: 300px; height: 40px; position: fixed; left: 5px; top: 5px" src="./meeee.png" /> -->
      <div class="main-title">{{ mainTitle }}</div>
    </div>
    <div class="left-t"> </div>
    <div class="right-t"> </div>
    <template v-if="isNew">
      <ModuleNew
        v-for="cfg in configs"
        :key="cfg.deviceType"
        :show-style="cfg.showStyle"
        :module-data="cfg.moduleData"
        :module-name="cfg.moduleName"
        :device-type="cfg.deviceType"
        :data="data"
        :visible="true"
      />
    </template>
  </div>
</template>
<script lang="ts" setup>
import { onMounted, onUnmounted } from 'vue';
// import { CaretDownOutlined } from '@ant-design/icons-vue';
// import MonitorCenter from './components/MonitorCenter.vue';
import { useInitConfigs, useInitPage } from './hooks/useInit';
import ModuleNew from './components/ModuleNew.vue';
// import { useRoute } from 'vue-router';
import VentModal from '/@/components/vent/micro/ventModal.vue';
import { getHomeData } from './configurable.api';
import { useRoute } from 'vue-router';
import { testConfigVentNew } from './configurable.data';
const { configs, isNew, fetchConfigs } = useInitConfigs();
const { mainTitle, data, updateData, updateEnhancedConfigs } = useInitPage('一通三防智能管控平台');
const route = useRoute();
let interval: number | undefined;

onMounted(() => {
  fetchConfigs('vent').then(() => {
    configs.value = testConfigVentNew;
    console.log('configs', configs.value);
    updateEnhancedConfigs(configs.value);

    getHomeData({}).then(updateData);
  });
  setInterval(() => {
    getHomeData({}).then(updateData);
  }, 60000);
});

onUnmounted(() => {
  clearInterval(interval);
});
</script>
<style lang="less" scoped>
@import '/@/design/theme.less';

@font-face {
  font-family: 'douyuFont';
  src: url('../../../../assets/font/douyuFont.otf');
}

@{theme-deepblue} {
  .company-home {
    --image-modal-top: url('@/assets/images/themify/deepblue/vent/home/modaltop.png');
  }
}

.company-home {
  --image-modal-top: url('@/assets/images/vent/homeNew/modaltop.png');
  width: 100%;
  height: 100%;
  color: @white;
  position: relative;
  background: url('@/assets/images//vent/homeNew/bg.png') no-repeat center;

  .top-bg {
    width: 100%;
    height: 56px;
    background: var(--image-modal-top) no-repeat center;
    position: absolute;
    z-index: 1;
    .main-title {
      height: 56px;
      font-family: 'douyuFont';
      font-size: 20px;
      letter-spacing: 2px;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
  .left-t {
    position: absolute;
    width: 28%;
    height: 100%;
    background: url('@/assets/images/vent/homeNew/leftContent.png') no-repeat center;
    z-index: 0;
  }
  .right-t {
    position: absolute;
    width: 172%;
    height: 100%;
    background: url('@/assets/images/vent/homeNew/rightContent.png') no-repeat center;
    z-index: 0;
  }
  // .module-left {
  //   position: absolute;
  //   width: 450px;
  //   height: 280px;
  //   left: 0;
  // }
  // .module-right {
  //   position: absolute;
  //   width: 450px;
  //   height: 280px;
  //   right: 0;
  // }
  // .module-bottom {
  //   position: absolute;
  //   width: 1000px;
  //   height: 280px;
  // }
  .module-dropdown {
    padding: 10px;
    background-image: @vent-configurable-dropdown;
    border-bottom: 2px solid @vent-configurable-home-light-border;
    color: @vent-font-color;
    position: absolute;
    top: 70px;
    right: 460px;
  }
  .module-dropdown-original {
    padding: 10px;
    background-image: @vent-configurable-dropdown;
    border-bottom: 2px solid @vent-configurable-home-light-border;
    color: @vent-font-color;
    position: absolute;
    top: 70px;
    right: 460px;
  }
  .module-trigger-button {
    color: @vent-font-color;
    background-image: @vent-configurable-dropdown;
    border: none;
    border-bottom: 2px solid @vent-configurable-home-light-border;
  }
}
:deep(.loading-box) {
  position: unset;
}
</style>
