Commit 4eb20aa1f553179c5b79f7bd8e7aaa7d79bf91c0

Authored by xp.Huang
2 parents 7f227582 c7b9be41

Merge branch 'fix/DEFECT-1946' into 'main_dev'

fix: 修复数据看板实时折线图属性名为undefined

See merge request yunteng/thingskit-front!1247
@@ -11,6 +11,7 @@ @@ -11,6 +11,7 @@
11 import { MultipleDataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 11 import { MultipleDataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
12 import { useReceiveMessage } from '../../../hook/useReceiveMessage'; 12 import { useReceiveMessage } from '../../../hook/useReceiveMessage';
13 import { formatToDateTime } from '/@/utils/dateUtil'; 13 import { formatToDateTime } from '/@/utils/dateUtil';
  14 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
14 interface IList { 15 interface IList {
15 [key: string]: string | number; 16 [key: string]: string | number;
16 } 17 }
@@ -83,6 +84,8 @@ @@ -83,6 +84,8 @@
83 }, updateInterval); 84 }, updateInterval);
84 }; 85 };
85 86
  87 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  88 +
86 const getDesign = computed(() => { 89 const getDesign = computed(() => {
87 const { persetOption, option } = props.config; 90 const { persetOption, option } = props.config;
88 const { dataSource = [] } = option || {}; 91 const { dataSource = [] } = option || {};
@@ -95,13 +98,17 @@ @@ -95,13 +98,17 @@
95 return { 98 return {
96 dataSource: dataSource?.map((item) => { 99 dataSource: dataSource?.map((item) => {
97 const { unit, showDeviceName, fontColor } = item.componentInfo || {}; 100 const { unit, showDeviceName, fontColor } = item.componentInfo || {};
98 - const { attribute, attributeRename, deviceId, attributeName, deviceName, deviceRename } = 101 + const { attribute, attributeRename, deviceId, deviceName, deviceRename, deviceProfileId } =
99 item; 102 item;
  103 +
  104 + const { functionName } =
  105 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
  106 +
100 return { 107 return {
101 unit: unit ?? presetUnit, 108 unit: unit ?? presetUnit,
102 fontColor: fontColor ?? presetFontColor, 109 fontColor: fontColor ?? presetFontColor,
103 attribute, 110 attribute,
104 - attributeName: attributeRename || attributeName, 111 + attributeName: attributeRename || functionName,
105 showDeviceName, 112 showDeviceName,
106 deviceName: deviceRename || deviceName, 113 deviceName: deviceRename || deviceName,
107 id: deviceId, 114 id: deviceId,