春风项目四线(合箱线、总装线)
wujian
2024-01-25 c6e06980cccbb86fa224633d3585f9164295bff1
jcdm-ui/src/views/dashboard/PieChart.vue
@@ -6,6 +6,7 @@
import * as echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
import { getTopProcess } from "@/api/main/da/passingStationCollection/passingStationCollection";
export default {
  mixins: [resize],
@@ -25,13 +26,14 @@
  },
  data() {
    return {
      chart: null
      chart: null,
      data: [],
      title:[],
    }
  },
  mounted() {
    this.$nextTick(() => {
      this.initChart()
    })
    this.getData()
  },
  beforeDestroy() {
    if (!this.chart) {
@@ -41,6 +43,19 @@
    this.chart = null
  },
  methods: {
    getData(){
      getTopProcess().then(res => {
        if (res.code === 200){
          this.data = res.rows
          this.data.forEach(x => {
            this.title.push(x.name)
          })
          this.$nextTick(() => {
            this.initChart()
          })
        }
      })
    },
    initChart() {
      this.chart = echarts.init(this.$el, 'macarons')
@@ -60,7 +75,7 @@
          left: 'left',
          // left: 'center',
          // bottom: '10',//左侧高度
          data: ['OP460', 'OP090', 'OP660', 'OP650', 'OP730']
          data: this.title
        },
        series: [
          {
@@ -72,13 +87,7 @@
            //   length: 10 // 调整标签线的长度
            // },
            center: ['50%', '60%'],
            data: [
              { value: 5, name: 'OP460' },
              { value: 9, name: 'OP090' },
              { value: 5, name: 'OP660' },
              { value: 5, name: 'OP650' },
              { value: 7, name: 'OP730' }
            ],
            data: this.data,
            label: {
              formatter: '{b}: {c} ({d}%)'
            },