|
@@ -19,7 +19,7 @@ import { useRequest } from '@/hooks/request';
|
|
import { useViewVisible } from '@/hooks/view-visible';
|
|
import { useViewVisible } from '@/hooks/view-visible';
|
|
import { t } from '@/i18n';
|
|
import { t } from '@/i18n';
|
|
import { getDevWorkHistoryData } from '@/api';
|
|
import { getDevWorkHistoryData } from '@/api';
|
|
-import { getEChartsColors } from '@/utils';
|
|
|
|
|
|
+import { getEChartsColors, timeSorter } from '@/utils';
|
|
import { TimeRangePreset } from '@/constants';
|
|
import { TimeRangePreset } from '@/constants';
|
|
|
|
|
|
import type { Dayjs } from 'dayjs';
|
|
import type { Dayjs } from 'dayjs';
|
|
@@ -118,6 +118,7 @@ const paramLabel = computed<string>(() => {
|
|
});
|
|
});
|
|
|
|
|
|
const option = computed<EChartsOption>(() => {
|
|
const option = computed<EChartsOption>(() => {
|
|
|
|
+ const unitText = historyData.value[0]?.unit ?? '';
|
|
const source = convertToEChartsDataset();
|
|
const source = convertToEChartsDataset();
|
|
const series = source[0].slice(1).map((name) => ({
|
|
const series = source[0].slice(1).map((name) => ({
|
|
type: 'line',
|
|
type: 'line',
|
|
@@ -133,6 +134,21 @@ const option = computed<EChartsOption>(() => {
|
|
tooltip: {
|
|
tooltip: {
|
|
show: true,
|
|
show: true,
|
|
trigger: 'axis',
|
|
trigger: 'axis',
|
|
|
|
+ formatter(params) {
|
|
|
|
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
+ const tempParms = params as any[];
|
|
|
|
+ const time = dayjs(tempParms[0].axisValue).format('MM-DD HH:mm');
|
|
|
|
+
|
|
|
|
+ let tableHtml = '<table class="echarts-tooltip-electricity">';
|
|
|
|
+ tableHtml += `<tr><th>${time}</th></tr>`;
|
|
|
|
+
|
|
|
|
+ tempParms.forEach((param) => {
|
|
|
|
+ tableHtml += `<tr><td>${param.marker}${param.seriesName}</td><td>${param.value[1]}${unitText}</td></tr>`;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ tableHtml += '</table>';
|
|
|
|
+ return tableHtml;
|
|
|
|
+ },
|
|
},
|
|
},
|
|
dataset: {
|
|
dataset: {
|
|
source,
|
|
source,
|
|
@@ -147,6 +163,7 @@ const option = computed<EChartsOption>(() => {
|
|
},
|
|
},
|
|
axisLabel: {
|
|
axisLabel: {
|
|
color: '#999',
|
|
color: '#999',
|
|
|
|
+ fontSize: 10,
|
|
formatter(value) {
|
|
formatter(value) {
|
|
return dayjs(value).format('MM-DD HH:mm');
|
|
return dayjs(value).format('MM-DD HH:mm');
|
|
},
|
|
},
|
|
@@ -158,6 +175,7 @@ const option = computed<EChartsOption>(() => {
|
|
yAxis: {
|
|
yAxis: {
|
|
axisLabel: {
|
|
axisLabel: {
|
|
color: '#999',
|
|
color: '#999',
|
|
|
|
+ fontSize: 10,
|
|
},
|
|
},
|
|
splitLine: {
|
|
splitLine: {
|
|
lineStyle: {
|
|
lineStyle: {
|
|
@@ -171,7 +189,8 @@ const option = computed<EChartsOption>(() => {
|
|
top: 10,
|
|
top: 10,
|
|
right: 0,
|
|
right: 0,
|
|
bottom: 20,
|
|
bottom: 20,
|
|
- left: 30,
|
|
|
|
|
|
+ left: 0,
|
|
|
|
+ containLabel: true,
|
|
},
|
|
},
|
|
};
|
|
};
|
|
});
|
|
});
|
|
@@ -217,6 +236,7 @@ const convertToEChartsDataset = () => {
|
|
});
|
|
});
|
|
|
|
|
|
const source: EChartsDatasetItemValue[][] = [['time', ...Object.keys(dataMap)]];
|
|
const source: EChartsDatasetItemValue[][] = [['time', ...Object.keys(dataMap)]];
|
|
|
|
+ times.sort(timeSorter);
|
|
|
|
|
|
times.forEach((time) => {
|
|
times.forEach((time) => {
|
|
const row: EChartsDatasetItemValue[] = [time];
|
|
const row: EChartsDatasetItemValue[] = [time];
|