<template>
  <div id="data-view">
    <dv-full-screen-container>


      <top-header Name="褓座数字化智能工厂制造执行系统(MES)" style="height:5%;" />
      <dv-border-box-1 class="main-container" style="height: 50%;">


        <div class="rmc-top-container" v-if="switchType == 1">
          <dv-border-box-3 class="rmctc-left-container" style="height:100%;display: flex;">
            <Left-Chart-1 :dataType="dataType" :pieId="'leftchar1'"/>
            <Left-Chart-2 :dataType="dataType" :pieId="'leftchar2'"   />
          </dv-border-box-3>
          <div class="rmctc-right-container" v-if="false" >
            <dv-border-box-3 class="rmctc-chart-1">
              <Right-Chart-1 :dataType="dataType" />
            </dv-border-box-3>
          </div>
        </div>
        <div class="rmc-top-container" v-if="switchType == 2">
          <dv-border-box-3 class="rmctc-middle-container">
            <Center-Cmp :dataType="dataType" />
          </dv-border-box-3>
        </div>

      </dv-border-box-1>


      <dv-border-box-4 class="rmc-bottom-container" style="height: 45%;">

        <Bottom-Charts :dataType="dataType" />

      </dv-border-box-4>

    </dv-full-screen-container>
  </div>
</template>

<script>
import topHeader from './topHeader'
import LeftChart1 from './LeftChart1'
import LeftChart2 from './LeftChart2'

import CenterCmp from './CenterCmp'

import RightChart1 from './RightChart1'

import BottomCharts from './BottomCharts'

export default {
  name: 'DataView',

  components: {
    topHeader,
    LeftChart1,
    LeftChart2,
    CenterCmp,
    RightChart1,
    BottomCharts
  }, 
  created() {
     // 获取 URL 查询参数并设置 dataType
     const queryParams = new URLSearchParams(window.location.search);
    const dataTypeParam = queryParams.get('q');
    
    if (dataTypeParam === '1') {
      this.dataType = '整机';
    } else {
      this.dataType = ''; // 如果不是 '1'，则设置为空
    }

    setInterval(() => {
      this.switchType = this.switchType == 1 ? 2 : 1
    }, 1000099); // 10000 毫秒 = 10 秒
  },
  data() {
    return {
      dataType:'',
      dataType2:'整机',
      switchType: 2
    }
  }
}
</script>

<style lang="less">
#data-view {
  width: 100%;
  height: 100%;
  background-color: #030409;
  color: #fff;

  #dv-full-screen-container {
    background-image: url('./img/bg.png');
    background-size: 100% 100%;
    box-shadow: 0 0 3px blue;
    display: flex;
    flex-direction: column;
  }

  .main-header {
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;

    .mh-left {
      font-size: 20px;
      color: rgb(1, 134, 187);

      a:visited {
        color: rgb(1, 134, 187);
      }
    }

    .mh-middle {
      font-size: 30px;
    }

    .mh-left,
    .mh-right {
      width: 450px;
    }
  }

  .main-container {


    .border-box-content {
      padding: 20px;
      box-sizing: border-box;
      display: flex;
    }
  }


  .right-main-container {
    width: 75%;
    padding-left: 5px;
    box-sizing: border-box;
  }

  .rmc-top-container {
    height: 100%;
    width: 100%;
    display: flex;
  }

  .rmctc-left-container {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;

    .border-box-content {
      flex-direction: row;
    }
  }

  .rmctc-middle-container {
    width: 100%;
  }

  .rmctc-right-container {
    width: 50%;
  }

  .rmc-bottom-container {
    height: 35%;

  }

  .rmctc-chart-1 {
    height: 100%;
  }
}
</style>
