isv-robot 2 년 전
부모
커밋
41f9e70dc3
1개의 변경된 파일19개의 추가작업 그리고 7개의 파일을 삭제
  1. 19 7
      src/views/dashboard-screen/jxdxqk/index.vue

+ 19 - 7
src/views/dashboard-screen/jxdxqk/index.vue

@@ -13,12 +13,14 @@
 // import { getPie3D, getParametricEquation } from 'chart.js' // 工具类js,页面路径自己修改
 import * as echarts from 'echarts'
 import {param} from '@/utils'
+import {chartJxdxqky, chartSyjhdxqk} from "@/api/dashboard-json";
 
 export default {
   name: 'Chart',
   data() {
     return {
-      option: {}
+      option: {},
+      arrMap: []
     }
   },
   created() {
@@ -28,7 +30,16 @@ export default {
 
   methods: {
     // 初始化label样式
-    getOption() {
+    async getOption() {
+      const res = await chartJxdxqky()
+      if (res?.code === 200) {
+        const arrMap = [
+          res.info.series[0].data[0],
+          res.info.series[1].data[0]
+        ]
+        this.arrMap = arrMap;
+      }
+
       /** ***********************
        pie3D 尝试
 
@@ -344,7 +355,7 @@ export default {
 
       const optionData = [{
         name: '完成',
-        value: 3,
+        value: this.arrMap[0],
         itemStyle: {
           opacity: 0.5,
           color: 'rgba(33,229,248,0.8)'
@@ -352,7 +363,7 @@ export default {
 
       }, {
         name: '剩余',
-        value: 1,
+        value: this.arrMap[1],
         itemStyle: {
           opacity: 0.5,
           color: 'rgba(217,187,62,0.8)'
@@ -364,13 +375,14 @@ export default {
       // 传入数据生成 option
       this.option = getPie3D(optionData, 0)
 
-      this.option.series.push({
+      this.option.series.push(
+        {
         name: '', // 自己根据场景修改
         type: 'pie',
         hoverAnimation: false, // 悬停不放大
         labelLine: {
-          length: this.EchartfontSize(40),
-          length2: this.EchartfontSize(66),
+          length: this.EchartfontSize(30),
+          length2: this.EchartfontSize(60),
           lineStyle: {
             width: this.EchartfontSize(2)
           }