index.vue 934 Bytes
<template>
  <Chart :cdata="cdata" />
</template>

<script>
import Chart from "./Chart";
import work from "@/api/work";
export default {
  data () {
    return {
      cdata: {
        category: [],
        lineData: [],
      },
    };
  },
  components: {
    Chart,
  },
  created () {

  },
  mounted () {
    this.getDjlxtotal();
  },
  methods: {
    getDjlxtotal () {
      return new Promise(async (resolve) => {
        try {
          let p = {
            DJLX: "A21",
            QLLX: "A8",
            XZQDM: "A20",
          };
          let res = await work.getDjlxtotal(p);
          res.result.filter((item) => {
            return (
              this.cdata.category.push(item.AREACODE),
              this.cdata.lineData.push(item.ywtotal)
            );
          });
        } catch (error) {
          this.$refs.msg.messageShow();
        }
      });
    }
  }
};
</script>
<style lang="scss" scoped>
</style>