Commit c2e3315e3d0307d9beb190f2ad650327bf882206

Authored by xp.Huang
2 parents ea69b5a8 956088c8

Merge branch 'cherry-pick-f2dda9e3' into 'main'

fix: 修复看板部分组件显示的是标识符而不是属性名

See merge request yunteng/thingskit-front!1263
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 import { useDataFetch } from '../../../hook/socket/useSocket'; 9 import { useDataFetch } from '../../../hook/socket/useSocket';
10 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 10 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
11 import { useComponentScale } from '../../../hook/useComponentScale'; 11 import { useComponentScale } from '../../../hook/useComponentScale';
  12 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
12 13
13 const props = defineProps<{ 14 const props = defineProps<{
14 config: ComponentPropsConfigType<typeof option>; 15 config: ComponentPropsConfigType<typeof option>;
@@ -18,9 +19,13 @@ @@ -18,9 +19,13 @@
18 19
19 const time = ref<Nullable<number>>(null); 20 const time = ref<Nullable<number>>(null);
20 21
  22 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  23 +
21 const getDesign = computed(() => { 24 const getDesign = computed(() => {
22 const { option, persetOption } = props.config; 25 const { option, persetOption } = props.config;
23 - const { componentInfo, attribute, attributeName, attributeRename } = option; 26 + const { componentInfo, attribute, attributeRename, deviceProfileId } = option;
  27 + const { functionName } =
  28 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
24 const { flowmeterConfig, unit, fontColor, showTime, maxNumber, valueSize, fontSize } = 29 const { flowmeterConfig, unit, fontColor, showTime, maxNumber, valueSize, fontSize } =
25 componentInfo || {}; 30 componentInfo || {};
26 const { backgroundColor, waveFirst, waveSecond, waveThird } = flowmeterConfig || {}; 31 const { backgroundColor, waveFirst, waveSecond, waveThird } = flowmeterConfig || {};
@@ -46,7 +51,7 @@ @@ -46,7 +51,7 @@
46 waveThird: waveThird ?? presetWaveThird, 51 waveThird: waveThird ?? presetWaveThird,
47 unit: unit ?? persetUnit, 52 unit: unit ?? persetUnit,
48 fontColor: fontColor ?? presetFontColor, 53 fontColor: fontColor ?? presetFontColor,
49 - attribute: attributeRename || attributeName || attribute, 54 + attribute: attributeRename || functionName,
50 showTime: showTime ?? persetShowTime, 55 showTime: showTime ?? persetShowTime,
51 maxNumber: maxNumber ?? persetMaxNumber, 56 maxNumber: maxNumber ?? persetMaxNumber,
52 valueSize: valueSize || persetValueSize || 20, 57 valueSize: valueSize || persetValueSize || 20,
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 import { useDataFetch } from '../../../hook/socket/useSocket'; 9 import { useDataFetch } from '../../../hook/socket/useSocket';
10 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 10 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
11 import { useComponentScale } from '../../../hook/useComponentScale'; 11 import { useComponentScale } from '../../../hook/useComponentScale';
  12 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
12 13
13 const props = defineProps<{ 14 const props = defineProps<{
14 config: ComponentPropsConfigType<typeof option>; 15 config: ComponentPropsConfigType<typeof option>;
@@ -18,9 +19,13 @@ @@ -18,9 +19,13 @@
18 19
19 const time = ref<Nullable<number>>(null); 20 const time = ref<Nullable<number>>(null);
20 21
  22 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  23 +
21 const getDesign = computed(() => { 24 const getDesign = computed(() => {
22 const { option, persetOption } = props.config; 25 const { option, persetOption } = props.config;
23 - const { componentInfo, attribute, attributeName, attributeRename } = option; 26 + const { componentInfo, attribute, attributeRename, deviceProfileId } = option;
  27 + const { functionName } =
  28 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
24 const { flowmeterConfig, unit, fontColor, showTime, maxNumber, fontSize, valueSize } = 29 const { flowmeterConfig, unit, fontColor, showTime, maxNumber, fontSize, valueSize } =
25 componentInfo || {}; 30 componentInfo || {};
26 const { backgroundColor, waveFirst, waveSecond, waveThird } = flowmeterConfig || {}; 31 const { backgroundColor, waveFirst, waveSecond, waveThird } = flowmeterConfig || {};
@@ -46,7 +51,7 @@ @@ -46,7 +51,7 @@
46 waveThird: waveThird ?? presetWaveThird, 51 waveThird: waveThird ?? presetWaveThird,
47 unit: unit ?? persetUnit, 52 unit: unit ?? persetUnit,
48 fontColor: fontColor ?? presetFontColor, 53 fontColor: fontColor ?? presetFontColor,
49 - attribute: attributeRename || attributeName || attribute, 54 + attribute: attributeRename || functionName,
50 showTime: showTime ?? persetShowTime, 55 showTime: showTime ?? persetShowTime,
51 maxNumber: maxNumber ?? persetMaxNumber, 56 maxNumber: maxNumber ?? persetMaxNumber,
52 fontSize: fontSize || persetFontSize || 14, 57 fontSize: fontSize || persetFontSize || 14,
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 import { useDataFetch } from '../../../hook/socket/useSocket'; 9 import { useDataFetch } from '../../../hook/socket/useSocket';
10 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 10 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
11 import { useComponentScale } from '../../../hook/useComponentScale'; 11 import { useComponentScale } from '../../../hook/useComponentScale';
  12 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
12 13
13 const props = defineProps<{ 14 const props = defineProps<{
14 config: ComponentPropsConfigType<typeof option>; 15 config: ComponentPropsConfigType<typeof option>;
@@ -18,6 +19,8 @@ @@ -18,6 +19,8 @@
18 19
19 const time = ref<Nullable<number>>(null); 20 const time = ref<Nullable<number>>(null);
20 21
  22 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  23 +
21 const POSITIVE_NUMBER = 6; 24 const POSITIVE_NUMBER = 6;
22 25
23 const ALL_PART = 7; 26 const ALL_PART = 7;
@@ -66,11 +69,13 @@ @@ -66,11 +69,13 @@
66 fontSize: persetFontSize, 69 fontSize: persetFontSize,
67 valueSize: persetValueSize, 70 valueSize: persetValueSize,
68 } = persetOption || {}; 71 } = persetOption || {};
69 - const { componentInfo, attribute, attributeName, attributeRename } = option || {}; 72 + const { componentInfo, attribute, attributeRename, deviceProfileId } = option || {};
  73 + const { functionName } =
  74 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
70 const { fontColor, showTime, fontSize, valueSize } = componentInfo || {}; 75 const { fontColor, showTime, fontSize, valueSize } = componentInfo || {};
71 return { 76 return {
72 fontColor: fontColor ?? presetFontColor, 77 fontColor: fontColor ?? presetFontColor,
73 - attribute: attributeRename || attributeName || attribute, 78 + attribute: attributeRename || functionName,
74 showTime: showTime ?? persetShowTime, 79 showTime: showTime ?? persetShowTime,
75 fontSize: fontSize || persetFontSize || 14, 80 fontSize: fontSize || persetFontSize || 14,
76 valueSize: valueSize || persetValueSize || 20, 81 valueSize: valueSize || persetValueSize || 20,
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 import { DeviceName } from '/@/views/visual/commonComponents/DeviceName'; 8 import { DeviceName } from '/@/views/visual/commonComponents/DeviceName';
9 import { useDataFetch } from '../../../hook/socket/useSocket'; 9 import { useDataFetch } from '../../../hook/socket/useSocket';
10 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 10 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
  11 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
11 12
12 const props = defineProps<{ 13 const props = defineProps<{
13 config: ComponentPropsConfigType<typeof option>; 14 config: ComponentPropsConfigType<typeof option>;
@@ -17,6 +18,8 @@ @@ -17,6 +18,8 @@
17 18
18 const time = ref<Nullable<number>>(null); 19 const time = ref<Nullable<number>>(null);
19 20
  21 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  22 +
20 const integerPart = computed(() => { 23 const integerPart = computed(() => {
21 let number = unref(currentValue); 24 let number = unref(currentValue);
22 const max = 5; 25 const max = 5;
@@ -48,7 +51,9 @@ @@ -48,7 +51,9 @@
48 51
49 const getDesign = computed(() => { 52 const getDesign = computed(() => {
50 const { option, persetOption } = props.config; 53 const { option, persetOption } = props.config;
51 - const { componentInfo, attribute, attributeRename, attributeName } = option; 54 + const { componentInfo, attribute, attributeRename, deviceProfileId } = option;
  55 + const { functionName } =
  56 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
52 const { 57 const {
53 fontColor: presetFontColor, 58 fontColor: presetFontColor,
54 unit: presetUnit, 59 unit: presetUnit,
@@ -58,7 +63,7 @@ @@ -58,7 +63,7 @@
58 return { 63 return {
59 unit: unit ?? presetUnit, 64 unit: unit ?? presetUnit,
60 fontColor: fontColor ?? presetFontColor, 65 fontColor: fontColor ?? presetFontColor,
61 - attribute: attributeRename || attributeName || attribute, 66 + attribute: attributeRename || functionName,
62 showTime: showTime ?? persetShowTime, 67 showTime: showTime ?? persetShowTime,
63 }; 68 };
64 }); 69 });
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 import { DeviceName } from '/@/views/visual/commonComponents/DeviceName'; 10 import { DeviceName } from '/@/views/visual/commonComponents/DeviceName';
11 import { useDataFetch } from '../../../hook/socket/useSocket'; 11 import { useDataFetch } from '../../../hook/socket/useSocket';
12 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 12 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
  13 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
13 14
14 const props = defineProps<{ 15 const props = defineProps<{
15 config: ComponentPropsConfigType<typeof option>; 16 config: ComponentPropsConfigType<typeof option>;
@@ -21,9 +22,13 @@ @@ -21,9 +22,13 @@
21 22
22 const time = ref<Nullable<number>>(null); 23 const time = ref<Nullable<number>>(null);
23 24
  25 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  26 +
24 const getDesign = computed(() => { 27 const getDesign = computed(() => {
25 const { option, persetOption } = props.config; 28 const { option, persetOption } = props.config;
26 - const { componentInfo, attribute, attributeRename, attributeName } = option; 29 + const { componentInfo, attribute, deviceProfileId, attributeRename } = option;
  30 + const { functionName } =
  31 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
27 const { 32 const {
28 fontColor: presetFontColor, 33 fontColor: presetFontColor,
29 unit: presetUnit, 34 unit: presetUnit,
@@ -49,7 +54,7 @@ @@ -49,7 +54,7 @@
49 return { 54 return {
50 unit: unit ?? presetUnit, 55 unit: unit ?? presetUnit,
51 fontColor: fontColor ?? presetFontColor, 56 fontColor: fontColor ?? presetFontColor,
52 - attribute: attributeRename || attributeName || attribute, 57 + attribute: attributeRename || functionName,
53 pointerColor: pointerColor ?? presetPointerColor, 58 pointerColor: pointerColor ?? presetPointerColor,
54 instrumentPanelColor: instrumentPanelColor ?? presetInstrumentPanelColor, 59 instrumentPanelColor: instrumentPanelColor ?? presetInstrumentPanelColor,
55 gradientInfo: gradientInfo ?? presetGradientInfo, 60 gradientInfo: gradientInfo ?? presetGradientInfo,
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 import { useComponentScale } from '/@/views/visual/packages/hook/useComponentScale'; 10 import { useComponentScale } from '/@/views/visual/packages/hook/useComponentScale';
11 import { useDataFetch } from '../../../hook/socket/useSocket'; 11 import { useDataFetch } from '../../../hook/socket/useSocket';
12 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 12 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
  13 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
13 14
14 const props = defineProps<{ 15 const props = defineProps<{
15 config: ComponentPropsConfigType<typeof option>; 16 config: ComponentPropsConfigType<typeof option>;
@@ -21,9 +22,13 @@ @@ -21,9 +22,13 @@
21 22
22 const time = ref<Nullable<number>>(null); 23 const time = ref<Nullable<number>>(null);
23 24
  25 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  26 +
24 const getDesign = computed(() => { 27 const getDesign = computed(() => {
25 const { option, persetOption } = props.config; 28 const { option, persetOption } = props.config;
26 - const { componentInfo, attribute, attributeRename, attributeName } = option; 29 + const { componentInfo, attribute, attributeRename, deviceProfileId } = option;
  30 + const { functionName } =
  31 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
27 const { 32 const {
28 fontColor: presetFontColor, 33 fontColor: presetFontColor,
29 unit: presetUnit, 34 unit: presetUnit,
@@ -51,7 +56,7 @@ @@ -51,7 +56,7 @@
51 return { 56 return {
52 unit: unit ?? presetUnit, 57 unit: unit ?? presetUnit,
53 fontColor: fontColor ?? presetFontColor, 58 fontColor: fontColor ?? presetFontColor,
54 - attribute: attributeRename || attributeName || attribute, 59 + attribute: attributeRename || functionName,
55 pointerColor: pointerColor ?? presetPointerColor, 60 pointerColor: pointerColor ?? presetPointerColor,
56 instrumentPanelColor: instrumentPanelColor ?? presetInstrumentPanelColor, 61 instrumentPanelColor: instrumentPanelColor ?? presetInstrumentPanelColor,
57 progressBarCircle: progressBarCircle ?? presetProgressBarCircle, 62 progressBarCircle: progressBarCircle ?? presetProgressBarCircle,
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 import { useReceiveValue } from '../../../hook/useReceiveValue'; 10 import { useReceiveValue } from '../../../hook/useReceiveValue';
11 import { MultipleDataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 11 import { MultipleDataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
12 import { useMultipleDataFetch } from '../../../hook/socket/useSocket'; 12 import { useMultipleDataFetch } from '../../../hook/socket/useSocket';
  13 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
13 14
14 const props = defineProps<{ 15 const props = defineProps<{
15 config: ComponentPropsConfigType<typeof option>; 16 config: ComponentPropsConfigType<typeof option>;
@@ -19,6 +20,8 @@ @@ -19,6 +20,8 @@
19 20
20 const chartInstance = ref<Nullable<ECharts>>(null); 21 const chartInstance = ref<Nullable<ECharts>>(null);
21 22
  23 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  24 +
22 // const time = ref<Nullable<number>>(null); 25 // const time = ref<Nullable<number>>(null);
23 26
24 const getDesign = computed(() => { 27 const getDesign = computed(() => {
@@ -32,17 +35,18 @@ @@ -32,17 +35,18 @@
32 return { 35 return {
33 dataSource: dataSource.map((item) => { 36 dataSource: dataSource.map((item) => {
34 const { unit, fontColor, showDeviceName } = item.componentInfo || {}; 37 const { unit, fontColor, showDeviceName } = item.componentInfo || {};
35 - const { deviceName, deviceRename, attribute, attributeRename, deviceId, attributeName } = 38 + const { deviceName, deviceRename, attribute, attributeRename, deviceId, deviceProfileId } =
36 item; 39 item;
  40 + const { functionName } =
  41 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
37 return { 42 return {
38 unit: unit ?? presetUnit, 43 unit: unit ?? presetUnit,
39 fontColor: fontColor ?? presetFontColor, 44 fontColor: fontColor ?? presetFontColor,
40 attribute, 45 attribute,
41 - attributeRename,  
42 showDeviceName: showDeviceName ?? presetShowDeviceName, 46 showDeviceName: showDeviceName ?? presetShowDeviceName,
43 deviceName, 47 deviceName,
44 deviceRename, 48 deviceRename,
45 - attributeName, 49 + attributeName: attributeRename || functionName,
46 id: deviceId, 50 id: deviceId,
47 }; 51 };
48 }), 52 }),
@@ -144,7 +148,7 @@ @@ -144,7 +148,7 @@
144 unref(getDesign).dataSource.map((item, index) => ({ 148 unref(getDesign).dataSource.map((item, index) => ({
145 value: 30, 149 value: 30,
146 name: `${item.showDeviceName ? `${item.deviceRename || item.deviceName}-` : ''}${ 150 name: `${item.showDeviceName ? `${item.deviceRename || item.deviceName}-` : ''}${
147 - item.attributeRename || item.attributeName || item.attribute 151 + item.attributeName
148 }`, 152 }`,
149 attribute: item.attribute, 153 attribute: item.attribute,
150 id: item.id, 154 id: item.id,
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 import { DeviceName } from '/@/views/visual/commonComponents/DeviceName'; 9 import { DeviceName } from '/@/views/visual/commonComponents/DeviceName';
10 import { useDataFetch } from '../../../hook/socket/useSocket'; 10 import { useDataFetch } from '../../../hook/socket/useSocket';
11 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 11 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
  12 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
12 13
13 const props = defineProps<{ 14 const props = defineProps<{
14 config: ComponentPropsConfigType<typeof option>; 15 config: ComponentPropsConfigType<typeof option>;
@@ -20,9 +21,13 @@ @@ -20,9 +21,13 @@
20 21
21 const time = ref<Nullable<number>>(null); 22 const time = ref<Nullable<number>>(null);
22 23
  24 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  25 +
23 const getDesign = computed(() => { 26 const getDesign = computed(() => {
24 const { option, persetOption } = props.config; 27 const { option, persetOption } = props.config;
25 - const { componentInfo, attribute, attributeRename, attributeName } = option; 28 + const { componentInfo, attribute, attributeRename, deviceProfileId } = option;
  29 + const { functionName } =
  30 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
26 const { 31 const {
27 fontColor: presetFontColor, 32 fontColor: presetFontColor,
28 unit: presetUnit, 33 unit: presetUnit,
@@ -48,7 +53,7 @@ @@ -48,7 +53,7 @@
48 return { 53 return {
49 unit: unit ?? presetUnit, 54 unit: unit ?? presetUnit,
50 fontColor: fontColor ?? presetFontColor, 55 fontColor: fontColor ?? presetFontColor,
51 - attribute: attributeRename || attributeName || attribute, 56 + attribute: attributeRename || functionName,
52 pointerColor: pointerColor ?? presetPointerColor, 57 pointerColor: pointerColor ?? presetPointerColor,
53 instrumentPanelColor: instrumentPanelColor ?? presetInstrumentPanelColor, 58 instrumentPanelColor: instrumentPanelColor ?? presetInstrumentPanelColor,
54 gradientInfo: gradientInfo ?? presetGradientInfo, 59 gradientInfo: gradientInfo ?? presetGradientInfo,
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 import { DeviceName } from '/@/views/visual/commonComponents/DeviceName'; 13 import { DeviceName } from '/@/views/visual/commonComponents/DeviceName';
14 import { useDataFetch } from '../../../hook/socket/useSocket'; 14 import { useDataFetch } from '../../../hook/socket/useSocket';
15 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 15 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
  16 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
16 17
17 const props = defineProps<{ 18 const props = defineProps<{
18 config: ComponentPropsConfigType<typeof option>; 19 config: ComponentPropsConfigType<typeof option>;
@@ -24,9 +25,13 @@ @@ -24,9 +25,13 @@
24 25
25 const time = ref<Nullable<number>>(null); 26 const time = ref<Nullable<number>>(null);
26 27
  28 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  29 +
27 const getDesign = computed(() => { 30 const getDesign = computed(() => {
28 const { option, persetOption } = props.config; 31 const { option, persetOption } = props.config;
29 - const { componentInfo, attribute, attributeRename, attributeName } = option; 32 + const { componentInfo, attribute, attributeRename, deviceProfileId } = option;
  33 + const { functionName } =
  34 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
30 const { 35 const {
31 fontColor: presetFontColor, 36 fontColor: presetFontColor,
32 unit: presetUnit, 37 unit: presetUnit,
@@ -39,7 +44,7 @@ @@ -39,7 +44,7 @@
39 return { 44 return {
40 unit: unit ?? presetUnit, 45 unit: unit ?? presetUnit,
41 fontColor: fontColor ?? presetFontColor, 46 fontColor: fontColor ?? presetFontColor,
42 - attribute: attributeRename || attributeName || attribute, 47 + attribute: attributeRename || functionName,
43 showTime: persetShowTime || showTime, 48 showTime: persetShowTime || showTime,
44 maxNumber: maxNumber || persetMaxNumber, 49 maxNumber: maxNumber || persetMaxNumber,
45 valueSize: valueSize || persetValueSize || 14, 50 valueSize: valueSize || persetValueSize || 14,
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 import { DeviceName } from '/@/views/visual/commonComponents/DeviceName'; 12 import { DeviceName } from '/@/views/visual/commonComponents/DeviceName';
13 import { useDataFetch } from '../../../hook/socket/useSocket'; 13 import { useDataFetch } from '../../../hook/socket/useSocket';
14 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 14 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
  15 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
15 16
16 const props = defineProps<{ 17 const props = defineProps<{
17 config: ComponentPropsConfigType<typeof option>; 18 config: ComponentPropsConfigType<typeof option>;
@@ -28,10 +29,13 @@ @@ -28,10 +29,13 @@
28 29
29 const chartInstance = ref<Nullable<ECharts>>(null); 30 const chartInstance = ref<Nullable<ECharts>>(null);
30 31
  32 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  33 +
31 const getDesign = computed(() => { 34 const getDesign = computed(() => {
32 const { option, persetOption } = props.config; 35 const { option, persetOption } = props.config;
33 - const { componentInfo, attributeRename, attribute, attributeName } = option;  
34 - 36 + const { componentInfo, attributeRename, attribute, deviceProfileId } = option;
  37 + const { functionName } =
  38 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
35 const { 39 const {
36 fontColor: presetFontColor, 40 fontColor: presetFontColor,
37 unit: presetUnit, 41 unit: presetUnit,
@@ -48,7 +52,7 @@ @@ -48,7 +52,7 @@
48 unit: unit ?? presetUnit, 52 unit: unit ?? presetUnit,
49 fontColor: fontColor ?? presetFontColor, 53 fontColor: fontColor ?? presetFontColor,
50 gradientInfo: gradientInfo ?? presetGradientInfo, 54 gradientInfo: gradientInfo ?? presetGradientInfo,
51 - attribute: attributeRename || attributeName || attribute, 55 + attribute: attributeRename || functionName,
52 showTime: showTime || persetShowTime, 56 showTime: showTime || persetShowTime,
53 maxNumber: maxNumber || persetMaxNumber, 57 maxNumber: maxNumber || persetMaxNumber,
54 fontSize: fontSize || persetFontSize || 14, 58 fontSize: fontSize || persetFontSize || 14,
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 import { UpdateTime } from '/@/views/visual/commonComponents/UpdateTime'; 10 import { UpdateTime } from '/@/views/visual/commonComponents/UpdateTime';
11 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 11 import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
12 import { useDataFetch } from '../../../hook/socket/useSocket'; 12 import { useDataFetch } from '../../../hook/socket/useSocket';
  13 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
13 14
14 const props = defineProps<{ 15 const props = defineProps<{
15 config: ComponentPropsConfigType<typeof option>; 16 config: ComponentPropsConfigType<typeof option>;
@@ -18,6 +19,8 @@ @@ -18,6 +19,8 @@
18 const isOpenClose = ref<boolean>(true); 19 const isOpenClose = ref<boolean>(true);
19 const time = ref<Nullable<number>>(null); 20 const time = ref<Nullable<number>>(null);
20 21
  22 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  23 +
21 const getDesign = computed(() => { 24 const getDesign = computed(() => {
22 const { persetOption = {}, option } = props.config; 25 const { persetOption = {}, option } = props.config;
23 const { 26 const {
@@ -27,14 +30,16 @@ @@ -27,14 +30,16 @@
27 showTime: persetShowTime, 30 showTime: persetShowTime,
28 fontSize: persetFontSize, 31 fontSize: persetFontSize,
29 } = persetOption || {}; 32 } = persetOption || {};
30 - const { componentInfo, attribute, attributeName, attributeRename } = option; 33 + const { componentInfo, attribute, attributeRename, deviceProfileId } = option;
  34 + const { functionName } =
  35 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
31 36
32 const { openColor, closeColor, showDeviceName, showTime, fontSize } = componentInfo || {}; 37 const { openColor, closeColor, showDeviceName, showTime, fontSize } = componentInfo || {};
33 return { 38 return {
34 openColor: openColor ?? persetOpenColor, 39 openColor: openColor ?? persetOpenColor,
35 closeColor: closeColor ?? persetCloseColor, 40 closeColor: closeColor ?? persetCloseColor,
36 showDeviceName: showDeviceName ?? persetShowDeviceName, 41 showDeviceName: showDeviceName ?? persetShowDeviceName,
37 - attribute: attributeRename || attributeName || attribute, 42 + attribute: attributeRename || functionName,
38 showTime: showTime ?? persetShowTime, 43 showTime: showTime ?? persetShowTime,
39 fontSize: fontSize || persetFontSize || 14, 44 fontSize: fontSize || persetFontSize || 14,
40 }; 45 };
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 import { useReceiveValue } from '../../../hook/useReceiveValue'; 10 import { useReceiveValue } from '../../../hook/useReceiveValue';
11 import { useMultipleDataFetch } from '../../../hook/socket/useSocket'; 11 import { useMultipleDataFetch } from '../../../hook/socket/useSocket';
12 import { MultipleDataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 12 import { MultipleDataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
  13 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
13 14
14 const props = defineProps<{ 15 const props = defineProps<{
15 config: ComponentPropsConfigType<typeof option>; 16 config: ComponentPropsConfigType<typeof option>;
@@ -21,6 +22,8 @@ @@ -21,6 +22,8 @@
21 22
22 const time = ref<Nullable<number>>(null); 23 const time = ref<Nullable<number>>(null);
23 24
  25 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  26 +
24 const getDesign = computed(() => { 27 const getDesign = computed(() => {
25 const { persetOption, option } = props.config; 28 const { persetOption, option } = props.config;
26 const { dataSource = [] } = option || {}; 29 const { dataSource = [] } = option || {};
@@ -32,14 +35,15 @@ @@ -32,14 +35,15 @@
32 return { 35 return {
33 dataSource: dataSource?.map((item) => { 36 dataSource: dataSource?.map((item) => {
34 const { unit, fontColor, showDeviceName } = item.componentInfo || {}; 37 const { unit, fontColor, showDeviceName } = item.componentInfo || {};
35 - const { attribute, attributeName, attributeRename, deviceId, deviceName, deviceRename } = 38 + const { attribute, attributeRename, deviceId, deviceName, deviceRename, deviceProfileId } =
36 item; 39 item;
  40 + const { functionName } =
  41 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
37 return { 42 return {
38 unit: unit ?? presetUnit, 43 unit: unit ?? presetUnit,
39 fontColor: fontColor ?? presetFontColor, 44 fontColor: fontColor ?? presetFontColor,
40 attribute, 45 attribute,
41 - attributeName,  
42 - attributeRename, 46 + attributeName: attributeRename || functionName,
43 deviceName, 47 deviceName,
44 deviceRename, 48 deviceRename,
45 showDeviceName: showDeviceName ?? persetShowDeviceName, 49 showDeviceName: showDeviceName ?? persetShowDeviceName,
@@ -122,7 +126,7 @@ @@ -122,7 +126,7 @@
122 unref(getDesign).dataSource.map((item) => ({ 126 unref(getDesign).dataSource.map((item) => ({
123 value: 0, 127 value: 0,
124 name: `${item.showDeviceName ? `${item.deviceRename || item.deviceName}-` : ''}${ 128 name: `${item.showDeviceName ? `${item.deviceRename || item.deviceName}-` : ''}${
125 - item.attributeRename || item.attributeName || item.attribute 129 + item.attributeName
126 }`, 130 }`,
127 attribute: item.attribute, 131 attribute: item.attribute,
128 id: item.id, 132 id: item.id,
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 import { useReceiveValue } from '../../../hook/useReceiveValue'; 10 import { useReceiveValue } from '../../../hook/useReceiveValue';
11 import { useMultipleDataFetch } from '../../../hook/socket/useSocket'; 11 import { useMultipleDataFetch } from '../../../hook/socket/useSocket';
12 import { MultipleDataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; 12 import { MultipleDataFetchUpdateFn } from '../../../hook/socket/useSocket.type';
  13 + import { useDeviceProfileQueryContext } from '/@/views/visual/palette/hooks/useDeviceProfileQueryContext';
13 14
14 const props = defineProps<{ 15 const props = defineProps<{
15 config: ComponentPropsConfigType<typeof option>; 16 config: ComponentPropsConfigType<typeof option>;
@@ -21,6 +22,8 @@ @@ -21,6 +22,8 @@
21 22
22 const time = ref<Nullable<number>>(null); 23 const time = ref<Nullable<number>>(null);
23 24
  25 + const { getDeviceProfileTslByIdWithIdentifier } = useDeviceProfileQueryContext();
  26 +
24 const getDesign = computed(() => { 27 const getDesign = computed(() => {
25 const { persetOption, option } = props.config; 28 const { persetOption, option } = props.config;
26 const { dataSource = [] } = option || {}; 29 const { dataSource = [] } = option || {};
@@ -32,14 +35,15 @@ @@ -32,14 +35,15 @@
32 return { 35 return {
33 dataSource: dataSource?.map((item) => { 36 dataSource: dataSource?.map((item) => {
34 const { unit, fontColor, showDeviceName } = item.componentInfo || {}; 37 const { unit, fontColor, showDeviceName } = item.componentInfo || {};
35 - const { attribute, attributeName, attributeRename, deviceId, deviceName, deviceRename } = 38 + const { attribute, attributeRename, deviceId, deviceName, deviceRename, deviceProfileId } =
36 item; 39 item;
  40 + const { functionName } =
  41 + getDeviceProfileTslByIdWithIdentifier?.(deviceProfileId, attribute) || {};
37 return { 42 return {
38 unit: unit ?? presetUnit, 43 unit: unit ?? presetUnit,
39 fontColor: fontColor ?? presetFontColor, 44 fontColor: fontColor ?? presetFontColor,
40 attribute, 45 attribute,
41 - attributeName,  
42 - attributeRename, 46 + attributeName: attributeRename || functionName,
43 deviceName, 47 deviceName,
44 deviceRename, 48 deviceRename,
45 showDeviceName: showDeviceName ?? persetShowDeviceName, 49 showDeviceName: showDeviceName ?? persetShowDeviceName,
@@ -124,7 +128,7 @@ @@ -124,7 +128,7 @@
124 unref(getDesign).dataSource.map((item) => ({ 128 unref(getDesign).dataSource.map((item) => ({
125 value: 0, 129 value: 0,
126 name: `${item.showDeviceName ? `${item.deviceRename || item.deviceName}-` : ''}${ 130 name: `${item.showDeviceName ? `${item.deviceRename || item.deviceName}-` : ''}${
127 - item.attributeRename || item.attributeName || item.attribute 131 + item.attributeName
128 }`, 132 }`,
129 attribute: item.attribute, 133 attribute: item.attribute,
130 id: item.id, 134 id: item.id,
@@ -41,7 +41,8 @@ @@ -41,7 +41,8 @@
41 fontSize: persetFontSize, 41 fontSize: persetFontSize,
42 } = persetOption; 42 } = persetOption;
43 43
44 - const { componentInfo, attribute, attributeRename, attributeName } = option; 44 + const { componentInfo, attributeRename } = option;
  45 + const { functionName } = unref(getThingModelTsl) || {};
45 46
46 const { icon, iconColor, fontColor, unit, valueSize, fontSize } = componentInfo || {}; 47 const { icon, iconColor, fontColor, unit, valueSize, fontSize } = componentInfo || {};
47 return { 48 return {
@@ -49,7 +50,7 @@ @@ -49,7 +50,7 @@
49 unit: unit ?? perseUnit, 50 unit: unit ?? perseUnit,
50 icon: icon || persetIcon, 51 icon: icon || persetIcon,
51 fontColor: fontColor || persetFontColor, 52 fontColor: fontColor || persetFontColor,
52 - attribute: attributeRename || attributeName || attribute, 53 + attribute: attributeRename || functionName,
53 valueSize: valueSize || persetValueSize || 20, 54 valueSize: valueSize || persetValueSize || 20,
54 fontSize: fontSize || persetFontSize || 14, 55 fontSize: fontSize || persetFontSize || 14,
55 }; 56 };