Showing
3 changed files
with
21 additions
and
4 deletions
@@ -8,10 +8,10 @@ VITE_GLOB_PUBLIC_PATH = / | @@ -8,10 +8,10 @@ VITE_GLOB_PUBLIC_PATH = / | ||
8 | # Please note that no line breaks | 8 | # Please note that no line breaks |
9 | 9 | ||
10 | # 本地 | 10 | # 本地 |
11 | -VITE_PROXY = [["/api","http://localhost:8080/api"],["/thingskit-scada","http://localhost:5173/thingskit-scada"],["/large-designer", "http://localhost:5555/large-designer/"]] | 11 | +VITE_PROXY = [["/api","http://10.0.152.126:8080/api"],["/thingskit-scada","http://localhost:5173/thingskit-scada"],["/large-designer", "http://localhost:5555/large-designer/"]] |
12 | 12 | ||
13 | # 实时数据的ws地址 | 13 | # 实时数据的ws地址 |
14 | -VITE_GLOB_WEB_SOCKET = ws://localhost:8080/api/ws/plugins/telemetry?token= | 14 | +VITE_GLOB_WEB_SOCKET = ws://10.152.126:8080/api/ws/plugins/telemetry?token= |
15 | 15 | ||
16 | # Delete console | 16 | # Delete console |
17 | VITE_GLOB_DROP_CONSOLE = true | 17 | VITE_GLOB_DROP_CONSOLE = true |
@@ -142,13 +142,19 @@ | @@ -142,13 +142,19 @@ | ||
142 | 142 | ||
143 | const selectOptions: Ref<any[]> = ref([]); | 143 | const selectOptions: Ref<any[]> = ref([]); |
144 | 144 | ||
145 | - const handleTemplateChange = (_, option) => { | 145 | + const handleTemplateChange = async (_, option) => { |
146 | const { productAndDevice } = option; | 146 | const { productAndDevice } = option; |
147 | + console.log(option, 'option'); | ||
147 | if (!productAndDevice) return; | 148 | if (!productAndDevice) return; |
148 | selectOptions.value = productAndDevice.map((item) => ({ | 149 | selectOptions.value = productAndDevice.map((item) => ({ |
149 | label: item.name, | 150 | label: item.name, |
150 | value: item.profileId, | 151 | value: item.profileId, |
151 | })); | 152 | })); |
153 | + await nextTick(); | ||
154 | + // 赋值 | ||
155 | + selectDeviceProfileRef.value?.setFieldsValue( | ||
156 | + productAndDevice.map((item) => ({ label: item.name, value: item.profileId })) | ||
157 | + ); | ||
152 | }; | 158 | }; |
153 | // | 159 | // |
154 | 160 |
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
19 | </template> | 19 | </template> |
20 | </template> | 20 | </template> |
21 | <script lang="ts" setup name="SelectDevice"> | 21 | <script lang="ts" setup name="SelectDevice"> |
22 | - import { ref, Ref, PropType, unref } from 'vue'; | 22 | + import { ref, Ref, PropType, unref, nextTick } from 'vue'; |
23 | import { Select } from 'ant-design-vue'; | 23 | import { Select } from 'ant-design-vue'; |
24 | import SelectDevice from './SelectDevice.vue'; | 24 | import SelectDevice from './SelectDevice.vue'; |
25 | import { createPickerSearch } from '/@/utils/pickerSearch'; | 25 | import { createPickerSearch } from '/@/utils/pickerSearch'; |
@@ -51,6 +51,16 @@ | @@ -51,6 +51,16 @@ | ||
51 | return unref(bindDeviceRef.deviceAttrRef)?.map((item: any) => item.emitChange()); | 51 | return unref(bindDeviceRef.deviceAttrRef)?.map((item: any) => item.emitChange()); |
52 | }; | 52 | }; |
53 | 53 | ||
54 | + const setFieldsValue = async (productIds) => { | ||
55 | + await nextTick(); | ||
56 | + if (!productIds && !productIds.length) { | ||
57 | + return; | ||
58 | + } | ||
59 | + selectValue.value = productIds; | ||
60 | + | ||
61 | + profileList.value = productIds; | ||
62 | + }; | ||
63 | + | ||
54 | const setValue = (value: any) => { | 64 | const setValue = (value: any) => { |
55 | console.log(value); | 65 | console.log(value); |
56 | selectValue.value = value.map((item) => ({ | 66 | selectValue.value = value.map((item) => ({ |
@@ -75,6 +85,7 @@ | @@ -75,6 +85,7 @@ | ||
75 | getSelectDevice, | 85 | getSelectDevice, |
76 | setValue, | 86 | setValue, |
77 | retValue, | 87 | retValue, |
88 | + setFieldsValue, | ||
78 | }); | 89 | }); |
79 | </script> | 90 | </script> |
80 | <style scoped lang="css"></style> | 91 | <style scoped lang="css"></style> |