<!--
 * @Author: your name
 * @Date: 2021-10-19 09:46:17
 * @LastEditTime: 2021-10-19 09:58:01
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /data-show/src/views/EventComparison/CWIEC/index.vue
-->

<template>
    <div class="cwiec-outter" v-loading="load">
        <v-label-div title="微博信息量对比" :showLine="false" :eStyle="{'border-style': 'none'}">
        </v-label-div>
        <div class="cwiec-inner">
            <v-echarts :opt="opt"></v-echarts>
        </div>
    </div>
</template>

<script>
import {getContrastCount0528C} from "@/api/EventComparison";
import {createSingleColumnar} from "@/utils/gol/singleColumnar"
export default {
    name: "CWIEC",
    data() {
        return {
            form: {
                token: "",
                sRele: "",
                load: false
            },
            opt: {}
        }
    },
    created() {
        this.initData();
    },
    methods: {
        initData() {
           this.form.token = this.getToken;
           let arr = [];
           this.getEComparison.forEach(ele => {
               arr.push(ele.events_id);
           })
           this.form.sRele = arr.toString();
           this.getData()
       },
       getData() {
          let obj = Object.assign({}, this.getCtime2, this.form); 
          this.load = true;
          getContrastCount0528C(obj).then(res => {
              let data = res.data || [];
              let dx = [];
              let ds = [];
              data.forEach(e => {
                  dx.push(e.key);
                  ds.push(e.value);
              });
              this.opt = createSingleColumnar(dx,ds);
              this.load = false;
          })
       }
    }
}
</script>

<style lang="less" scoped>
.cwiec-outter {
    width: 472px;
    height: 412px;
    .cwiec-inner {
        width: 100%;
        height: calc(100% - 48px);
    }
}
</style>
