From c74dcb8dca7b9e3eded0d20299f19a26a6b70974 Mon Sep 17 00:00:00 2001
From: wujian <14790700720@163.com>
Date: 星期三, 31 一月 2024 12:48:45 +0800
Subject: [PATCH] add 追溯报表

---
 jcdm-ui/src/views/dashboard/LineChart.vue |   82 +++++++++++++++++-----------------------
 1 files changed, 35 insertions(+), 47 deletions(-)

diff --git a/jcdm-ui/src/views/dashboard/LineChart.vue b/jcdm-ui/src/views/dashboard/LineChart.vue
index 4ab1c09..8efc27c 100644
--- a/jcdm-ui/src/views/dashboard/LineChart.vue
+++ b/jcdm-ui/src/views/dashboard/LineChart.vue
@@ -6,6 +6,7 @@
 import * as echarts from 'echarts'
 require('echarts/theme/macarons') // echarts theme
 import resize from './mixins/resize'
+import { getOffLineNum } from "@/api/main/bs/orderScheduling/orderScheduling";
 
 export default {
   mixins: [resize],
@@ -33,7 +34,9 @@
   },
   data() {
     return {
-      chart: null
+      chart: null,
+      data: [],
+      legendTitle: [],
     }
   },
   watch: {
@@ -45,9 +48,8 @@
     }
   },
   mounted() {
-    this.$nextTick(() => {
-      this.initChart()
-    })
+    this.getData()
+
   },
   beforeDestroy() {
     if (!this.chart) {
@@ -57,6 +59,19 @@
     this.chart = null
   },
   methods: {
+    getData(){
+      getOffLineNum().then(res => {
+        if (res.code === 200){
+          this.data = res.rows
+          this.data.forEach(x => {
+            this.legendTitle.push(x.name)
+          })
+          this.$nextTick(() => {
+            this.initChart()
+          })
+        }
+      })
+    },
     initChart() {
       this.chart = echarts.init(this.$el, 'macarons')
       this.setOptions(this.chartData)
@@ -68,15 +83,20 @@
           left: 'left' // 鏍囬浣嶇疆
         },
         xAxis: {
-          data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
+          data: ['8:00', '9:00', '10:00','11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00','21:00','22:00'],
           boundaryGap: false,
           axisTick: {
             show: false
-          }
+          },
+          type: 'category',
+          axisLabel: {
+            interval: 0,
+            rotate: 45,
+          },
         },
         grid: {
-          left: 10,
-          right: 10,
+          left: 20,
+          right: 20,
           bottom: 20,
           top: 30,
           containLabel: true
@@ -91,49 +111,17 @@
         yAxis: {
           axisTick: {
             show: false
-          }
+          },
+          min:0,
+          max: this.data.length === 0 ? 100 : null
         },
         legend: {
-          data: ['expected', 'actual']
+          data: this.legendTitle
         },
-        series: [{
-          name: 'expected', itemStyle: {
-            normal: {
-              color: '#FF005A',
-              lineStyle: {
-                color: '#FF005A',
-                width: 2
-              }
-            }
-          },
-          smooth: true,
-          type: 'line',
-          data: expectedData,
-          animationDuration: 2800,
-          animationEasing: 'cubicInOut'
-        },
-        {
-          name: 'actual',
-          smooth: true,
-          type: 'line',
-          itemStyle: {
-            normal: {
-              color: '#3888fa',
-              lineStyle: {
-                color: '#3888fa',
-                width: 2
-              },
-              areaStyle: {
-                color: '#f3f8ff'
-              }
-            }
-          },
-          data: actualData,
-          animationDuration: 2800,
-          animationEasing: 'quadraticOut'
-        }]
+        series: this.data
       })
     }
-  }
+  },
+
 }
 </script>

--
Gitblit v1.9.3