<template>
  <div id="bZCenter">
    <!--      <span class="text">传感器在线信息</span>-->
    <div class="body-box">
      <p slot="title" class="text">倾角环境实时数据</p>
      <Table  :row-class-name="rowClassName" max-height="290" :columns="config.columns" :data="config.data" :border="false"></Table>
      <!--        <dv-scroll-board  :config="config" />-->

    </div>
  </div>
  <!--  <Table height="200" width="100px" :columns="columns" :data="data"></Table>-->
</template>

<script>

import {getAction} from "@api/manage";

export default {
  name: "bZCenter",

  data() {
    return {
      rowStyleOption: {
        stripe: true,
      },
      config:{
        columns: [
          {
            key: "deviceName",
            title: "设备名称",
            width: 230,
            align: "center",
          },
          {
            key: "createTime",
            title: "采集时间",
            width: 180,
            align: "center",
          },
          {
            key: "angle",
            title: "x,y,z倾角(°)",
            // width: 300,
            align: "center",
          },
        ],
        data: [],
      },

      url: {
        // getAirNoiseData: "/energy/buAirNoise/getAirNoiseData",
        getDipAngleData:"/energy/buDipAngle/getDipAngleData",
      },
    };
  },
  created() {
    this.get()
  },
  methods: {
    rowClassName (row, index) {
      if (index %2) {
        return 'demo-table-error-row';
      } else{
        return 'demo-table-info-row';
      }
      return '';
    },
    get(){
      getAction(this.url.getDipAngleData, {}, 'get').then((res) => {
        if(res.result.length>0){
          this.config.data = res.result
          this.config = { ...this.config }
          this.$emit('zTransmit', true)
        }else {
          this.$emit('zTransmit', false)
        }
      })
    }
  },
}
</script>

<style lang="less">
#bZCenter {
  padding: 5px;
  .ivu-table .demo-table-info-row td{
    background-color: #ffffff;
    height: 40px;
    color: #000000;
    font-size: 14px;
    border: #f1f1f1;
  }
  .ivu-table .demo-table-error-row td{
    background-color: #f1f1f1;
    height: 40px;
    color: #000000;
    font-size: 14px;
    border: #f1f1f1;
  }
  .ivu-table th {
    height: 40px;
    font-size: 15px;
    background-color: #f0f2f3;
  }
  .ivu-table-header th {
    font-weight: normal;
    color: #000000;
    font-family: 'Arial', sans-serif;
  }
  .text {
    color: #000000;
    font-size: 16px;
    font-weight:bold;
    margin-top: 0;
    margin-bottom: 0;
    //text-align: center;
  }
  .ivu-table-wrapper {
    border: none;
    border-radius: 6px;
    padding-top: 5px;
  }
  .ivu-table:before{content:'';width:100%;height:0px;position:absolute;left:0;bottom:0;z-index:1}
  .ivu-table:after{content:'';width:0px;height:100%;position:absolute;top:0;right:0;z-index:3}

}
</style>