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