<template>
  <div class="warnmessageBox">
    <h3>
      <span class="arrows1">&gt;</span><span class="arrows2">&gt;</span>
      <span class="arrows3">&gt;</span> {{ pageCardTitle }}
      <span class="arrows3">&lt;</span><span class="arrows2">&lt;</span>
      <span class="arrows1">&lt;</span>
    </h3>
    <div class="cardContent">
      <el-table
        ref="restauranttable"
        :data="tableData"
        class="tableHi"
        height="154px"
      >
        <el-table-column align="center" prop="warnTime" label="报警时间">
        </el-table-column>
        <el-table-column align="center" prop="sensorId" label="设备名称">
        </el-table-column>
        <el-table-column
          align="center"
          prop="warnDesc"
          label="告警信息"
          min-width="200"
        >
          <template slot-scope="scope">
            <el-tooltip
              class="item"
              effect="dark"
              :content="scope.row.warnDesc"
              placement="top"
            >
              <span> {{ scope.row.warnDesc }}</span>
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column align="center" prop="warnLevel" label="告警等级">
          <template slot-scope="scope">
            <span v-if="scope.row.warnLevel == 2">高 </span>
            <span v-else-if="scope.row.warnLevel == 1"> 中 </span>
            <span v-else-if="scope.row.warnLevel == 0"> 低 </span>
          </template>
        </el-table-column>
        <el-table-column align="center" prop="warnValue" label="当前值">
        </el-table-column>
        <el-table-column align="center" prop="threshold" label="告警阈值">
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
import { warningListApi } from "@/utils/api/index";
export default {
  name: "warnmessage",
  components: {},
  data() {
    return {
      pageCardTitle: "告警/故障信息",
      tableData: [],
    };
  },
  created() {
    this.getwarnList();
  },
  mounted() {},
  methods: {
    getwarnList() {
      warningListApi()
        .then((res) => {
          console.log(res);
          this.tableData = res.data.content;
        })
        .catch((err) => {
          console.log(err); //代码错误、请求失败捕获
        });
    },
  },
};
</script>

<style lang="less">
.warnmessageBox {
  padding: 0px 10px;
  h3 {
    height: 38px;
    line-height: 38px;
    box-sizing: border-box;
    color: #fff;
    font-weight: normal;
    text-align: left;
    //display: flex;
    font-size: 16px;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed #fff;
    /* 警告标题箭头 */
    .arrows3 {
      color: #fff;
    }
    .arrows2 {
      color: rgba(256, 256, 256, 0.5);
    }
    .arrows1 {
      color: rgba(256, 256, 256, 0.15);
    }
  }
  .cardContent {
    margin-top: 10px;

    .el-table th.el-table__cell {
      background-color: transparent;
    }
    .el-table thead {
      color: #fff;
    }
    .el-table {
      background-color: transparent;
      color: #fff;
      tr {
        background: transparent;
      }
    }
    .el-table--small .el-table__cell {
      padding: 2px 0;
    }
    .el-table__empty-text {
      color: #fff;
    }
    .el-table--enable-row-hover .el-table__body tr:hover > td.el-table__cell {
      background-color: rgba(255, 27, 27, 0.2);
    }
    .el-table::before {
      height: 0;
    }
  }
}
</style>
