<template>
  <div id="app-container-acrylic">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span style="color:#5cd9e8">
          <icon name="chart-area"></icon>
        </span>
        <div class="d-flex">
          <span class="fs-xl text mx-2">{{ $t('丙烯储罐') }}</span>
          <div class="decoration2">
            <dv-decoration-2 :reverse="true" style="width:5px;height:2.4rem;" />
          </div>
        </div>
      </div>
      <div style="text-align: center;padding-bottom: 2px;display: flex;justify-content: space-between;margin-top: 10px;">
        <div style="position: relative;">
          <img src="@/assets/image/spherical.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="0<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<20">
          <img src="@/assets/image/Spherical1.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="20<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<40">
          <img src="@/assets/image/Spherical2.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="40<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<60">
          <img src="@/assets/image/Spherical3.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="60<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<80">
          <img src="@/assets/image/spherical.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="80<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<100">
          <span class="modelTop pos1">STT1011</span>
          <div class="ModelFont">{{ dashboarddata.acrOne }}%</div>
        </div>
        <div style="position: relative;">
          <img src="@/assets/image/spherical.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="0<=(dashboarddata.acrTwo) && (dashboarddata.acrTwo)<20">
          <img src="@/assets/image/Spherical1.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="20<=(dashboarddata.acrTwo) && (dashboarddata.acrTwo)<40">
          <img src="@/assets/image/Spherical2.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="40<=(dashboarddata.acrTwo) && (dashboarddata.acrTwo)<60">
          <img src="@/assets/image/Spherical3.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="60<=(dashboarddata.acrTwo) && (dashboarddata.acrTwo)<80">
          <img src="@/assets/image/spherical.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="80<=(dashboarddata.acrTwo) && (dashboarddata.acrTwo)<100">
          <span class="modelTop pos2">STT1012</span>
          <div class="ModelFont">{{ dashboarddata.acrTwo }}%</div>
        </div>
        <div style="position: relative;">
          <img src="@/assets/image/spherical.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="0<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<20">
          <img src="@/assets/image/Spherical1.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="20<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<40">
          <img src="@/assets/image/Spherical2.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="40<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<60">
          <img src="@/assets/image/Spherical3.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="60<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<80">
          <img src="@/assets/image/spherical.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="80<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<100">
          <span class="modelTop pos3">STT1013</span>
          <div class="ModelFont">{{ dashboarddata.acrThree }}%</div>
        </div>
        <div style="position: relative;">
          <img src="@/assets/image/spherical.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="0<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<20">
          <img src="@/assets/image/Spherical1.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="20<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<40">
          <img src="@/assets/image/Spherical2.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="40<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<60">
          <img src="@/assets/image/Spherical3.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="60<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<80">
          <img src="@/assets/image/spherical.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="80<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<100">
          <span class="modelTop pos4">STT1014</span>
          <div class="ModelFont">{{ dashboarddata.acrFour }}%</div>
        </div>
        <div style="position: relative;">
          <img src="@/assets/image/spherical.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="0<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<20">
          <img src="@/assets/image/Spherical1.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="20<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<40">
          <img src="@/assets/image/Spherical2.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="40<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<60">
          <img src="@/assets/image/Spherical3.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="60<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<80">
          <img src="@/assets/image/spherical.png" style="height: 100px;width: 80px; margin-top: 0.7rem" v-if="80<=(dashboarddata.acrOne) && (dashboarddata.acrOne)<100">
          <span class="modelTop pos5">STT1040</span>
          <div class="ModelFont">{{ dashboarddata.acrZero }}%</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import { selectLast } from "@/api/aspen/dashboarddata";

export default {
  data () {
    return {
      dashboarddata: {
        acrOne: null,
        acrTwo: null,
        acrThree: null,
        acrFour: null,
        acrZero: null,
      },
      // 查询参数
      queryParams: {},
    }
  },
  created() {
    this.getList();
    // 每隔30秒请求一次数据
    window.setInterval(() => {undefined
      setTimeout(() => {undefined
        ///调取接口获取数据
        this.getList();
      }, 0)
    }, 10000)
  },
  methods: {
    /** 查询dashboard抓取数据列表 */
    getList()
    {
      selectLast(this.queryParams).then(response => {
        this.dashboarddata = response.data;
      });
    }
  }
}
</script>

<style lang="scss">
  #app-container-acrylic {
    padding: 0.2rem 0.2rem 0;
    height: 2.9rem;
    min-width: 3.75rem;
    border-radius: 0.0625rem;
    .bg-color-black {
      height: 2rem;
      border-radius: 0.125rem;
    }
    .text {
      color: #c3cbde;
    } //下滑线动态
    .decoration2 {
      position: absolute;
      right: 0.125rem;
    }
    .chart-box {
      margin-top: 0.2rem;
      width: 2.125rem;
      height: 2.125rem;
      .active-ring-name {
        padding-top: 0.125rem;
      }
    }
    .modelTop{
      position: absolute;
      &.pos1{
        left: 20px;
        top: 20px;
      }
      &.pos2{
        left: 20px;
        top: -15px;
      }
      &.pos3{
        left: 20px;
        top: 20px;
      }
      &.pos4{
        left: 20px;
        top: -15px;
      }
      &.pos5{
        left: 20px;
        top: 20px;
      }
    }
  }
</style>
