Blame view

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

<script>
import Chart from './chart.vue';
任超 committed
7
import work from "@/api/work";
任超 committed
8 9 10
export default {
  data () {
    return {
xiaomiao committed
11
      cdata: []
任超 committed
12 13 14
    }
  },
  components: {
任超 committed
15
    Chart
xiaomiao committed
16
  },
任超 committed
17
  mounted () {
xiaomiao committed
18 19 20
    this.mapViews();

  },
任超 committed
21 22
  methods: {
    async mapViews () {
xiaomiao committed
23
      try {
任超 committed
24 25
        let { result: res } = await work.mapViews("A20");
        res.filter((item) => {
xiaomiao committed
26
          return (
任超 committed
27
            this.cdata.push({ "name": item.areaName, "value": item.areaCode })
xiaomiao committed
28 29 30 31 32 33 34
          )

        });
      } catch (error) {
        this.$refs.msg.messageShow();
      }
    }
任超 committed
35
  }
任超 committed
36 37
}
</script>