<template>
  <div class="page">
    <div class="legend" :key="imgBtnKey">
      <div class="box title">图例</div>
      <div class="box" v-for="(item, index) in imgBtnData" :key="index">
        <img
          :class="{ active: imgBtnObj[item].green }"
          @click="imgBtn(item, 1)"
          src="@/assets/images/engineering/icon_green1.png"
        />
        <img
          :class="{ active: imgBtnObj[item].yellow }"
          @click="imgBtn(item, 2)"
          src="@/assets/images/engineering/icon_yellow1.png"
        />
        <img
          :class="{ active: imgBtnObj[item].red }"
          @click="imgBtn(item, 3)"
          src="@/assets/images/engineering/icon_red1.png"
        />
        <span>{{ item }}</span>
      </div>
    </div>
    <div class="right-box">
      <ENPanel title="绕坝渗流" class="wy">
        <div class="box">
          <img src="@/assets/images/engineering/icon_red.png" />
          <p class="red">红色预警</p>
          <span class="num">1</span>
        </div>
        <div class="box">
          <img src="@/assets/images/engineering/icon_yellow.png" />
          <p class="yellow">黄色预警</p>
          <span class="num">2</span>
        </div>
        <div class="box">
          <img src="@/assets/images/engineering/icon_green.png" />
          <p class="green">正常</p>
          <span class="num">3</span>
        </div>
      </ENPanel>
      <ENPanel title="实时数据" class="sssj">
        <div class="box">
          <div class="top">
            <span class="time">2022-01-01</span>
            <span class="status green">正常</span>
          </div>
          <div class="bottom">
            <span>绕坝渗流</span>
            <span>【D1】</span>
            <span>1mm</span>
          </div>
        </div>
      </ENPanel>
      <ENPanel title="绕坝渗流评估结论" class="jl">
        <p>
          我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我1
        </p>
        <p>
          我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我1
        </p>
        <p>
          我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我1
        </p>
        <p>
          我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我1
        </p>
        <p>
          我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我1
        </p>
        <p>
          我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我1
        </p>
        <p>
          我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我我1
        </p>
      </ENPanel>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Rbsl',
  created () {
    this.imgBtnData.forEach(item => {
      this.imgBtnObj[item] = {
        green: false,
        yellow: false,
        red: false
      }
    })
  },
  data () {
    return {
      imgBtnData: ['绕坝渗流', '垂直位移'],
      imgBtnObj: {},
      imgBtnKey: 0
    }
  },
  methods: {
    imgBtn (txt, num) {
      if (num === 1) {
        this.imgBtnObj[txt].green = !this.imgBtnObj[txt].green
      } else if (num === 2) {
        this.imgBtnObj[txt].yellow = !this.imgBtnObj[txt].yellow
      } else if (num === 3) {
        this.imgBtnObj[txt].red = !this.imgBtnObj[txt].red
      }
      this.imgBtnKey = Date.now()
    }
  }
}
</script>

<style lang="scss" scoped>
.page {
  position: relative;
  height: 100%;
  .legend {
    position: absolute;
    left: 0;
    bottom: 0;
    padding: 10px;
    padding-top: 0;
    background-color: rgba(125, 251, 244, 0.2);
    color: #fff;
    .box {
      display: flex;
      align-items: center;
      height: 50px;
      border-bottom: 1px solid rgba(125, 251, 244, 0.4);
      &.title {
        justify-content: center;
        height: 30px;
      }
      img {
        width: 26px;
        height: 26px;
        margin-right: 12px;
        cursor: pointer;
        opacity: 0.5;
        &.active {
          opacity: 1;
        }
      }
      span {
        font-size: 14px;
      }
    }
  }
  .right-box {
    display: flex;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: 0;
    width: 440px;
    height: 100%;
    background-color: #12386d;
  }
  .wy ::v-deep {
    .en-panel-content {
      display: flex;
      .box {
        @include f_c2;
        flex: 1;
        position: relative;
        height: 150px;
        margin-right: 10px;
        background-color: rgba(13, 107, 143, 0.5);
        border-radius: 3px;
        img {
          width: 70px;
          height: 70px;
          margin-bottom: 20px;
          opacity: 0.7;
        }
        p {
          font-size: 14px;
          &.green {
            color: #9cf6ba;
          }
          &.red {
            color: #ff839d;
          }
          &.yellow {
            color: #ffb667;
          }
        }
        .num {
          @include pa_xc;
          top: 50px;
          font-size: 20px;
          font-weight: 700;
        }
      }
      .box:last-child {
        margin-right: 0;
      }
    }
  }
  .sssj ::v-deep {
    height: 422px;
    overflow: hidden;
    .en-panel-content {
      overflow: auto;
      &::-webkit-scrollbar {
        width: 0;
        height: 0;
      }
      .box {
        display: flex;
        flex-direction: column;
        height: 70px;
        margin-bottom: 10px;
        background-color: rgba(125, 251, 244, 0.1);
        font-size: 14px;
        .top,
        .bottom {
          @include f_ac1;
          flex: 1;
          padding: 0 20px;
        }
        .top {
          justify-content: space-between;
          border-bottom: 1px solid rgba(125, 251, 244, 0.4);
          .status {
            &.green {
              color: #9cf6ba;
            }
            &.red {
              color: #ff839d;
            }
            &.yellow {
              color: #ffb667;
            }
          }
        }
        .bottom {
          justify-content: space-evenly;
        }
      }
    }
  }
  .jl ::v-deep {
    flex: 1;
    overflow: hidden;
    .en-panel-content {
      padding: 20px;
      overflow: auto;
      &::-webkit-scrollbar {
        width: 0;
        height: 0;
      }
      p {
        line-height: 1.5;
      }
    }
  }
}
</style>
