|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div class="system-edit-dic-container">
|
|
|
- <el-dialog v-model="isShowDialog" title="数据记录" width="850px">
|
|
|
+ <el-dialog v-model="isShowDialog" :title="data.name + `(${data.key})`" width="850px">
|
|
|
<!-- 这里是 echarts 线图 -->
|
|
|
<div id="lineChart" ref="chartRef" class="chart-container"></div>
|
|
|
</el-dialog>
|
|
@@ -12,6 +12,7 @@ import { ref, onMounted, watch, nextTick } from 'vue'
|
|
|
import api from '/@/api/device'
|
|
|
import * as echarts from 'echarts'
|
|
|
|
|
|
+const data = ref({ name: '', key: '' })
|
|
|
const loading = ref(false)
|
|
|
const isShowDialog = ref(false)
|
|
|
const chartRef = ref<HTMLElement | null>(null)
|
|
@@ -43,7 +44,7 @@ const updateChart = () => {
|
|
|
if (!chartInstance) return
|
|
|
|
|
|
// 从 lineData 中提取数据
|
|
|
- const xData = lineData.value.map((item: any) => item.ts?.slice(5)).reverse()
|
|
|
+ const xData = lineData.value.map((item: any) => item.ts?.slice(10)).reverse()
|
|
|
const yData = lineData.value.map((item: any) => item.value).reverse()
|
|
|
|
|
|
// 配置图表选项
|
|
@@ -106,7 +107,7 @@ const updateChart = () => {
|
|
|
lineStyle: {
|
|
|
width: 2,
|
|
|
},
|
|
|
- symbolSize: 6,
|
|
|
+ symbolSize: 4,
|
|
|
},
|
|
|
],
|
|
|
}
|
|
@@ -154,6 +155,7 @@ watch(
|
|
|
|
|
|
// 打开弹窗
|
|
|
const openDialog = (row: any, deviceKey: string) => {
|
|
|
+ data.value = row
|
|
|
isShowDialog.value = true
|
|
|
loading.value = true
|
|
|
api.instance
|
|
@@ -164,7 +166,6 @@ const openDialog = (row: any, deviceKey: string) => {
|
|
|
})
|
|
|
.then((res: any) => {
|
|
|
lineData.value = res.List
|
|
|
- console.log(res.List)
|
|
|
})
|
|
|
.finally(() => (loading.value = false))
|
|
|
}
|