<template>
  <div>
    <div class="flagBoxStyle">
      <div class="flagStyle" />
      <div>报警分析</div>
    </div>
    <el-row>
      <el-col>
        <ve-line
          :data="chartDataLine"
          :settings="chartSettingsLine"
        />
      </el-col>
      <el-col>
        <div class="tableStyle">
          <el-table border :data="tableList" stripe>
            <el-table-column prop="name" label="设备型号" />
            <el-table-column prop="value" label="设备名称" />
          </el-table>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { alarmStaticsByContent } from '@/api/alarm/deviceStatics'
export default {
  name: 'AlarmStaticsByType',
  data() {
    return {
      tableList: [],
      // 折线图
      chartSettingsLine: {
        labelMap: {
          'alarmWellData': '井盖开盖报警',
          'alarmLiquidData': '液位超限报警',
          'alarmHarmfulData': '有害气体超标报警'
        },
        metrics: ['alarmWellData', 'alarmLiquidData', 'alarmHarmfulData'],
        dimension: ['date']
      },
      chartDataLine: {
        columns: ['date', 'alarmWellData', 'alarmLiquidData', 'alarmHarmfulData'],
        rows: []
      }
    }
  },
  created() {
    this.fetchDeviceTypeLine()
  },
  mounted() {
    this.tableList = [
      {
        value: '224',
        name: '井盖开启'
      },
      {
        value: '22',
        name: '燃气浓度超限'
      },
      {
        value: '1',
        name: '液位超限'
      },
      {
        value: '4',
        name: '有害气体超标'
      }
    ]
  },
  methods: {
    fetchDeviceTypeLine(val) {
      if (val !== undefined) {
        this.listQuery.startTime = val[0]
        this.listQuery.endTime = val[1]
      }
      alarmStaticsByContent(this.listStatue).then(response => {
        console.log(response.data, '===123')
        this.chartDataLine.rows = response.data
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.tableStyle{
  padding: 100px 10px;
}
.flagBoxStyle {
  display: flex;
  margin-bottom: 20px;
}
.flagBoxStyle div:nth-child(2){
  line-height: 30px;
  font-weight: 600;
}
.flagStyle {
  width: 4px;
  height: 30px;
  margin-right: 6px;
  background: rgb(64 121 242);
}

</style>
