<template>
  <el-row class="mianBox-af">
    <el-row class="headerBox">
      <el-col class="title">
        <img src="../../../assets/image-af/title2.png" alt="" />
        设备告警情况
      </el-col>
    </el-row>
    <el-row class="contentBox">
        <div ref="echartD" class="echartD"></div>
    </el-row>
  </el-row>
</template>

<script>
import * as echarts from "echarts";
import echartsGet from "./echart";
export default {
  props:['resInfo'],
  data() {
    return {
      isCheck: "info",
      option: null,
      resList:{}
    };
  },
  mounted(){
    this.getData()
  },
  watch: {
    "$store.state.windowWidth"() {
      echarts.init(this.$refs.echartD).resize();
    },
    resInfo(){
      this.getData()
    }
  },
  methods: {
    async getData(){
       let res = await this.$axios.get(this.resInfo.apiAddr + '?' +this.$qs.stringify({
        applicationCode: this.resInfo.applicationCode
      }))
      if(res.success){
        this.resList = res.data
        echarts.init(this.$refs.echartD).setOption(echartsGet(this.resList));
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.mianBox-af {
  background: url("../../../assets/image-af/bg.png") no-repeat;
  background-size: 100% 100%;
  .contentBox{
    width: 100%;
    display: flex;
    padding: 0 20px;
    box-sizing: border-box;
    .echartD{
      width: 100%;
      height: calc(100% + 15px);
      transform: translateY(-15px); 
    }
  }
}
</style>