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

<script>
import Chart from "./chart.vue";
import worktable from "@/api/worktable";
export default {
  data() {
    return {
      cdata: {
        category: [],
        lineData: [],
        barData: [],
      },
    };
  },
  components: {
    Chart,
  },
  mounted() {
    this.submitViews();
  },
  methods: {
    async submitViews() {
      try {
        let { result: res } = await worktable.submitViews("A20");
        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();
      }
    },
  },
};
</script>

<style lang="scss" scoped></style>