<!--预警数据卡片-->
<template>
  <div class="warning-data-card">
    <div class="warning-state">
      {{ warningStateValue }}
    </div>
    <div class="snap-img">
      <img :src="dataItem.snapImgUrl" v-if="dataItem.snapImgUrl">
      <img :src="noData" v-else>
    </div>
    <div class="warning-data-info">
      <div class="warning-name" :title="dataItem.warningName">{{ dataItem.warningName }}</div>
      <div class="warning-site-time">
        <div class="site-icon"></div>
        <div class="_value" :title="dataItem.site">{{ dataItem.site }}</div>
      </div>
      <div class="warning-site-time">
        <div class="warning-time-icon"></div>
        <div class="_value" :title="dataItem.warningTime">{{ dataItem.warningTime }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import noData from 'assets/peakCoalImages/common/no-data.png'

export default {
  name: "PeakWarningInfoItem",
  props: {
    dataItem: {
      type: Object,
      default: () => {
      }
    }
  },
  data() {
    return {
      noData
    }
  },
  computed: {
    warningStateValue() {
      if (this.dataItem.state === 1) {
        return '代研判'
      } else if (this.dataItem.state === 0) {
        return '待审批'
      }
    }
  }
}
</script>

<style scoped lang="less">
@import "assets/styles/mixin";

.warning-data-card {
  height: 78px;
  width: 415px;
  .bg("~/assets/peakCoalImages/right/warning-card-bg.png");
  padding-left: 10px;
  position: relative;
  .flex-row;

  .snap-img {
    width: 93px;
    height: 66px;

    img {
      height: 100%;
      width: 100%;
    }
  }

  .warning-data-info {
    height:100%;
    width: 0;
    flex: 1;
    padding-left: 20px;
    .flex-column;
    justify-content: space-around;

    .warning-name {
      width: 100%;
      font-family: MicrosoftYaHei-Bold;
      font-size: 14px;
      color: #F6B545;
      letter-spacing: 0;
      font-weight: 700;
      .text-ellipsis;
    }

    .warning-site-time {
      width: 100%;
      .flex-row;

      .site-icon {
        width: 10px;
        height: 10px;
        .bg("~/assets/peakCoalImages/right/warning-site-icon.png");
      }

      .warning-time-icon {
        width: 10px;
        height: 10px;
        .bg("~/assets/peakCoalImages/right/warning-time-icon.png");

      }

      ._value {
        width: calc(100% - 26px);
        padding-left: 10px;
        font-family: MicrosoftYaHei;
        font-size: 14px;
        color: rgba(202, 244, 255, 0.9);
        font-weight: 400;
        .text-ellipsis;
      }
    }
  }

  .warning-state {
    width: 60px;
    height: 20px;
    position: absolute;
    right: 0px;
    top: 10px;
    font-family: PingFangSC-Semibold;
    font-size: 12px;
    color: #B8D3F1;
    letter-spacing: 0;
    text-align: center;
    line-height: 20px;
    font-weight: 600;
  }

}
</style>
