<!--
 * @Author: your name
 * @Date: 2021-10-15 15:34:26
 * @LastEditTime: 2021-11-11 10:45:28
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /data-show/src/views/BrandComparison/keyMediaCommunicationComparison/index.vue
-->
<template>
  <div class="kmcc-outter">
    <v-label-div title="重点媒体传播对比"> </v-label-div>
    <div class="kmcc-inner">
      <v-echarts :opt="opt"></v-echarts>
    </div>
  </div>
</template>

<script>
import createOpt from "./opt";
import { getSourceCount0528C } from "@/api/BrandComparison/index.js";
export default {
  name: "kmcc-outter",
  data() {
    return {
      form: {
        token: "",
        sBrand: "",
      },
      opt: {},
    };
  },
  created() {
    this.initData();
  },
  methods: {
    initData() {
      this.form.token = this.getToken;
      let arr = this.getBComparison;
      let brands = [];
      arr.forEach((ele) => {
        brands.push(ele.name);
      });
      this.form.sBrand = brands.toString();
      this.getData();
    },
    getData() {
      let obj = Object.assign({}, this.getCtime2, this.form);
      getSourceCount0528C(obj).then((res) => {
        
         let data = res.data;
         this.opt = createOpt(data);
      })
    }
  },
};
</script>

<style lang="less" scoped>
.kmcc-outter {
  width: 936px;
  height: 460px;
  border: 2px solid #0f2a4d;
  margin-left: 16px;
  .kmcc-inner {
    width: 100%;
    height: calc(100% - 48px);
  }
}
</style>
