Blame view

src/components/echart/columnar/index.vue 832 Bytes
任超 committed
1
<template>
任超 committed
2
  <Chart :cdata="cdata" />
任超 committed
3 4 5
</template>

<script>
xiaomiao committed
6
import Chart from "./chart.vue";
任超 committed
7
import work from "@/api/work";
任超 committed
8
export default {
任超 committed
9
  data () {
任超 committed
10 11
    return {
      cdata: {
xiaomiao committed
12 13 14 15
        category: [],
        lineData: [],
        barData: [],
      },
任超 committed
16 17 18 19 20
    };
  },
  components: {
    Chart,
  },
任超 committed
21
  mounted () {
xiaomiao committed
22
    this.submitViews();
任超 committed
23 24
  },
  methods: {
任超 committed
25
    async submitViews () {
xiaomiao committed
26
      try {
任超 committed
27
        let { result: res } = await work.submitViews("A20");
xiaomiao committed
28 29 30 31 32 33 34 35 36 37 38 39
        res.filter((item) => {
          return (
            this.cdata.category.push(item.areaName),
            this.cdata.lineData.push(item.successCount),
            this.cdata.barData.push(item.failureCount)
          );
        });
      } catch (error) {
        // this.$refs.msg.messageShow();
      }
    },
  },
任超 committed
40 41 42
};
</script>

任超 committed
43 44 45
<style lang="scss" scoped>

</style>