<script lang="ts" setup>
import {getCurrentInstance, ref} from 'vue'

defineProps({
  data: {type: Object, default: () => ({})}
})

const {props} = getCurrentInstance()
const imgSrc = ref(new URL('@/assets/images/szpj.png', import.meta.url).href)
const szpjTitleSrc = ref(new URL('@/assets/images/szpj_title.png', import.meta.url).href)
const tempImg = ref(new URL('@/assets/images/temperature.png', import.meta.url).href)
</script>

<template>
  <div>
    <el-row>
      <el-col :span="12">
        <div style="position: relative;display: flex;justify-content: center;">
          <!-- Ⅰ Ⅱ  Ⅲ  Ⅳ Ⅴ Ⅵ   -->
          <div style="position: absolute;bottom:35%;font-size:36px;">Ⅲ</div>
          <img :src="szpjTitleSrc" style="position: absolute;bottom:10%;"/>
          <img :src="imgSrc" style="height: 140px;"/>
        </div>
      </el-col>
      <el-col :span="12">
        <div class="background-image">
          <span style="font-size:14px;color:#81d4d9;">PH值</span>
          <span style="font-size:18px;font-weight: bold;font-style: italic;">{{ props.data.d1 }}</span>
        </div>
        <div class="background-image">
          <span style="font-size:14px;color:#81d4d9;">溶解氧</span>
          <span style="font-size:18px;font-weight: bold;font-style: italic;">{{ props.data.d2 }}</span>
        </div>
        <div class="background-image">
          <span style="font-size:14px;color:#81d4d9;">氨氮</span>
          <span style="font-size:18px;font-weight: bold;font-style: italic;">{{ props.data.d3 }}</span>
        </div>
        <div class="background-image">
          <span style="font-size:14px;color:#81d4d9;">浊度</span>
          <span style="font-size:18px;font-weight: bold;font-style: italic;">{{ props.data.d4 }}</span>
        </div>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="12">
        <el-row style="display: flex;justify-content:space-between;width: 100%;">
          <div style="display: flex;">
            <div class="tubiao-image tempImg"></div>
            <span style="font-size: 14px;padding-left:15px;color:#81d4d9;">水温</span>
          </div>
          <span style="padding-right: 10px;font-size: 20px;font-weight: bold;">{{ data.d5 }}</span>
        </el-row>
        <el-row>
          <div
            style="height: 5px;width: 200px;background:linear-gradient(to right, #00cbe6, #beebf1);margin-left: 10px;margin-top:6px;border-radius: 5px;"></div>
        </el-row>
      </el-col>
      <el-col :span="12">
        <el-row style="display: flex;justify-content:space-between;width: 100%;">
          <div style="display: flex;">
            <div class="tubiao-image tempImg"></div>
            <span style="font-size: 14px;padding-left:15px;color:#81d4d9;">电导率</span>
          </div>
          <span style="padding-right: 10px;font-size: 20px;font-weight: bold;">{{ data.d6 }}</span>
        </el-row>
        <el-row>
          <div
            style="height: 5px;width: 200px;background:linear-gradient(to right, #00cbe6, #beebf1);margin-left: 10px;margin-top:6px;border-radius: 5px;"></div>
        </el-row>
      </el-col>
    </el-row>
    <el-row style="margin-top: 30px;">
      <el-col :span="12">
        <el-row style="display: flex;justify-content:space-between;width: 100%;">
          <div style="display: flex;">
            <div class="tubiao-image tempImg"></div>
            <span style="font-size: 14px;padding-left:15px;color:#81d4d9;">总氮</span>
          </div>
          <span style="padding-right: 10px;font-size: 20px;font-weight: bold;">{{ data.d7 }}</span>
        </el-row>
        <el-row>
          <div
            style="height: 5px;width: 200px;background:linear-gradient(to right, #00cbe6, #beebf1);margin-left: 10px;margin-top:6px;border-radius: 5px;"></div>
        </el-row>
      </el-col>
      <el-col :span="12">
        <el-row style="display: flex;justify-content:space-between;width: 100%;">
          <div style="display: flex;">
            <div class="tubiao-image tempImg"></div>
            <span style="font-size: 14px;padding-left:15px;color:#81d4d9;">总磷</span>
          </div>
          <span style="padding-right: 10px;font-size: 20px;font-weight: bold;">{{ data.d8 }}</span>
        </el-row>
        <el-row>
          <div
            style="height: 5px;width: 200px;background:linear-gradient(to right, #00cbe6, #beebf1);margin-left: 10px;margin-top:6px;border-radius: 5px;"></div>
        </el-row>
      </el-col>
    </el-row>
  </div>
</template>
<style lang="scss" scoped>
.image-tag {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 10px 0;
  border-radius: 8px;
  color: #fff;
  background-image: linear-gradient(135deg, rgba(0, 0, 0, 0) 0%, #064786 100%);
  background-size: 100% 100%;

  .label {
    color: #f3f5f6;
    font-size: .9rem;
  }

  .value {
    font-size: 1.4rem;
    font-weight: bold;
    margin: 10px 0;
  }

  .unit {
    font-size: 0.8rem;
    color: #d9dde1;
  }
}

.background-image {
  background-image: url('@/assets/images/dataImage.png');
  height: 32px; /* 设置高度 */
  background-size: cover; /* 背景图片覆盖整个区域 */
  background-position: center; /* 位置居中 */
  padding-top: 12px;
  padding-left: 22px;
  display: flex;
  justify-content: space-between;
  padding-right: 50px;
}

.tubiao-image {
  width: 24px;
  height: 24px; /* 设置高度 */
  background-size: 14px 14px; /* 背景图片覆盖整个区域 */
  background-position: center; /* 位置居中 */
  background-repeat: no-repeat;
  margin-left: 10px;
  background-color: rgba(0, 199, 227, 0.5);
  border-radius: 12px;
}

.tempImg {
  background-image: url('@/assets/images/temperature.png');
}
</style>
