<template>
  <div class="left-chart-11">
    <!-- <div class="lc1-header">张三收费站</div> -->
    <div class="under-title"><b>告警记录</b></div>
    <div class="right-container" >
      <div class="right-box" v-for="(item, index) in dataList">
        <div class="top">
          <div class="top-left">{{ item.alarmMessage }}</div>
          <div class="top-right">{{ item.createtime }}</div>
        </div>
        <div class="middle">{{ item.name }} ({{ item.telno }})</div>
        <div class="under">告警地址：{{ item.location }}</div>
      </div>
    </div>
    <div class="page-box" v-show="queryParams.pageTotal ">
      <img src="./img/iconleft.png" alt="" @click="leftPage" />
      <div>{{ queryParams.pageNum }}/{{ queryParams.pageTotal }}</div>
      <img src="./img/iconright.png" alt="" @click="rightPage" />
    </div>
  </div>
</template>

<script>
import { list } from "@/api/system/datav";
export default {
  name: "LeftChart1",
  data() {
    return {
      config: {
        data: [
          {
            label: 222,
            tel: 15202013072,
            name: "王艺涵",
            time: "2023-09-12 09:50:00",
            type: "收费系统",
            adr: "ncjdhfcudjchnd",
          },
          {
            label: 222,
            tel: 15202013072,
            name: "王艺涵",
            time: "2023-09-12 09:50:00",
            type: "通信系统",
            adr: "cdkojhfcndoj",
          },
          {
            label: 222,
            tel: 15202013072,
            name: "王艺涵",
            time: "2023-09-12 09:50:00",
            type: "监控系统",
            adr: "ncsojhkla",
          },
          {
            label: 222,
            tel: 15202013072,
            name: "王艺涵",
            time: "2023-09-12 09:50:00",
            type: "供配系统",
            adr: "ncjdokchnjsak",
          },
          {
            label: 222,
            tel: 15202013072,
            name: "王艺涵",
            time: "2023-09-12 09:50:00",
            type: "其他",
            adr: "cniskjojcnosakl",
          },
          {
            label: 222,
            tel: 15202013072,
            name: "王艺涵",
            time: "2023-09-12 09:50:00",
            type: "其他",
            adr: "cniskjojcnosakl",
          },
        ],
        colors: ["#00baff", "#3de7c9", "#fff", "#ffc530", "#469f4b"],
        unit: "件",
      },
      dataList: [],
      queryParams: {
        pageNum: 1,
        pageSize: 7,
        pageTotal: null,
      },
    };
  },
  mounted() {
    this.initData();
  },
  methods: {
    initData() {
      list(this.queryParams).then((res) => {
        this.dataList = res.rows;
        let pageTotal = res.total / this.queryParams.pageSize;
        if (String(pageTotal).indexOf(".") > -1) {
          pageTotal = parseInt(pageTotal) + 1;
        } else {
          pageTotal = pageTotal;
        }
        this.queryParams.pageTotal = pageTotal;
      });
    },
    leftPage() {
      if (this.queryParams.pageNum > 1) {
        this.queryParams.pageNum--;
        this.initData();
      }
    },
    rightPage() {
      if (this.queryParams.pageNum < this.queryParams.pageTotal) {
        this.queryParams.pageNum++;
        this.initData();
      }
    },
  },
};
</script>

<style lang="scss">
.left-chart-11 {
  width: 100%;
  // height: 100%;
  display: flex;
  flex-grow: 0;
  flex-direction: column;
  // border: 1px solid green;
  .under-title {
    flex: 1;
    height: 28px;
    font-size: 14px;
    margin: 10px 0;
    background: url(../../assets/image/title_bg.png) no-repeat;
    b {
      font-size: 14px;
      color: #fff;
      font-style: italic;
      margin-left: 25px;
      line-height: 30px;
    }
  }
  .right-container {
    .right-box {
      color: #101010;
      font-size: 14px;
      padding: 0 10px;
      background-color: #fff;
      margin-bottom: 5px;
      .top {
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid #f1f0f0;
        line-height: 30px;
        .top-left {
          color: #ff2626;
        }
      }
      .middle {
        line-height: 30px;
        border-bottom: 1px solid #f1f0f0;
      }
      .under {
        line-height: 30px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        -webkit-line-clamp: 1;
      }
    }
  }
  .page-box {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .lc1-details {
    // width: 250px;
    height: 70px;
    font-size: 14px;
    display: flex;
    align-items: center;
    border: 1px solid red;
    background-color: #062961;

    span {
      color: #096dd9;
      font-weight: bold;
      font-size: 35px;
      margin-left: 20px;
    }
  }
  .left-list {
    margin-top: 10px;
    .left-container {
      // width: 100%;
      text-align: center;
      // height: 50px;
      // background-color: green;
      margin-top: 10px;
      display: flex;
      // color:red;
      .container-topdown {
        width: 100%;
        display: flex;
        flex-direction: column;
        // border: 1px solid red;
      }
    }
  }
}
</style>
