<template>
  <div class="table-wrapper">
    <div class="table-box">
      <vue-seamless-scroll :data="tableData" class="warp" :class-option="classOption">
        <el-table
          :cell-style="{border:0,color:'rgba(255,255,255,1)'}"
          :data="tableData"
          :header-cell-style="{color:'#fff'}"
          :row-class-name="tableRowClassName"
          :row-style="{backgroundColor:'rgb(4,66,115,0.3)'}"
          :show-header="false"
          style="background: none;margin-top: -1%;font-size: 15px"
        >
          <el-table-column align="center" label="信息" prop="info">
            <template slot-scope="scope">
              <div v-if="scope.row.level === '2'" style="height: 25px;opacity: 0.5">
                <img :height="20"
                     :width="20"
                     alt=""
                     src="../../../assets/vpp/images/warning1.png"
                     style="top: 10px;opacity: 0.5">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ scope.row.str }}
              </div>
              <div v-if="scope.row.level === '3'" style="height: 25px;">
                <img :height="20"
                     :width="20"
                     alt=""
                     src="../../../assets/vpp/images/warning.png" style="top: 10px;">
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ scope.row.str }}
              </div>
            </template>
          </el-table-column>
        </el-table>
      </vue-seamless-scroll>

    </div>
  </div>
</template>

<script>
import vueSeamlessScroll from "vue-seamless-scroll";
import {listRealTimeMessageAlarm} from "@/api/vpp/message";

export default {
  components: { vueSeamlessScroll },
  data() {
    return {
      form: {
        taskNumber: '',
        date: '',
        current: 1,
        size: 10
      },
      tableData: [],
      tableData1: []
    }
  },
  created() {
    this.listAlarm()
  },
  computed:{
    classOption() {
      return {
        step: 0.5, // 数值越大速度滚动越快
        limitMoveNum: 5, // 开始无缝滚动的数据量
        hoverStop: true, // 是否开启鼠标悬停stop
        direction: 1, // 0向下 1向上 2向左 3向右
        openWatch: true, // 开启数据实时监控刷新dom
        singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
        singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
        waitTime: 500, // 单步运动停止的时间(默认值1000ms)
      };
    },
  },
  methods: {
    listAlarm() {
      listRealTimeMessageAlarm().then(res => {
        this.tableData = res.rows.slice(0, 5)
      });
    },
    handleRowClick(row, event, column) {
      // 在这里处理行点击事件
      console.log('行点击事件：', row, event, column);
    },
    tableRowClassName({row}) {
      if (row.level == "2") {
        return "tablerow1";
      } else {
        return "tablerow2"
      }
    },
  },
  mounted() {
    this.listAlarm()
  }
}
</script>

<style lang="less" scoped>

@font-face {
  font-family: AliMaMa;//自定义字体名称
  src: url("../Articles/font/AlimamaDaoLiTi.ttf")
}

/deep/ .el-table .tablerow1 {
  background: url('./img/矩形866.4.png') no-repeat;
}

/deep/ .el-table .tablerow2 {
  background: url('./img/矩形866.png') no-repeat;
}

.table-wrapper {
  //width: 1483px;
  //padding-left: 20px;

  .table-box {
    //min-height: 600px;
    margin-left: 6%;
    margin-top: 9%;
    width: 92%;
    background-size: cover;
  }

  /deep/ .el-form-item__label {
    color: #fff;
    //font-size: 17px;
  }

  /deep/ .el-input__inner {
    background-color: rgba(14, 73, 131);
    border: 1px solid rgb(64, 153, 255);
    //height: 34px;
    //font-size: 17px;
  }

  /deep/ .el-table tbody tr {
    pointer-events: none;
  }

  /deep/ .el-table__header {
    background: url(../Articles/img/bg1.png);
  }

  /deep/ .el-table--enable-row-hover .el-table__body tr:hover > td {
    background-color: rgb(103, 118, 49) !important
  }

  /deep/ .el-col {
    padding: 0;
    display: inline-block;
    position: relative;
  }

  /deep/ .el-col:nth-child(1) {
    width: 19%;
  }

  /deep/ .el-col:nth-child(2) {
    width: 22%;
  }

  /deep/ .el-col:nth-child(3) {
    width: 19%;
  }

  /deep/ .el-col:nth-child(4) {
    width: 19%;
  }

  /deep/ .el-col:nth-child(5) {
    width: 15%;
  }

  /deep/ .el-input__inner:nth-child(1) {
    //width: 176px;
  }

  /deep/ .el-input__inner:nth-child(2) {
    //width: 176px;
  }

  /deep/ .el-input__inner:nth-child(2) {
    //width: 126px;
  }

  /deep/ .el-input__inner:nth-child(2) {
    //width: 175px;
  }

  /deep/ .el-icon-arrow-up {
    transform: rotateZ(0deg);

  }

  /deep/ .el-icon-arrow-up:before {
    content: url(../Articles/img/xiala2.png);
  }

  /deep/ .el-input__prefix {
    right: -60px;
    padding-top: 3px;
  }

  /deep/ .el-icon-date:before {
    content: url(../Articles/img/riqi.png);
  }

  /deep/ .el-table__header tr {
    background: url(../Articles/img/bg1.png);
    //height: 49px;
  }


  /deep/ .el-table__body {
    //-webkit-border-vertical-spacing: 5px; // 垂直间距
  }

  /deep/ .el-form-item__content {
    text-align: left;
  }

  /deep/ .el-table, .el-table__expanded-cell {
    background-color: rgb(1, 40, 81);
  }

  /deep/ .el-table th.el-table__cell {
    border: 0;

  }

  .el-table::before {
    height: 0;
  }

  .el-table__row > td {
    border: none;
  }

  .warp {
    margin: 0 auto;
    overflow: hidden;
    height: 240px;
    ul {
      list-style: none;
      padding: 0;
      margin: 0 auto;
      li,
      a {
        display: block;
        height: 30px;
        display: flex;
        justify-content: space-between;
        font-size: 15px;
      }
    }
  }
}
</style>
