<template>
  <div class="deviceCardAir" :style="{backgroundColor: color}">

    <div class="deviceCardAir-top">
      <span>#{{ item.id }}</span>
      <span @click="toggle(item)" class="anticon" style="float: right;border-radius: 15px;cursor: pointer;padding: 6px 8px 7px;margin-right: 15px">
        <a-icon type="poweroff"  />
      </span>
    </div>

    <div class="deviceCardAir-bottom">
      <a-row>
        <a-col :span="8">
          <div style="height: 8px"></div>
          <div :style="{backgroundColor: item.online?'#2eb8e6':'#bebebe'}" style="font-size: 14px;text-align: center;width: 60px;padding: 3px 0;vertical-align: top;">
            <div>净水量</div>
            <div v-if="item.online && item.waterNum">{{ item.waterNum }}m²</div>
            <div v-else>-</div>
          </div>
        </a-col>
        <a-col :span="8"></a-col>
        <a-col :span="8">
          <div>
            <div v-if="item.online && item.tm">{{ item.tm + '℃' }}</div>
            <div v-else>-</div>
            <div>
              <span v-if="item.online && item.status=='1'">加水中</span>
              <span v-if="item.online && item.status=='2'">保温中</span>
            </div>
          </div>
        </a-col>
      </a-row>
      <!--<span style="margin-left: 15px">-->
      <!--  {{ item.name }}-->
      <!--</span>-->
    </div>

  </div>
</template>

<script>
export default {
  data() {
    return {
      color: '',
    }
  },
  props: {
    item: Object,
    toggle: Function
  },
  watch: {
    "item.online": function (val) {
      if (this.item.online) {
        this.color='#2ea8e5';
      } else {
        this.color='#bebebe'
      }
    },
  },
  mounted() {
    if (this.item.online) {
      this.color='#2ea8e5';
    } else {
      this.color='#bebebe'
    }
  },
  methods: {

  }
}
</script>

<style lang="less" scoped>
.deviceCardAir {
  width: 100%;
  height: 10rem;
  background-color: #2ea8e5;
  border-radius: 4px;
  color: white;
  background-image: url("@/assets/images/scene/device/shuiweijianceshebei.png");
  background-repeat: no-repeat;
  background-position: 47% 70%;
  background-size: 25%;
  .deviceCardAir-top {
    padding-top: 14px;
    padding-left: 20px;
    font-size: 20px;
    .anticon:hover {
      background-color: rgba(182, 182, 182, 0.7);
    }
  }
  .deviceCardAir-bottom {
    margin-top: 10px;
    margin-left: 18px;
    font-size: 23px;
  }
  .anticon {
    //padding: 6px;
  }

}
</style>