<template>
  <div class="eContainer-home">
    <QuickVisitVue :cellScrollHeight="cellScrollHeight"></QuickVisitVue>
    <TaskStatisticsVue></TaskStatisticsVue>
    <NoticeAnnouncementVue :cellScrollHeight="cellScrollHeight"></NoticeAnnouncementVue>
    <HallVue></HallVue>
    <CustomerAnalyseVue></CustomerAnalyseVue>
    <QuickSearchVue :cellScrollHeight="cellScrollHeight"></QuickSearchVue>
  </div>
</template>

<script>
import QuickVisitVue from "./cells/QuickVisit.vue";
import TaskStatisticsVue from "./cells/TaskStatistics.vue";
import NoticeAnnouncementVue from "./cells/NoticeAnnouncement.vue";
import HallVue from "./cells/Hall.vue";
import CustomerAnalyseVue from "./cells/CustomerAnalyse.vue";
import QuickSearchVue from "./cells/QuickSearch.vue";

export default {
  name: "Home",
  components: {
    QuickVisitVue,
    TaskStatisticsVue,
    NoticeAnnouncementVue,
    HallVue,
    CustomerAnalyseVue,
    QuickSearchVue,
  },
  created() {
    this.calcCellScrollHeight();
    this.calcCellScrollHeightBind = this.calcCellScrollHeight.bind(this)
    window.addEventListener("resize", this.calcCellScrollHeightBind)
  },
  data() {
    return {
      cellScrollHeight: null,
    };
  },
  methods: {
    calcCellScrollHeight() {
      this.cellScrollHeight = window.document.body.clientHeight - (window.document.body.clientHeight - 110 - 52 * 2 - 10) / 2;
    }
  },
  destroyed() {
    window.removeEventListener("resize", this.calcCellScrollHeightBind)
  }
};
</script>

<style scoped>
.eContainer-home {
  height: 100%;
  display: flex;
  flex-wrap: wrap;
  /* justify-content: space-around; */
  align-items: center;
}
.home-cell {
  width: 33%;
  height: 49%;
  margin-left: 0.166%;
  margin-right: 0.166%;
  background-color: #ffffff;
  box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
  border-radius: 8px;
}
.home-cell >>> .cell-content {
  /* max-height: calc(100% - 52px); */
  height: calc(100% - 52px);
  overflow: auto;
}
.home-cell >>> .el-scrollbar__wrap{
  overflow-y: scroll;
	overflow-x: auto;
}
</style>
