<template>
  <div class="status-panel">
    <div class="pause" v-if="data.breakOff">中断</div>
    <ComPanel class="status-com-panel" :title="data.title">
      <div class="p-body">
        <div class="category-box">
          <div class="score">
            <span>{{data.category.score}}</span>
          </div>
          <div class="box">
            <div class="category-item" v-for="(item, index) of data.category.datas" :key="index">
              <div>{{item.text}}</div>
              <div :class="item.color">{{item.num}}</div>
            </div>
          </div>
        </div>
        <div class="item-box">
          <div class="data-item" v-for="(item, index) of data.items" :key="index" :class="{ 'light': item.is_light }">
            <div class="f1">{{item.f1}}</div>
            <div class="f2">{{item.f2}}</div>
            <div class="f3">{{item.f3}}</div>
            <div class="f4">{{item.f4}}</div>
            <div class="f5">{{item.f5}}</div>
          </div>
        </div>
      </div>
    </ComPanel>
  </div>
</template>

<script>
import ComPanel from '@com/coms/panel/panel.vue'
export default {
  // 名称
  name: "StatusPanel",
  // 使用组件
  components: {
    ComPanel
  },
  /**
   * {
          title: "某某某风电场",
          weather: {
              type: "cloudy",
              temperature: 11
          },
          breakOff: false,
          category: {
              score: 66,
              datas: [
                  { text: "运行", num: 30, color: 'green' },
                  { text: "待机", num: 27, color: 'purple' },
                  { text: "限电", num: 30, color: 'yellow' },
                  { text: "检修", num: 30, color: 'orange' },
                  { text: "故障", num: 13, color: 'red' },
                  { text: "受累", num: 30, color: 'blue' },
                  { text: "离线", num: 30, color: 'gray' },
              ]
          },
          items: [
              { f1: 'AGC宋六:', f2: '设定', f3: '66', f4: '出线', f5: '11', is_light: true },
              { f1: '升压站:', f2: '出线Uab/La', f3: '23/3 23/3', f4: '电压', f5: '103 103', is_light: false },
              { f1: '风功:', f2: '未来15分钟', f3: '103', f4: '', f5: '', is_light: false },
              { f1: '测风塔:', f2: '风速', f3: '103KM', f4: '风向', f5: '103 62', is_light: false },
              { f1: '电能量表:', f2: '', f3: '103 62', f4: '', f5: '', is_light: false },
          ]
      }
   */
  props: {
    data: Object
  },
  // 数据
  data () {
    return {

    }
  },
  // 函数
  methods: {},
  // 生命周期钩子
  beforeCreate () {
    // 创建前
  },
  created () {
    // 创建后
  },
  beforeMount () {
    // 渲染前
  },
  mounted () {
    // 渲染后
  },
  beforeUpdate () {
    // 数据更新前
  },
  updated () {
    // 数据更新后
  },
}
</script>

<style lang="less" scoped>
.status-panel {
  position: relative;
  height: 22.315vh;

  .pause {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
    left: 0;
    top: 0;
    background-color: fade(@darkgray, 50%);
    color: fade(@write, 60%);
    font-size: 5.556vh;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    backdrop-filter: blur(0.37vh);
  }

  .status-com-panel {
    width: 100%;
    height: 100%;

    .p-body {
      width: 100%;
      height: 19.074vh;
      display: flex;
      flex-direction: column;
      margin-top: -0.926vh;

      .category-box {
        width: 100%;
        background-color: fade(@darkgray, 30%);
        display: flex;
        margin-bottom: 0.37vh;

        .score {
          padding: 0.833vh 1.481vh;

          span {
            width: 3.889vh;
            height: 3.889vh;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: @green;
            border: 0.093vh solid @green;
            background-color: fade(@green, 20%);
            font-size: @fontsize;
          }
        }

        .box {
          flex-grow: 1;
          display: flex;

          .category-item {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            font-weight: 600;

            div {
              flex: 1;
              font-size: @fontsize-s;

              &:first-child {
                display: flex;
                align-items: flex-end;
                color: @gray;
              }
            }
          }
        }
      }

      .item-box {
        flex-grow: 1;
        display: flex;
        flex-direction: column;

        .data-item {
          flex: 1;
          display: flex;
          flex-direction: row;
          background-color: fade(@darkgray, 20%);
          margin-top: 0.278vh;

          div {
            font-size: @fontsize-s;
            overflow: hidden;
            display: flex;
            align-items: center;
          }

          .f1,
          .f2,
          .f4 {
            text-align: right;
            color: @gray;
            justify-content: flex-end;
          }

          .f3,
          .f5 {
            font-family: 'Bicubik';
            text-align: left;
            color: @green;
            justify-content: flex-start;
          }

          .f1 {
            flex: 2;
          }

          .f2 {
            flex: 3;
            margin-right: 0.556vh;
          }

          .f3 {
            flex: 3;
          }

          .f4 {
            flex: 1;
            margin-right: 0.556vh;
          }

          .f5 {
            flex: 2;
            margin-right: 0;
          }

          &.light {
            background-color: fade(@darkgray, 50%);
            position: relative;

            &::after {
              content: '';
              position: absolute;
              height: 100%;
              width: 0.278vh;
              background-color: @green;
              top: 0;
              left: 0;
            }

            .f1,
            .f2,
            .f4 {
              color: @write;
            }

            .f3,
            .f5 {
              color: fade(@write, 60%);
            }
          }
        }
      }
    }
  }
}
</style>
