index.vue 1.34 KB
<template>
  <div>
    <Chart :cdata="cdata" />
    <el-carousel height="40px" indicator-position="none">
      <el-carousel-item v-for="item in 4" :key="item">
        <div class="rotograph">佛坪县</div>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
import Chart from "./chart.vue";
import work from "@/api/work";
export default {
  data () {
    return {
      cdata: {
        seriesData: [],
      },
    };
  },
  components: {
    Chart,
  },
  mounted () {
       this.getdjywltotal();


  },
  methods: {
   async getdjywltotal () {
        try {
          let p = {
            DJLX: "",
            QLLX: "",
            XZQDM: "",
          };
          let res = await work.getdjywltotal(p);
          console.log("res",res);
          res.result.filter((item) => {
          return (
            this.cdata.seriesData.push({ "name": item.AREACODE, "value": item.ywtotal })
          )
       });
          console.log("this.cdata.seriesData",this.cdata.seriesData);
        } catch (error) {
          this.$refs.msg.messageShow();
        }


    },
  },
};
</script>

<style lang="scss" scoped>
.rotograph {
  margin: auto;
  width: 200px;
  height: 30px;
  background-color: rgb(6, 121, 167);
  font-size: 20px;
  line-height: 30px;
  text-align: center;
  border-radius: 6px;
  font-weight: 600;
  color: #02d9fd;
}
</style>