From 04b8eff075a04db23e6f908855699b4d2954588c Mon Sep 17 00:00:00 2001
From: yyt <306727702@qq.com>
Date: 星期四, 23 五月 2024 18:47:01 +0800
Subject: [PATCH] 380新产品,优化

---
 jcdm-ui/src/views/dashboard/PieChart.vue |   33 +++++++++++++++++++++------------
 1 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/jcdm-ui/src/views/dashboard/PieChart.vue b/jcdm-ui/src/views/dashboard/PieChart.vue
index b831efc..35fb6af 100644
--- a/jcdm-ui/src/views/dashboard/PieChart.vue
+++ b/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}%)'
             },

--
Gitblit v1.9.3