Showing
14 changed files
with
145 additions
and
73 deletions
@@ -33,6 +33,7 @@ | @@ -33,6 +33,7 @@ | ||
33 | service: value.service, | 33 | service: value.service, |
34 | command: value.command, | 34 | command: value.command, |
35 | commandType: value.commandType, | 35 | commandType: value.commandType, |
36 | + callType: value.callType, | ||
36 | }, | 37 | }, |
37 | }; | 38 | }; |
38 | return value; | 39 | return value; |
@@ -42,10 +43,11 @@ | @@ -42,10 +43,11 @@ | ||
42 | const { customCommand } = record; | 43 | const { customCommand } = record; |
43 | return setFieldsValue({ | 44 | return setFieldsValue({ |
44 | ...record, | 45 | ...record, |
45 | - transportType: customCommand?.transportType, | ||
46 | - service: customCommand?.service, | ||
47 | - command: customCommand?.command, | ||
48 | - commandType: customCommand?.commandType, | 46 | + transportType: customCommand?.transportType || (record as Recordable).transportType, |
47 | + service: customCommand?.service || (record as Recordable).service, | ||
48 | + command: customCommand?.command || (record as Recordable).command, | ||
49 | + commandType: customCommand?.commandType || (record as Recordable).commandType, | ||
50 | + callType: customCommand?.callType || (record as Recordable).callType, | ||
49 | } as unknown as Partial<CommonDataSourceBindValueType>); | 51 | } as unknown as Partial<CommonDataSourceBindValueType>); |
50 | }; | 52 | }; |
51 | 53 |
@@ -10,17 +10,19 @@ | @@ -10,17 +10,19 @@ | ||
10 | import { DeviceName } from '/@/views/visual/commonComponents/DeviceName'; | 10 | import { DeviceName } from '/@/views/visual/commonComponents/DeviceName'; |
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 { useReceiveMessage } from '../../../hook/useReceiveMessage'; | ||
14 | + import { useReceiveValue } from '../../../hook/useReceiveValue'; | ||
15 | + import { DataSource } from '/@/views/visual/palette/types'; | ||
13 | 16 | ||
14 | const props = defineProps<{ | 17 | const props = defineProps<{ |
15 | config: ComponentPropsConfigType<typeof option>; | 18 | config: ComponentPropsConfigType<typeof option>; |
16 | }>(); | 19 | }>(); |
17 | 20 | ||
18 | - const checked = ref(false); | ||
19 | - | ||
20 | const svgList = ref<any>([ | 21 | const svgList = ref<any>([ |
21 | { | 22 | { |
22 | value: 26.2, | 23 | value: 26.2, |
23 | - name: 'wendu', | 24 | + deviceName: '光照设备', |
25 | + attributeName: '光照', | ||
24 | icon: 'zongfushe', | 26 | icon: 'zongfushe', |
25 | unit: 'kw', | 27 | unit: 'kw', |
26 | iconColor: '#367BFF', | 28 | iconColor: '#367BFF', |
@@ -30,7 +32,8 @@ | @@ -30,7 +32,8 @@ | ||
30 | }, | 32 | }, |
31 | { | 33 | { |
32 | value: 53.7, | 34 | value: 53.7, |
33 | - name: 'shidu', | 35 | + deviceName: '风机设备', |
36 | + attributeName: '风机', | ||
34 | icon: 'guangzhaoqiangdu', | 37 | icon: 'guangzhaoqiangdu', |
35 | unit: '℃', | 38 | unit: '℃', |
36 | iconColor: '#FFA000', | 39 | iconColor: '#FFA000', |
@@ -41,6 +44,7 @@ | @@ -41,6 +44,7 @@ | ||
41 | ]); | 44 | ]); |
42 | 45 | ||
43 | const getDesign = computed(() => { | 46 | const getDesign = computed(() => { |
47 | + console.log(props.config.option, 'option'); | ||
44 | const { persetOption = {}, option } = props.config; | 48 | const { persetOption = {}, option } = props.config; |
45 | const { dataSource = [] } = option || {}; | 49 | const { dataSource = [] } = option || {}; |
46 | const { | 50 | const { |
@@ -51,42 +55,65 @@ | @@ -51,42 +55,65 @@ | ||
51 | } = persetOption || {}; | 55 | } = persetOption || {}; |
52 | return { | 56 | return { |
53 | dataSource: dataSource.map((item) => { | 57 | dataSource: dataSource.map((item) => { |
54 | - const { fontColor, icon, iconColor, unit } = item.componentInfo; | ||
55 | - const { attribute, attributeRename } = item; | 58 | + const { fontColor, icon, iconColor, unit, showDeviceName } = item.componentInfo; |
59 | + const { attribute, attributeRename, attributeName, deviceId, deviceName, deviceRename } = | ||
60 | + item; | ||
56 | return { | 61 | return { |
57 | unit: unit ?? persetUnit, | 62 | unit: unit ?? persetUnit, |
58 | fontColor: fontColor ?? persetFontColor, | 63 | fontColor: fontColor ?? persetFontColor, |
59 | icon: icon ?? persetIcon, | 64 | icon: icon ?? persetIcon, |
60 | iconColor: iconColor ?? persetIconColor, | 65 | iconColor: iconColor ?? persetIconColor, |
61 | - attribute: attribute || attributeRename, | ||
62 | - attributeRename, | 66 | + attribute: attribute, |
67 | + attributeName: attributeRename ?? attributeName, | ||
68 | + showDeviceName, | ||
69 | + deviceName: deviceRename ?? deviceName, | ||
70 | + id: deviceId, | ||
63 | }; | 71 | }; |
64 | }), | 72 | }), |
65 | }; | 73 | }; |
66 | }); | 74 | }); |
67 | 75 | ||
68 | - const { sendCommand, loading } = useSendCommand(); | ||
69 | - const handleChange = async (index: number) => { | ||
70 | - const flag = await sendCommand(props.config.option, unref(checked)); | ||
71 | - if (!flag) svgList[index].checked = !svgList[index].checked; | 76 | + const { loading, sendCommand } = useSendCommand(); |
77 | + const handleChange = async (index: number, checked: Boolean) => { | ||
78 | + console.log(props.config.option); | ||
79 | + const { heightPx, itemHeightRatio, itemWidthRatio, mode, widthPx, dataSource } = | ||
80 | + props.config.option; | ||
81 | + | ||
82 | + const data = { | ||
83 | + ...dataSource?.[index], | ||
84 | + heightPx, | ||
85 | + itemHeightRatio, | ||
86 | + itemWidthRatio, | ||
87 | + mode, | ||
88 | + widthPx, | ||
89 | + } as DataSource; | ||
90 | + console.log(data, 'data', checked); | ||
91 | + | ||
92 | + const flag = await sendCommand(data, checked); | ||
93 | + if (!flag) controlList.value[index].checked = !checked; | ||
72 | }; | 94 | }; |
73 | 95 | ||
74 | - const updateFn: MultipleDataFetchUpdateFn = (message) => { | ||
75 | - const { data = {} } = message; | ||
76 | - const { dataSource } = unref(getDesign); | ||
77 | - svgList.value.length = 0; | ||
78 | - svgList.value = dataSource.map((item) => { | ||
79 | - const { icon, iconColor, unit, fontColor, attribute } = item || {}; | ||
80 | - const [latest] = data[attribute] || []; | ||
81 | - const [_timespan, value] = latest || []; | ||
82 | - return { | ||
83 | - value: Number(value), | ||
84 | - name: attribute, | ||
85 | - icon, | ||
86 | - unit, | ||
87 | - iconColor, | ||
88 | - fontColor, | ||
89 | - }; | 96 | + const { forEachGroupMessage } = useReceiveMessage(); |
97 | + const { getNumberValue } = useReceiveValue(); | ||
98 | + | ||
99 | + const controlList = ref( | ||
100 | + props.config.option.dataSource | ||
101 | + ? unref(getDesign).dataSource.map((item) => { | ||
102 | + return { ...item, checked: false }; | ||
103 | + }) | ||
104 | + : svgList | ||
105 | + ); | ||
106 | + | ||
107 | + const updateFn: MultipleDataFetchUpdateFn = async (message, deviceId, attribute) => { | ||
108 | + console.log(unref(getDesign).dataSource, 'dataSource'); | ||
109 | + | ||
110 | + forEachGroupMessage(message, deviceId, attribute, (attribute, value, time) => { | ||
111 | + console.log(attribute, value, time); | ||
112 | + controlList.value.forEach((item) => { | ||
113 | + if (item.id === deviceId && item.attribute === attribute) { | ||
114 | + item.checked = Boolean(getNumberValue(value)); | ||
115 | + } | ||
116 | + }); | ||
90 | }); | 117 | }); |
91 | }; | 118 | }; |
92 | 119 | ||
@@ -99,7 +126,7 @@ | @@ -99,7 +126,7 @@ | ||
99 | <DeviceName :config="config" /> | 126 | <DeviceName :config="config" /> |
100 | <div | 127 | <div |
101 | style="width: 86%" | 128 | style="width: 86%" |
102 | - v-for="(item, index) in svgList" | 129 | + v-for="(item, index) in controlList" |
103 | :key="item.id" | 130 | :key="item.id" |
104 | class="flex justify-between items-center" | 131 | class="flex justify-between items-center" |
105 | > | 132 | > |
@@ -111,10 +138,18 @@ | @@ -111,10 +138,18 @@ | ||
111 | :style="{ color: item.iconColor }" | 138 | :style="{ color: item.iconColor }" |
112 | /> | 139 | /> |
113 | 140 | ||
114 | - <div class="text-gray-500 text-lg truncate ml-6">{{ item.attribute || '温度' }}</div> | 141 | + <div |
142 | + class="text-gray-500 truncate ml-6" | ||
143 | + :style="{ fontSize: getRatio ? '18px' : getRatio * 18 + 'px' }" | ||
144 | + >{{ `${item.deviceName} - ${item.attributeName}` }}</div | ||
145 | + > | ||
115 | </div> | 146 | </div> |
116 | 147 | ||
117 | - <Switch v-model:checked="item.checked" :loading="loading" @change="handleChange(index)" /> | 148 | + <Switch |
149 | + v-model:checked="item.checked" | ||
150 | + :loading="loading" | ||
151 | + @change="handleChange(index, item.checked)" | ||
152 | + /> | ||
118 | </div> | 153 | </div> |
119 | </main> | 154 | </main> |
120 | </template> | 155 | </template> |
@@ -2,12 +2,12 @@ import { ControlComponentSlidingSwitchConfig } from './ControlComponentSlidingSw | @@ -2,12 +2,12 @@ import { ControlComponentSlidingSwitchConfig } from './ControlComponentSlidingSw | ||
2 | import { ControlComponentSwitchWithIconConfig } from './ControlComponentSwitchWithIcon'; | 2 | import { ControlComponentSwitchWithIconConfig } from './ControlComponentSwitchWithIcon'; |
3 | import { ControlComponentToggleSwitchConfig } from './ControlComponentToggleSwitch'; | 3 | import { ControlComponentToggleSwitchConfig } from './ControlComponentToggleSwitch'; |
4 | import { LateralNumericalControlConfig } from './LateralNumericalControl'; | 4 | import { LateralNumericalControlConfig } from './LateralNumericalControl'; |
5 | -// import { SwitchListConfig } from './SwitchList'; | 5 | +import { SwitchListConfig } from './SwitchList'; |
6 | 6 | ||
7 | export const ControlList = [ | 7 | export const ControlList = [ |
8 | ControlComponentSwitchWithIconConfig, | 8 | ControlComponentSwitchWithIconConfig, |
9 | ControlComponentSlidingSwitchConfig, | 9 | ControlComponentSlidingSwitchConfig, |
10 | ControlComponentToggleSwitchConfig, | 10 | ControlComponentToggleSwitchConfig, |
11 | LateralNumericalControlConfig, | 11 | LateralNumericalControlConfig, |
12 | - // SwitchListConfig, | 12 | + SwitchListConfig, |
13 | ]; | 13 | ]; |
@@ -63,14 +63,16 @@ | @@ -63,14 +63,16 @@ | ||
63 | <main :style="getScale" class="w-full h-full flex flex-col justify-center items-center"> | 63 | <main :style="getScale" class="w-full h-full flex flex-col justify-center items-center"> |
64 | <DeviceName :config="config" class="text-center" /> | 64 | <DeviceName :config="config" class="text-center" /> |
65 | 65 | ||
66 | - <div | ||
67 | - :style="{ | ||
68 | - '--open-color': getDesign.openColor, | ||
69 | - '--close-color': getDesign.closeColor, | ||
70 | - }" | ||
71 | - :class="isOpenClose ? 'switch_open' : 'switch_close'" | ||
72 | - ></div> | ||
73 | - <div class="text-gray-500 text-sm truncate">{{ getDesign.attribute }}</div> | 66 | + <div class="flex-1 flex justify-center items-center flex-col"> |
67 | + <div | ||
68 | + :style="{ | ||
69 | + '--open-color': getDesign.openColor, | ||
70 | + '--close-color': getDesign.closeColor, | ||
71 | + }" | ||
72 | + :class="isOpenClose ? 'switch_open' : 'switch_close'" | ||
73 | + ></div> | ||
74 | + <div class="text-gray-500 text-sm truncate">{{ getDesign.attribute }}</div> | ||
75 | + </div> | ||
74 | <UpdateTime :time="time" /> | 76 | <UpdateTime :time="time" /> |
75 | </main> | 77 | </main> |
76 | </template> | 78 | </template> |
src/views/visual/packages/components/Other/SwitchStatus/config.ts
renamed from
src/views/visual/packages/components/Text/SwitchStatus/config.ts
@@ -10,9 +10,9 @@ import { PublicConfigClass, componentInitConfig } from '/@/views/visual/packages | @@ -10,9 +10,9 @@ import { PublicConfigClass, componentInitConfig } from '/@/views/visual/packages | ||
10 | import { ComponentConfigFieldEnum } from '/@/views/visual/packages/enum'; | 10 | import { ComponentConfigFieldEnum } from '/@/views/visual/packages/enum'; |
11 | 11 | ||
12 | export const option: PublicPresetOptions = { | 12 | export const option: PublicPresetOptions = { |
13 | - [ComponentConfigFieldEnum.ICON]: 'shuiwen', | ||
14 | - [ComponentConfigFieldEnum.ICON_COLOR]: '#367bff', | ||
15 | - [ComponentConfigFieldEnum.ICON_CLOSE]: 'shuiwen', | 13 | + [ComponentConfigFieldEnum.ICON]: 'dianyuandianya', |
14 | + [ComponentConfigFieldEnum.ICON_COLOR]: '#ffa621', | ||
15 | + [ComponentConfigFieldEnum.ICON_CLOSE]: 'dianyuandianya', | ||
16 | [ComponentConfigFieldEnum.ICON_COLOR_CLOSE]: '#CCCCCC', | 16 | [ComponentConfigFieldEnum.ICON_COLOR_CLOSE]: '#CCCCCC', |
17 | [ComponentConfigFieldEnum.SHOW_DEVICE_NAME]: false, | 17 | [ComponentConfigFieldEnum.SHOW_DEVICE_NAME]: false, |
18 | }; | 18 | }; |
src/views/visual/packages/components/Other/SwitchStatus/config.vue
renamed from
src/views/visual/packages/components/Text/SwitchStatus/config.vue
src/views/visual/packages/components/Other/SwitchStatus/datasource.vue
renamed from
src/views/visual/packages/components/Text/SwitchStatus/datasource.vue
src/views/visual/packages/components/Other/SwitchStatus/index.ts
renamed from
src/views/visual/packages/components/Text/SwitchStatus/index.ts
@@ -5,5 +5,5 @@ const componentKeys = useComponentKeys('SwitchStatus'); | @@ -5,5 +5,5 @@ const componentKeys = useComponentKeys('SwitchStatus'); | ||
5 | export const SwitchStatusConfig: ConfigType = { | 5 | export const SwitchStatusConfig: ConfigType = { |
6 | ...componentKeys, | 6 | ...componentKeys, |
7 | title: '开关量状态', | 7 | title: '开关量状态', |
8 | - package: PackagesCategoryEnum.TEXT, | 8 | + package: PackagesCategoryEnum.OTHER, |
9 | }; | 9 | }; |
src/views/visual/packages/components/Other/SwitchStatus/index.vue
renamed from
src/views/visual/packages/components/Text/SwitchStatus/index.vue
@@ -2,52 +2,71 @@ | @@ -2,52 +2,71 @@ | ||
2 | import { ComponentPropsConfigType } from '/@/views/visual/packages/index.type'; | 2 | import { ComponentPropsConfigType } from '/@/views/visual/packages/index.type'; |
3 | import { option } from './config'; | 3 | import { option } from './config'; |
4 | import { SvgIcon } from '/@/components/Icon'; | 4 | import { SvgIcon } from '/@/components/Icon'; |
5 | - import { computed } from 'vue'; | 5 | + import { computed, ref } from 'vue'; |
6 | import { DeviceName } from '/@/views/visual/commonComponents/DeviceName'; | 6 | import { DeviceName } from '/@/views/visual/commonComponents/DeviceName'; |
7 | + import { UpdateTime } from '/@/views/visual/commonComponents/UpdateTime'; | ||
7 | import { useDataFetch } from '../../../hook/socket/useSocket'; | 8 | import { useDataFetch } from '../../../hook/socket/useSocket'; |
8 | import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; | 9 | import { DataFetchUpdateFn } from '../../../hook/socket/useSocket.type'; |
10 | + import { useReceiveValue } from '../../../hook/useReceiveValue'; | ||
9 | 11 | ||
10 | const props = defineProps<{ | 12 | const props = defineProps<{ |
11 | config: ComponentPropsConfigType<typeof option>; | 13 | config: ComponentPropsConfigType<typeof option>; |
12 | }>(); | 14 | }>(); |
13 | 15 | ||
16 | + const time = ref<Nullable<number>>(null); | ||
17 | + const isOpenClose = ref<boolean>(true); | ||
18 | + | ||
14 | const getDesign = computed(() => { | 19 | const getDesign = computed(() => { |
15 | const { persetOption = {}, option } = props.config; | 20 | const { persetOption = {}, option } = props.config; |
16 | - | ||
17 | const { | 21 | const { |
18 | iconColor: persetIconColor, | 22 | iconColor: persetIconColor, |
19 | unit: perseUnit, | 23 | unit: perseUnit, |
20 | icon: persetIcon, | 24 | icon: persetIcon, |
21 | fontColor: persetFontColor, | 25 | fontColor: persetFontColor, |
26 | + iconClose: persetIconCLose, | ||
27 | + iconColorClose: persetIconColorClose, | ||
22 | } = persetOption; | 28 | } = persetOption; |
23 | 29 | ||
24 | - const { componentInfo, attribute, attributeRename } = option; | 30 | + const { componentInfo, attributeRename } = option; |
25 | 31 | ||
26 | - const { icon, iconColor, fontColor, unit } = componentInfo || {}; | 32 | + const { icon, iconColor, fontColor, unit, iconClose, iconColorClose, attributeName } = |
33 | + componentInfo || {}; | ||
27 | return { | 34 | return { |
28 | iconColor: iconColor || persetIconColor, | 35 | iconColor: iconColor || persetIconColor, |
29 | unit: unit ?? perseUnit, | 36 | unit: unit ?? perseUnit, |
30 | icon: icon || persetIcon, | 37 | icon: icon || persetIcon, |
31 | fontColor: fontColor || persetFontColor, | 38 | fontColor: fontColor || persetFontColor, |
32 | - attribute: attributeRename || attribute, | 39 | + attribute: attributeRename || attributeName, |
40 | + iconClose: iconClose || persetIconCLose, | ||
41 | + iconColorClose: iconColorClose || persetIconColorClose, | ||
33 | }; | 42 | }; |
34 | }); | 43 | }); |
35 | 44 | ||
36 | - const updateFn: DataFetchUpdateFn = () => {}; | 45 | + const { getNumberValue } = useReceiveValue(); |
46 | + | ||
47 | + const updateFn: DataFetchUpdateFn = (message, attribute) => { | ||
48 | + const { data = {} } = message; | ||
49 | + const [latest] = data[attribute] || []; | ||
50 | + const [timespan, value] = latest; | ||
51 | + time.value = timespan; | ||
52 | + isOpenClose.value = Boolean(getNumberValue(value)); | ||
53 | + }; | ||
37 | 54 | ||
38 | useDataFetch(props, updateFn); | 55 | useDataFetch(props, updateFn); |
39 | </script> | 56 | </script> |
40 | 57 | ||
41 | <template> | 58 | <template> |
42 | - <main class="w-full h-full flex flex-col justify-evenly items-center"> | 59 | + <main class="w-full h-full flex flex-col justify-center items-center"> |
43 | <DeviceName :config="config" /> | 60 | <DeviceName :config="config" /> |
44 | - <div class="flex justify-center items-center"> | 61 | + <div class="flex flex-1 flex-col justify-center items-center"> |
45 | <SvgIcon | 62 | <SvgIcon |
46 | - :name="getDesign.icon!" | 63 | + :name="isOpenClose ? getDesign.icon : getDesign.iconClose" |
47 | prefix="iconfont" | 64 | prefix="iconfont" |
48 | :size="60" | 65 | :size="60" |
49 | - :style="{ color: getDesign.iconColor }" | 66 | + :style="{ color: isOpenClose ? getDesign.iconColor : getDesign.iconColorClose }" |
50 | /> | 67 | /> |
68 | + <div class="text-gray-500 text-sm truncate m-2">{{ getDesign.attribute || '温度' }}</div> | ||
51 | </div> | 69 | </div> |
70 | + <UpdateTime :time="time" /> | ||
52 | </main> | 71 | </main> |
53 | </template> | 72 | </template> |
1 | import { MonitorVideoConfig } from './MonitorVideo'; | 1 | import { MonitorVideoConfig } from './MonitorVideo'; |
2 | import { PictureConfig } from './Picture'; | 2 | import { PictureConfig } from './Picture'; |
3 | import { SwitchSignalLightConfig } from './SwitchSignalLight'; | 3 | import { SwitchSignalLightConfig } from './SwitchSignalLight'; |
4 | +import { SwitchStatusConfig } from './SwitchStatus'; | ||
4 | 5 | ||
5 | -export const OtherList = [MonitorVideoConfig, PictureConfig, SwitchSignalLightConfig]; | 6 | +export const OtherList = [ |
7 | + MonitorVideoConfig, | ||
8 | + PictureConfig, | ||
9 | + SwitchSignalLightConfig, | ||
10 | + SwitchStatusConfig, | ||
11 | +]; |
@@ -37,8 +37,8 @@ | @@ -37,8 +37,8 @@ | ||
37 | fontColor: '#377dff', | 37 | fontColor: '#377dff', |
38 | backgroundColor: '#377dff', | 38 | backgroundColor: '#377dff', |
39 | unit: '℃', | 39 | unit: '℃', |
40 | - deviceName: '温度', | ||
41 | - attribute: '1', | 40 | + deviceName: '温湿度', |
41 | + attribute: '温度', | ||
42 | id: buildUUID(), | 42 | id: buildUUID(), |
43 | }, | 43 | }, |
44 | { | 44 | { |
@@ -46,8 +46,8 @@ | @@ -46,8 +46,8 @@ | ||
46 | fontColor: '#1E8667', | 46 | fontColor: '#1E8667', |
47 | backgroundColor: '#1E8667', | 47 | backgroundColor: '#1E8667', |
48 | unit: '℃', | 48 | unit: '℃', |
49 | - deviceName: '温度', | ||
50 | - attribute: '3', | 49 | + deviceName: '温湿度', |
50 | + attribute: '湿度', | ||
51 | id: buildUUID(), | 51 | id: buildUUID(), |
52 | }, | 52 | }, |
53 | ]; | 53 | ]; |
@@ -29,7 +29,8 @@ | @@ -29,7 +29,8 @@ | ||
29 | return { | 29 | return { |
30 | dataSource: dataSource.map((item) => { | 30 | dataSource: dataSource.map((item) => { |
31 | const { fontColor, icon, iconColor, unit } = item.componentInfo; | 31 | const { fontColor, icon, iconColor, unit } = item.componentInfo; |
32 | - const { attribute, attributeRename, deviceName, deviceRename, deviceId } = item; | 32 | + const { attribute, attributeRename, deviceName, deviceRename, deviceId, attributeName } = |
33 | + item; | ||
33 | 34 | ||
34 | return { | 35 | return { |
35 | unit: unit ?? persetUnit, | 36 | unit: unit ?? persetUnit, |
@@ -39,6 +40,7 @@ | @@ -39,6 +40,7 @@ | ||
39 | attribute: attribute || attributeRename, | 40 | attribute: attribute || attributeRename, |
40 | attributeRename, | 41 | attributeRename, |
41 | deviceName, | 42 | deviceName, |
43 | + attributeName, | ||
42 | deviceRename, | 44 | deviceRename, |
43 | id: deviceId, | 45 | id: deviceId, |
44 | }; | 46 | }; |
@@ -48,15 +50,17 @@ | @@ -48,15 +50,17 @@ | ||
48 | const defaultSvgList = ref<any>([ | 50 | const defaultSvgList = ref<any>([ |
49 | { | 51 | { |
50 | value: 26.2, | 52 | value: 26.2, |
51 | - name: 'wendu', | 53 | + deviceRename: '温湿度', |
54 | + attributeRename: '温度', | ||
52 | icon: 'zongfushe', | 55 | icon: 'zongfushe', |
53 | - unit: 'kw', | 56 | + unit: '℃', |
54 | iconColor: '#367BFF', | 57 | iconColor: '#367BFF', |
55 | fontColor: '#357CFB', | 58 | fontColor: '#357CFB', |
56 | }, | 59 | }, |
57 | { | 60 | { |
58 | value: 53.7, | 61 | value: 53.7, |
59 | - name: 'shidu', | 62 | + deviceRename: '温湿度', |
63 | + attributeRename: '湿度', | ||
60 | icon: 'guangzhaoqiangdu', | 64 | icon: 'guangzhaoqiangdu', |
61 | unit: '℃', | 65 | unit: '℃', |
62 | iconColor: '#FFA000', | 66 | iconColor: '#FFA000', |
@@ -72,7 +76,6 @@ | @@ -72,7 +76,6 @@ | ||
72 | ); | 76 | ); |
73 | 77 | ||
74 | const updateFn: MultipleDataFetchUpdateFn = (message, deviceId, attribute) => { | 78 | const updateFn: MultipleDataFetchUpdateFn = (message, deviceId, attribute) => { |
75 | - // console.log(unref(getDesign).dataSource, 'dataSource'); | ||
76 | forEachGroupMessage(message, deviceId, attribute, (attribute, value, timespan) => { | 79 | forEachGroupMessage(message, deviceId, attribute, (attribute, value, timespan) => { |
77 | updateSvgList.value.forEach((item) => { | 80 | updateSvgList.value.forEach((item) => { |
78 | if (item.id === deviceId && item.attribute === attribute) { | 81 | if (item.id === deviceId && item.attribute === attribute) { |
@@ -93,19 +96,19 @@ | @@ -93,19 +96,19 @@ | ||
93 | style="width: 86%" | 96 | style="width: 86%" |
94 | v-for="item in updateSvgList" | 97 | v-for="item in updateSvgList" |
95 | :key="item.id" | 98 | :key="item.id" |
96 | - class="flex justify-between items-center" | 99 | + class="flex justify-between items-center mt-2" |
97 | > | 100 | > |
98 | <div class="flex items-center"> | 101 | <div class="flex items-center"> |
99 | <SvgIcon | 102 | <SvgIcon |
100 | :name="item.icon!" | 103 | :name="item.icon!" |
101 | prefix="iconfont" | 104 | prefix="iconfont" |
102 | - :size="45" | 105 | + :size="40" |
103 | :style="{ color: item.iconColor }" | 106 | :style="{ color: item.iconColor }" |
104 | /> | 107 | /> |
105 | 108 | ||
106 | <div class="text-gray-500 text-lg truncate ml-6">{{ | 109 | <div class="text-gray-500 text-lg truncate ml-6">{{ |
107 | item.deviceRename || | 110 | item.deviceRename || |
108 | - item.deviceName + '-' + (item.attributeRename || item.attribute) || | 111 | + item.deviceName + '-' + (item.attributeRename || item.attributeName) || |
109 | '温度' | 112 | '温度' |
110 | }}</div> | 113 | }}</div> |
111 | </div> | 114 | </div> |
@@ -3,6 +3,7 @@ import { TextComponent2Config } from './TextComponent2'; | @@ -3,6 +3,7 @@ import { TextComponent2Config } from './TextComponent2'; | ||
3 | import { TextComponent3Config } from './TextComponent3'; | 3 | import { TextComponent3Config } from './TextComponent3'; |
4 | import { TextComponent4Config } from './TextComponent4'; | 4 | import { TextComponent4Config } from './TextComponent4'; |
5 | import { ValueList1Config } from './ValueList1'; | 5 | import { ValueList1Config } from './ValueList1'; |
6 | +import { ValueList2Config } from './ValueList2'; | ||
6 | 7 | ||
7 | export const TextList = [ | 8 | export const TextList = [ |
8 | TextComponent1Config, | 9 | TextComponent1Config, |
@@ -10,4 +11,5 @@ export const TextList = [ | @@ -10,4 +11,5 @@ export const TextList = [ | ||
10 | TextComponent3Config, | 11 | TextComponent3Config, |
11 | TextComponent4Config, | 12 | TextComponent4Config, |
12 | ValueList1Config, | 13 | ValueList1Config, |
14 | + ValueList2Config, | ||
13 | ]; | 15 | ]; |
@@ -54,7 +54,10 @@ const isControlComponent = (category?: string) => PackagesCategoryEnum.CONTROL = | @@ -54,7 +54,10 @@ const isControlComponent = (category?: string) => PackagesCategoryEnum.CONTROL = | ||
54 | 54 | ||
55 | const isBooleanComponent = (componentKeys: { categoryKey?: string; componentKey?: string }) => { | 55 | const isBooleanComponent = (componentKeys: { categoryKey?: string; componentKey?: string }) => { |
56 | const { categoryKey, componentKey } = componentKeys; | 56 | const { categoryKey, componentKey } = componentKeys; |
57 | - return categoryKey == 'OTHER' && componentKey == 'SwitchSignalLight'; | 57 | + return ( |
58 | + categoryKey == 'OTHER' && | ||
59 | + (componentKey == 'SwitchSignalLight' || componentKey == 'SwitchStatus') | ||
60 | + ); | ||
58 | }; | 61 | }; |
59 | 62 | ||
60 | const getDeviceService = async (deviceProfileId: string) => { | 63 | const getDeviceService = async (deviceProfileId: string) => { |