From 62ab300c608c4dbb9c93e3a04cf2f5a7afaadb31 Mon Sep 17 00:00:00 2001 From: lb Date: Fri, 28 Apr 2023 11:09:06 +0800 Subject: [PATCH] import chart --- .../pms/carHistory/components/configs/chart.js | 16 ++++++++++++++-- .../carHistory/components/temperatureDialog.vue | 14 ++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/views/modules/pms/carHistory/components/configs/chart.js b/src/views/modules/pms/carHistory/components/configs/chart.js index 683394a..0cf4070 100644 --- a/src/views/modules/pms/carHistory/components/configs/chart.js +++ b/src/views/modules/pms/carHistory/components/configs/chart.js @@ -1,3 +1,15 @@ export default { - -} \ No newline at end of file + xAxis: { + type: 'category', + data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] + }, + yAxis: { + type: 'value' + }, + series: [ + { + data: [150, 230, 224, 218, 135, 147, 260], + type: 'line' + } + ] +}; \ No newline at end of file diff --git a/src/views/modules/pms/carHistory/components/temperatureDialog.vue b/src/views/modules/pms/carHistory/components/temperatureDialog.vue index 5ac5918..2b5f083 100644 --- a/src/views/modules/pms/carHistory/components/temperatureDialog.vue +++ b/src/views/modules/pms/carHistory/components/temperatureDialog.vue @@ -28,8 +28,8 @@ :total="totalPage" layout="total, sizes, prev, pager, next, jumper"> -
-
+
+
@@ -38,6 +38,7 @@ import BaseListTable from "@/components/BaseListTable.vue"; import chartConfig from "./configs/chart"; import tableConfig from "./configs/tableProps"; +import * as echarts from "echarts"; export default { name: "TemperatureDialog", @@ -62,6 +63,13 @@ export default { this.refreshLayoutKey = Math.random(); }, mounted() {}, + watch: { + dataList: { + handler: function (val) { + this.drawChart(val); + }, + }, + }, methods: { init(id) { this.hisId = id; @@ -108,6 +116,8 @@ export default { }, drawChart() { // 根据 dataList 绘制折线图 + if (!this.chart) this.chart = echarts.init(document.getElementById("temp-chart")); + this.chart.setOption(this.chartConfig); }, handleOperate() {}, handlePageChange(page) {