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