From cfebf2b757a00fb8b6e795b1415029c46ecda3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E7=8F=AE=E5=AE=87?= Date: Thu, 29 Feb 2024 17:43:32 +0800 Subject: [PATCH] =?UTF-8?q?=EE=A4=81=E5=8F=B0=E7=AB=99=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8E=A5=E6=94=B6=E7=BB=9F=E8=AE=A1=E5=BC=B9=E7=AA=97=EF=BC=8C?= =?UTF-8?q?x=E6=97=B6=E9=97=B4=E8=BD=B4=E8=A6=81=E6=8C=89=E7=85=A7utc?= =?UTF-8?q?=E6=97=B6=E9=97=B4-8=E5=B0=8F=E6=97=B6=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/RealTimeDataChart.vue | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/views/stationOperation/components/RealTimeDataChart.vue b/src/views/stationOperation/components/RealTimeDataChart.vue index 37afcc8..357a78a 100644 --- a/src/views/stationOperation/components/RealTimeDataChart.vue +++ b/src/views/stationOperation/components/RealTimeDataChart.vue @@ -29,8 +29,10 @@ import CustomChart from '@/components/CustomChart/index.vue' import * as echarts from 'echarts' import dayjs from 'dayjs' +import utc from 'dayjs/plugin/utc' import { cloneDeep } from 'lodash' +dayjs.extend(utc) const typeList = ['MET', 'SOH', 'QC', 'PHD'] // // 自定义图例列表 @@ -71,10 +73,15 @@ const legendList = [ const initialOption = { tooltip: { formatter: (params) => { + // return ` + //
${params.marker}${params.name}
+ //
START:${dayjs(new Date(params.value[4])).format('YYYY-MM-DD HH:mm:ss')}
+ //
END:${dayjs(new Date(params.value[2])).format('YYYY-MM-DD HH:mm:ss')}
+ // ` return `
${params.marker}${params.name}
-
START:${dayjs(new Date(params.value[4])).format('YYYY-MM-DD HH:mm:ss')}
-
END:${dayjs(new Date(params.value[2])).format('YYYY-MM-DD HH:mm:ss')}
+
START:${dayjs.utc(params.value[4]).format('YYYY-MM-DD HH:mm:ss')}
+
END:${dayjs.utc(params.value[2]).format('YYYY-MM-DD HH:mm:ss')}
` }, }, @@ -203,8 +210,9 @@ export default { axisLabel: { show: true, formatter: (val) => { - let dateTime = new Date(val) - return dayjs(dateTime).format('HH:mm\nMM/DD') + // let dateTime = new Date(val) + // return dayjs.utc(dateTime).format('HH:mm\nMM/DD') + return dayjs.utc(val).format('HH:mm\nMM/DD') }, color: '#ade6ee', },