
<template>
  <div>
    <Head :headText="headText"></Head>
    <div class="nav-right">
      <img class="nav-icon" v-if="navText" src="@/assets/shape.png" alt />
      <span class="nav-text1" v-if="navText">今日已收到 {{quickData.chillerCount || 0}} 条策略，其中有 {{quickData.hillerIsNotExecutedCount || 0}} 条未执行</span>
      <span class="nav-text" v-else>今天已收到 {{quickData.chillerCount || 0}} 条策略</span>
      <span class="nav-look MicrYaHei" @click="showTodayStrategy = true">查看</span>
    </div>
    <div class="strategyContainer">
      <div class="strate-left">
        <div class="strate-left-1">今天营业时间</div>
        <div class="strate-left-2">{{quickData.openTime || '--'}} - {{quickData.endTime || '--'}}</div>
        <div class="strate-left-1">当前运行模式</div>
        <div class="strate-left-2">{{quickData.model || '--'}}</div>
        <div class="strate-left-box">
          <div class="strate-left-info-1">通风策略</div>
          <div class="strate-left-info">开启时间：{{quickData.freshAirEqOpenTime || '--'}} - {{quickData.freshAirEqCloseTime || '--'}}</div>
          <div class="strate-left-info">新风机组：开启</div>
          <div class="strate-left-info">组合式空调机组：全新风</div>
        </div>
      </div>
      <div class="starte-right">
        <p class="strate-right-title">当前状态</p>
        <water-unit :data='quickData'></water-unit>
        <animation-box :data='quickData'></animation-box>
      </div>
    </div>
    <el-dialog title="提示" :visible.sync="showTodayStrategy" width="1260px">
      <today-strategy></today-strategy>
    </el-dialog>
  </div>
</template>

<script>
import Head from "../main/index";
import animationBox from "./animationBox";
import waterUnit from "./waterUnit";
import TodayStrategy from "@/components/todayStrategy.vue";
import {queryCommand,getCommand} from '@/api/strategy/strategy.js'
export default {
  data() {
    return {
      headText: "当日运行策略",
      navText: true,
      showTodayStrategy: false,
      data:{},
      quickData:{}
    };
  },
  components: {
    Head,
    animationBox,
    waterUnit,
    TodayStrategy
  },
  methods:{
    getQuickData(){
      let params = {
        postParams:{
           criteria:{
              projectId:"Pj4419000005",
              date:"20200219", //日期 yyyyMMdd
              time:"0015", //时间 H24mi (最近的一个15分钟时间点,例如现在是23点35分，应传2330）
          },
          withColumns: [
              chillerOrg,"chillerHourList"
          ]
        }
      }
      queryCommand(params).then(res=>{
        console.log(res)
        this.quickData = res.data.content?res.data.content[0]:{}
      })
    },
    getData(){
      let params = {
        postParams:{
          criteria:{
            projectId:"Pj4419000005",
            date:"202200219"
          }
        }
      }
      getCommand(params).then(res=>{
        console.log(res)
        this.data = res.data.content?res.data.content:{}

      })
    }
  },
  mounted(){
    let vm = this
    setInterval(function(){
       vm.getData()
    },1500)
    this.getQuickData()
  }
};
</script>
<style lang="scss" scoped>
.nav-right {
  height: 48px;
  position: fixed;
  right: 24px;
  top: 48px;
  z-index: 1;
  display: flex;
  align-items: center;
  .nav-text {
    height: 22px;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba(31, 36, 41, 1);
    line-height: 20px;
  }
  .nav-text1 {
    margin: 0 4px;
    height: 20px;
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: rgba(245, 78, 69, 1);
    line-height: 20px;
  }
  .nav-icon {
    width: 16px;
    height: 14px;
  }
  .nav-look {
    height: 22px;
    font-size: 14px;
    color: rgba(0, 145, 255, 1);
    line-height: 22px;
    margin: 0 12px;
    cursor: pointer;
  }
}

.strategyContainer {
  background: #fff;
  display: flex;
  .strate-left {
    min-width: 224px;
    background: #fff;
    border-right: 1px solid #f7f9fa;
    margin-left: 16px;
    .strate-left-1 {
      margin-top: 24px;
      color: #646c73;
      font-size: 14px;
    }
    .strate-left-2 {
      margin-top: 8px;
      font-size: 20px;
    }
    .strate-left-box {
      width: 192px;
      height: 150px;
      border-radius: 6px;
      background: #e4e5e7;
      margin-top: 67px;
      .strate-left-info-1 {
        padding-top: 20px;
        padding-left: 20px;
        font-size: 16px;
        color: #1f2429;
      }
      .strate-left-info {
        padding-left: 20px;
        font-size: 14px;
        margin-top: 8px;
        color: #646c73;
      }
    }
  }
  .starte-right {
    margin-right: 30px;
    flex: 1;
    .starte-right-title {
      height: 74px;
      line-height: 74px;
      color: #1f2429;
      font-size: 22px;
    }
  }
}
</style>