Commit 2dbb8146df0e115ee76d5ba5637c93c557f6e9b2

Authored by ww
1 parent bfd56bed

fix: DEFECT-938 open history trend again not show charts

@@ -62,6 +62,7 @@ export function useECharts( @@ -62,6 +62,7 @@ export function useECharts(
62 } 62 }
63 nextTick(() => { 63 nextTick(() => {
64 useTimeoutFn(() => { 64 useTimeoutFn(() => {
  65 + console.log(chartInstance);
65 if (!chartInstance) { 66 if (!chartInstance) {
66 initCharts(getDarkMode.value as 'default'); 67 initCharts(getDarkMode.value as 'default');
67 68
@@ -70,6 +71,7 @@ export function useECharts( @@ -70,6 +71,7 @@ export function useECharts(
70 clear && chartInstance?.clear(); 71 clear && chartInstance?.clear();
71 72
72 chartInstance?.setOption(unref(getOptions)); 73 chartInstance?.setOption(unref(getOptions));
  74 + chartInstance = null;
73 }, 30); 75 }, 30);
74 }); 76 });
75 } 77 }
@@ -6,6 +6,7 @@ import { HistoryData } from '/@/api/alarm/position/model'; @@ -6,6 +6,7 @@ import { HistoryData } from '/@/api/alarm/position/model';
6 import { getDeviceAttributes } from '/@/api/dataBoard'; 6 import { getDeviceAttributes } from '/@/api/dataBoard';
7 import { DeviceAttributeRecord } from '/@/api/dataBoard/model'; 7 import { DeviceAttributeRecord } from '/@/api/dataBoard/model';
8 import { dateUtil } from '/@/utils/dateUtil'; 8 import { dateUtil } from '/@/utils/dateUtil';
  9 +import { isArray } from '/@/utils/is';
9 import { QueryWay } from '/@/views/report/config/config.data'; 10 import { QueryWay } from '/@/views/report/config/config.data';
10 import { SchemaFiled } from '/@/views/visual/board/detail/config/historyTrend.config'; 11 import { SchemaFiled } from '/@/views/visual/board/detail/config/historyTrend.config';
11 import { DEFAULT_DATE_FORMAT } from '/@/views/visual/board/detail/config/util'; 12 import { DEFAULT_DATE_FORMAT } from '/@/views/visual/board/detail/config/util';
@@ -24,7 +25,8 @@ export function useHistoryData() { @@ -24,7 +25,8 @@ export function useHistoryData() {
24 const getDeviceAttribute = async (record: DeviceOption) => { 25 const getDeviceAttribute = async (record: DeviceOption) => {
25 try { 26 try {
26 const { deviceProfileId } = record; 27 const { deviceProfileId } = record;
27 - deviceAttrs.value = (await getDeviceAttributes({ deviceProfileId })) || []; 28 + const list = (await getDeviceAttributes({ deviceProfileId })) || [];
  29 + deviceAttrs.value = isArray(list) ? list : [];
28 } catch (error) { 30 } catch (error) {
29 throw error; 31 throw error;
30 } 32 }