<template>
  <div class="big-screen">
    <scale-box>
      <div class="main-wrapper">
        <div class="header-area">
          <div class="left">
            <div class="modelTime" >
              <div>{{timeString}}</div>
              <div>{{timeDay}}</div>
            </div>
            <div
              :class="['model',  0== curIndex ? 'cur' : '']"
              @click="chooseTab(0, 'service')"
            >
              服务保障中心
            </div>
            <div
              :class="['model',  1== curIndex ? 'cur' : '']"
              @click="chooseTab(1, 'logistics')"
            >
              后勤资源监控
            </div>
          </div>
          <div class="mid" @dblclick="fullScreen"></div>
          <div class="right">
            <div
              :class="['model', 2== curIndex ? 'cur' : '']"
              @click="chooseTab(2, 'building')"
            >
              楼宇运行监控
            </div>
            <div
              :class="['model', 3 == curIndex ? 'cur' : '']"
              @click="chooseTab(3, 'engineering')"
            >
              工程现场监控
            </div>
            <div
              :class="['model',4 == curIndex ? 'cur' : '']"
              @click="chooseTab(4, 'official')"
            >
              公务用车监控
            </div>
          </div>
        </div>
        <!-- 服务保障 -->
        <main-main v-if="showTab === 'main'"></main-main>
        <!-- 服务保障 -->
        <service-main v-if="showTab === 'service'"></service-main>
        <!-- 楼宇 -->
        <building-main v-else-if="showTab === 'building'"></building-main>
        <!-- 公务用车 -->
        <official-main v-else-if="showTab === 'official'"></official-main>
        <!-- 后勤资产 -->
        <logistics-main
          v-else-if="showTab === 'logistics'"
          @showTabs="showTabs"
        ></logistics-main>
        <!-- 工程监控 -->
        <engineering-main
          v-else-if="showTab === 'engineering'"
        ></engineering-main>
        <!-- 视频背景 -->
         <div class="map-bg">
          <video autoplay muted loop class="background-video">
            <source :src="require('@/assets/images/main/live.mp4')" type="video/mp4" />
            Your browser does not support the video tag.
          </video>
         </div>
         <div class="map-mask"></div>
      </div>
    </scale-box>
  </div>
</template>

<script>
import ScaleBox from "./scaleBox.vue";
import MainMain from "./main/main.vue";
import ServiceMain from "./service/main.vue";
import BuildingMain from "./building/main.vue";
import OfficialMain from "./official/main.vue";
import LogisticsMain from "./logistics/main.vue";
import EngineeringMain from "./engineering/main.vue";

export default {
  name: "Screen",
  components: {
    ScaleBox,
    MainMain,
    ServiceMain,
    BuildingMain,
    OfficialMain,
    LogisticsMain,
    EngineeringMain,
  },
  data() {
    return {
      curIndex: 0,
      showTab: "service",
      currentTime: new Date(),
      tabs: [
        {
          name: "服务保障中心",
          tab: "service",
        },
        {
          name: "后勤资源监控",
          tab: "logistics",
        },
        {
          name: "楼宇运行监控",
          tab: "building",
        },
        {
          name: "工程现场监控",
          tab: "engineering",
        },
        {
          name: "公务用车监控",
          tab: "official",
        },
      ],
    };
  },
  computed: {
    timeString() {
      const year = this.currentTime.getFullYear();
      const month = String(this.currentTime.getMonth() + 1).padStart(2, '0');
      const day = String(this.currentTime.getDate()).padStart(2, '0');
      return `${year}-${month}-${day}`;
    },
    timeDay(){
      const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
      const weekday = weekdays[this.currentTime.getDay()];
      const hours = String(this.currentTime.getHours()).padStart(2, '0');
      const minutes = String(this.currentTime.getMinutes()).padStart(2, '0');
      const seconds = String(this.currentTime.getSeconds()).padStart(2, '0');

      return `${weekday} ${hours}:${minutes}:${seconds}`;
    }
  },
  mounted() {
    this.updateTime();
    setInterval(this.updateTime, 1000);
  },
  created() {
    document.documentElement.requestFullscreen();

  },
  methods: {
    fullScreen(){
      document.documentElement.requestFullscreen();
    },
    updateTime() {
      this.currentTime = new Date();
    },
    //切换菜单
    chooseTab(index) {
      this.curIndex = index;
      this.showTab = this.tabs[index].tab;
    },

    //选择显示公务用车
    showTabs() {
      this.curIndex = 5;
      this.showTab = this.tabs[5].tab;
    },

  },
};
</script>

<style rel="stylesheet/scss" lang="scss">
@font-face {
  font-family: "electronicFont";
  src: url("../../assets/fonts/DS-DIGIT.ttf");
}
@font-face {
  font-family: "fashionZh";
  src: url("../../assets/fonts/PingFang.ttf");
}

@font-face {
  font-family: "PingFangSC";
  src: url("../../assets/fonts/PingFang.ttf");
}

.el-picker-panel{
  color: #00F6EC;
}
.el-date-table td.available:hover{
  color: #06131f;
}
/*面板上方按钮*/
.el-picker-panel__icon-btn{
  color: #00F6EC;
}
.el-picker-panel__icon-btn:hover{
  color: #06131f;
}
/*面板上方显示日期*/
.el-date-picker__header-label{
  color: #00F6EC;
}
.el-date-picker__header-label:hover {
  color: #06131f;
}
/*周一至周日文字及下划线*/
.el-date-table th{
  color: #00F6EC;
  border-bottom: solid 1px #00F6EC;
}
/*面板背景色*/
.el-picker-panel.el-date-picker {
  background-color: rgba(53, 141, 141, 0.59);
}
/*选中日期颜色*/
.el-date-table td.current:not(.disabled) span{
  background-color: #00F6EC;
}
.popper__arrow{
  border-bottom-color: #00F6EC !important;
}
.popper__arrow::after {
  border-bottom-color: rgba(53, 141, 141, 0.59) !important;
}

.big-screen {
  width: 100%;
  height: 100vh;
  overflow: hidden;
  position: relative;
  background-image: url("../../assets/images/main/main_bg.jpg");
  background-size: cover;

  .main-wrapper {
    width: 1920px;
    height: 1080px;

    margin: 0 auto;
    position: relative;
    .header-area {
      position: fixed;
      width: 100%;
      height: 93px;
      padding: 6px 15px 0 15px;
      display: flex;
      flex-direction: row;
      align-items: flex-start;
      justify-content: space-between;
      color: #fff;
      z-index: 10;
      .left,
      .right {
        display: flex;
        align-items: center;
        .model {
          margin-right: 15px;
          width: 130px;
          height: 45px;
          line-height: 45px;
          text-align: center;
          font-family: "PingFangSc";
          font-size: 18px;
          font-weight: bold;
          background: url("../../assets/images/main/menu_bg.png") no-repeat;
          background-size: 100% 100%;
          color: #ffffff;
          cursor: pointer;
        }
        .modelTime {
          margin-right: 15px;
          width: 130px;
          height: 45px;
          text-align: center;
          font-family: "PingFangSc";
          font-size: 12px;
          padding-top: 5px;
          font-weight: bold;
          background: url("../../assets/images/main/menu_bg.png") no-repeat;
          background-size: 100% 100%;
          color: #ffffff;
          cursor: pointer;
        }
        .model:last-child {
          margin-right: 0;
        }
        .cur {
          background: url("../../assets/images/main/menu_chooe.png") no-repeat;
        }
      }
      .mid{
        display: flex;
        width: 700px;
        height: 80px;
      }

      .middle {
        flex: 1;
        padding: 0 50px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        font-size: 22px;
        font-weight: 500;
        font-family: HarmonyOS Sans SC;
      }
    }
  }

  .el-popper {
    border: 1px solid #00ffff;
    .el-cascader-node:hover,
    .el-cascader-node:visited {
      background: #15696b !important;
    }
    .el-cascader-menu {
      background: #15696b !important;
      color: #fff !important;
      border-right: solid 1px #00ffff !important;
    }
    .el-cascader-node.in-active-path,
    .el-cascader-node.is-selectable.in-checked-path,
    .el-cascader-node.is-active {
      color: #00ffff;
      background: #15696b !important;
    }
    .el-cascader-node__label {
      font-size: 12px;
    }
    .el-cascader-node {
      padding: 0 20px 0 0 !important;
    }
    .el-cascader-node__prefix {
      display: none !important;
    }
    .el-popper .el-cascader-node {
      height: 28px !important;
      line-height: 28px !important;
    }
    .el-cascader-node {
      height: 28px !important;
      line-height: 28px !important;
    }
    .el-cascader-menu__wrap {
      height: 250px !important;
    }
  }

  ::-webkit-scrollbar {
    width: 3px;
    height: 3px;
  }

  ::-webkit-scrollbar-thumb {
    //滑块部分
    // border-radius: 5px;
    background-color: #58cbbb;
  }

  ::-webkit-scrollbar-track {
    //轨道部分
    // box-shadow: inset 0 0 5px #ddd;
    background: #ddd;
    // border-radius: 5px;
  }

  .building-dialog-area, .dialog-area, .unit-dialog-area, .assets-cate-dialog, .assets-change-dialog, .assets-stock-dialog, .code-bill-dialog, .dialog-project-schedule, .main-house-item-dialog, .main-official-car-dialog, .main-project-item-dialog, .car-warning-dialog-area, .terminal-dialog-area, .dialog-basic-area, .dialog-canteen-area, .employee-health-dialog-area, .employee-profile-dialog-area, .dialog-property-area, .share-station-dialog-area {
    background-color: rgba(2, 26, 26, 0.8) !important;
  }

  .data-main{
    position: relative;
    z-index:3;
  }

  .main-data{
    position: relative;
    z-index:3;

  }

  .map-bg{
    position: absolute;
    top: 93px;
    width: 100%;
    height: calc(100% - 93px);
    // background-image: url("../../assets/images/main/map_bg2.gif");
    // background-size: 100% 100%;
    z-index: 1;
    .background-video {
      position: absolute;
      top: 50%;
      left: 50%;
      width: 100%;
      height: 100%;
      object-fit: cover; /* 确保视频覆盖整个背景 */
      transform: translate(-50%, -50%);
      z-index: 1; /* 视频置于底层 */
    }
  }
  .map-mask{
      position: absolute;
      top: 93px;
      width: 100%;
      height: calc(100% - 93px);
      background-image: url("../../assets/images/main/map_mask2.png");
      background-size: cover;
      z-index: 2;
    }

  //共用样式
  .title-area {
    height: 52px;
    line-height: 52px;
    font-family: "PingFangSC" !important;
    font-size: 20px;
    font-weight: 900;
    padding-left: 30px;
    color: #62ffe5;
    text-shadow: 0px 2px 24px #00b7ff;
  }
  .dialog-title {
    font-family: "PingFangSC" !important;
    font-size: 20px;
    font-weight: 900;
  }
  /**公共flex方法**/
  .flex-row {
    display: flex !important;
    flex-direction: row !important;
  }

  .flex-column {
    display: flex !important;
    flex-direction: column !important;
  }

  .flex-start {
    justify-content: flex-start !important;
  }

  .flex-end {
    justify-content: flex-end !important;
  }

  .flex-center {
    justify-content: center !important;
  }

  .flex-wrap {
    flex-wrap: wrap !important;
  }

  .flex-nowrap {
    flex-wrap: nowrap !important;
  }

  .space-between {
    justify-content: space-between !important;
  }

  .space-around {
    justify-content: space-around !important;
  }

  .align-items-center {
    align-items: center !important;
  }

  .align-self-center {
    align-self: center !important;
  }

  .align-items-end {
    align-items: flex-end !important;
  }

  .align-items-start {
    align-items: flex-start !important;
  }
  .align-items-base {
    align-items: baseline !important;
  }
}

.content-area {
  padding-top: 20px !important;
}
.dialog-cont {
  padding-top: 20px !important;
}
.content-left,
.content-right {
  width: calc(50% - 20px);
}
</style>
