Commit c7b9be41ff657c65da06c2743259b0591a7c0502

Authored by ww
1 parent 7f227582

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

... ... @@ -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,
... ...