<template>
  <div class="modelBlock">
    <div class="model-title">
      <div class="model-title-text">设备告警趋势(近一个月)</div>
    </div>
    <div class="model-content">
      <zz-echart
        :option="clientOptions"
        class="chart"
      ></zz-echart>
    </div>
  </div>
</template>
<script>
import { discountedWave } from './indexOptionChart';
let dataArr = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let dataDay = [
  '01-01',
  '01-02',
  '01-03',
  '01-04',
  '01-05',
  '01-06',
  '01-07',
  '01-08',
  '01-09',
  '01-10',
  '01-11',
  '01-12',
  '01-13',
  '01-14',
  '01-15',
  '01-16',
  '01-17',
  '01-18',
  '01-19',
  '01-20',
  '01-21',
  '01-22',
  '01-23',
  '01-24',
  '01-25',
  '01-26',
  '01-27',
  '01-28',
  '01-29',
  '01-30',
  '01-31'
];
export default {

  data () {
    return {
      clientOptions: discountedWave('(次)', dataDay, dataArr),
      mixins_query: {
        communityId: ''
      }
    };
  },
  created () {
    this.getData();
  },
  methods: {
    getData () {
      this.$http
        .get('/sc-community-web/countDeviceAlarmLast30Days', this.mixins_query)
        .then(({ status, data, msg }) => {
          if (status == 0) {
            let dateTime = [],
              valueArr = [];
            data.map((item) => {
              dateTime.push(item.date);
              valueArr.push(item.total);
            });
            this.clientOptions = discountedWave('(次)', dateTime, valueArr);
          }
        })
        .catch((err) => { });
    }
  }
};
</script>
<style scoped lang="scss">
@import '../style.scss';
</style>