<template>
  <div class="status-panel">
    <div class="pause" v-if="true">中断</div>
    <ComPanel class="status-com-panel" :title="'海子井光伏电站'">
      <div class="p-body">
        <div class="category-box">
          <div class="score">
            <span>0</span>
          </div>
          <div class="box">
            <div class="category-item" v-for="(item, index) of 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 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,
  },
  props: {
    data: Object,
  },
  // 数据
  data() {
    return {
      datas:[
        {text:'运行',num:0,color:'green'},
        {text:'待机',num:0,color:'purple'},
        {text:'限电',num:0,color:'yellow'},
        {text:'检修',num:0,color:'orange'},
        {text:'故障',num:0,color:'red'},
        {text:'受累',num:0,color:'blue'},
        {text:'离线',num:0,color:'gray'},
      ],
      items: [
        {
          // f1: ("AGC" + ele.name.replace(/风电场/g, "") + ":"),
          f1: "AGC:",
          f2: "设定",
          f3: 0,
          f4: "出线",
          f5: 0,
          is_light: true,
        },
        {
          f1: "升压站:",
          f2: "Uab",
          f3: 0,
          f4: "Ia",
          f5: 0,
          is_light: false,
        },
        {
          f1: "风功:",
          f2: "未来15分钟",
          f3: 0,
          f4: "",
          f5: "",
          is_light: false,
        },
        {
          f1: "测风塔:",
          f2: "风速",
          f3: 0 + "m/s",
          f4: "风向",
          f5: 0,
          is_light: false,
        },
        {
          f1: "电能量表:",
          f2: "",
          f3: 0,
          f4: "",
          f5: "",
          is_light: false,
        },
      ],
    };
  },
  // 函数
  methods: {
    jumpPage(wpId) {
      this.$router.push({
        path: `/monitor/windsite/home/${wpId}`,
        // query: { wpId: id },
      });
    },
  },
  // 生命周期钩子
  beforeCreate() {
    // 创建前
  },
  created() {
    // 创建后
  },
  beforeMount() {
    // 渲染前
  },
  mounted() {
    // 渲染后
  },
  beforeUpdate() {
    // 数据更新前
  },
  updated() {
    // 数据更新后
  },
};
</script>

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

  .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>
