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

<script>
import Chart from "./chart.vue";
import worktable from "@/api/worktable";
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 worktable.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>