台站数据接收统计弹窗,x时间轴要按照utc时间-8小时显示

This commit is contained in:
任珮宇 2024-02-29 17:43:32 +08:00
parent 8f0a095715
commit cfebf2b757

View File

@ -29,8 +29,10 @@
import CustomChart from '@/components/CustomChart/index.vue' import CustomChart from '@/components/CustomChart/index.vue'
import * as echarts from 'echarts' import * as echarts from 'echarts'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
import { cloneDeep } from 'lodash' import { cloneDeep } from 'lodash'
dayjs.extend(utc)
const typeList = ['MET', 'SOH', 'QC', 'PHD'] // const typeList = ['MET', 'SOH', 'QC', 'PHD'] //
// //
@ -71,10 +73,15 @@ const legendList = [
const initialOption = { const initialOption = {
tooltip: { tooltip: {
formatter: (params) => { formatter: (params) => {
// return `
// <div>${params.marker}${params.name}</div>
// <div>START${dayjs(new Date(params.value[4])).format('YYYY-MM-DD HH:mm:ss')}</div>
// <div style="white-space: pre"> END${dayjs(new Date(params.value[2])).format('YYYY-MM-DD HH:mm:ss')}</div>
// `
return ` return `
<div>${params.marker}${params.name}</div> <div>${params.marker}${params.name}</div>
<div>START${dayjs(new Date(params.value[4])).format('YYYY-MM-DD HH:mm:ss')}</div> <div>START${dayjs.utc(params.value[4]).format('YYYY-MM-DD HH:mm:ss')}</div>
<div style="white-space: pre"> END${dayjs(new Date(params.value[2])).format('YYYY-MM-DD HH:mm:ss')}</div> <div style="white-space: pre"> END${dayjs.utc(params.value[2]).format('YYYY-MM-DD HH:mm:ss')}</div>
` `
}, },
}, },
@ -203,8 +210,9 @@ export default {
axisLabel: { axisLabel: {
show: true, show: true,
formatter: (val) => { formatter: (val) => {
let dateTime = new Date(val) // let dateTime = new Date(val)
return dayjs(dateTime).format('HH:mm\nMM/DD') // return dayjs.utc(dateTime).format('HH:mm\nMM/DD')
return dayjs.utc(val).format('HH:mm\nMM/DD')
}, },
color: '#ade6ee', color: '#ade6ee',
}, },