CzItem.vue 3.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
<!--
 * @Author: your name
 * @Date: 2022-03-26 10:27:00
 * @LastEditTime: 2022-03-28 18:03:04
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /gassafety-progress/gassafetyprogress-web/src/views/operationMonitor/monitorData/component/charsData/CzItem.vue
-->

<template>
  <div class="czitem flex" :class="{nopadding:changeStyle}">
    <div class="left">
      <div class="img">
        <div class="state" :class="{active1:list.state=='1',active2:list.state=='2',active3:list.state=='3'}">
          {{ stateType[list.state]  }}
        </div>
        <img v-if="list.src" src="" alt="" />
        暂无图片
      </div>
      <div v-if="!changeStyle" v-unValue class="device-name zzz">{{ list.deviceName }}</div>
    </div>

    <div class="right">
      <div>
        温度:<span :class="{ active: list.a > 50 }">{{ list.a }}°C</span>
      </div>
      <div>
        水温:<span :class="{ active: list.b > 50 }">{{ list.b }}°C</span>
      </div>
      <div>
        压力:<span :class="{ active: list.c > 50 }">{{ list.c }}MPa</span>
      </div>
      <div>
        湿度:<span :class="{ active: list.d > 50 }">{{ list.d }}%</span>
      </div>
      <!--<div>
        水温:<span :class="{ active: list.e > 50 }">{{ list.e }}°C</span>
      </div>-->
    </div>
  </div>
</template>

<script>
export default {
  // 场站子组件
  props: {
    list: {
      type: Object,
    },
    // 从外部传一个值,来改变一些样式
    changeStyle:{
      type:Boolean,
      default:false,
    },
    stateType:{
      type:Object,
      default:()=>({"1":"正常",2:"报警"})
    }

  },
};
</script>

<style lang="scss" scoped>
.czitem {
  // min-width: 324px;
  width: 100%;
  min-height: 191px;
  padding: 14px 12px 18px 25px;
  box-sizing: border-box;
  // display: flex;
  .left {
    // margin-right: 48px;
    .img {
      width: 162px;
      height: 120px;
      border-radius: 4px;
      line-height: 120px;
      text-align: center;
      position: relative;
      box-sizing: border-box;
      border: 1px solid #e6ebf5;
      margin-bottom: 11px;
      .state {
        position: absolute;
        top: 0;
        left: 0;
        width: 162px;
        height: 28px;
        background-color: rgba(0, 0, 0, 0.6);
        border-radius: 4px 4px 0px 0px;
        text-align: center;
        line-height: 28px;
        color: #06d7b1;
        font-size: 14px;
        &.active1 {
          color: #06d7b1;
        }
        &.active2 {
          color: #FF6C68;
        }
        &.active3 {
          color: #bbbbbb;
        }
      }
      img {
        width: 100%;
        height: 100%;
      }
    }
    .device-name {
      font-size: 14px;
      color: #666666;
      font-weight: 500;
    }
  }
  .right {
    font-size: 14px;
    min-width: 80px;
    & > div {
      margin-bottom: 10px;
      span.active {
        color: red;
      }
    }
  }
}
.flex {
  display: flex;
  justify-content: space-between;
}
.nopadding{
  padding-bottom:0 !important;
  min-height:170px;
}
</style>