index.vue 764 Bytes
<!--
 * @Description:
 * @Autor: renchao
 * @LastEditTime: 2023-04-03 13:40:18
-->
<template>
  <Chart :cdata="cdata" />
</template>

<script>
import Chart from "./Chart";
import work from "@/api/work";
export default {
  data () {
    return {
      cdata: []
    }
  },
  components: {
    Chart
  },
  mounted () {
    this.mapViews();
  },
  methods: {
    /**
     * @description: mapViews
     * @author: renchao
     */
    async mapViews () {
      try {
        let { result: res } = await work.mapViews("A20");
        res.map((item) => {

          return (
            this.cdata.push({ "name": item.areaName, "value": item.ywtotal })
          )

        });
      } catch (error) {
        this.$refs.msg.messageShow();
      }
    }
  }
}
</script>