Commit f0df21ba029608917a95626c91ae47e2cb951378
Merge branch 'ft_local_dev' into 'main'
fix:修改场景联动弹窗两次 See merge request huang/yun-teng-iot-front!349
Showing
10 changed files
with
201 additions
and
197 deletions
1 | <template> | 1 | <template> |
2 | <div :class="prefixCls"> | 2 | <div :class="prefixCls"> |
3 | - <CollapseHeader v-bind="$props" :prefixCls="prefixCls" :show="show" @expand="handleExpand"> | 3 | + <CollapseHeader |
4 | + v-bind="$props" | ||
5 | + :prefixCls="prefixCls" | ||
6 | + :show="!isClose ? isClose : show" | ||
7 | + @expand="handleExpand" | ||
8 | + > | ||
4 | <template #title> | 9 | <template #title> |
5 | <slot name="title"></slot> | 10 | <slot name="title"></slot> |
6 | </template> | 11 | </template> |
@@ -12,7 +17,7 @@ | @@ -12,7 +17,7 @@ | ||
12 | <div class="p-2"> | 17 | <div class="p-2"> |
13 | <CollapseTransition :enable="canExpan"> | 18 | <CollapseTransition :enable="canExpan"> |
14 | <Skeleton v-if="loading" :active="loading" /> | 19 | <Skeleton v-if="loading" :active="loading" /> |
15 | - <div :class="`${prefixCls}__body`" v-else v-show="show"> | 20 | + <div :class="`${prefixCls}__body`" v-else v-show="!isClose ? isClose : show"> |
16 | <slot></slot> | 21 | <slot></slot> |
17 | </div> | 22 | </div> |
18 | </CollapseTransition> | 23 | </CollapseTransition> |
@@ -35,6 +40,7 @@ | @@ -35,6 +40,7 @@ | ||
35 | import { useDesign } from '/@/hooks/web/useDesign'; | 40 | import { useDesign } from '/@/hooks/web/useDesign'; |
36 | 41 | ||
37 | const props = defineProps({ | 42 | const props = defineProps({ |
43 | + isClose: { type: Boolean, default: true }, | ||
38 | title: { type: String, default: '' }, | 44 | title: { type: String, default: '' }, |
39 | loading: { type: Boolean }, | 45 | loading: { type: Boolean }, |
40 | /** | 46 | /** |
@@ -58,7 +64,7 @@ | @@ -58,7 +64,7 @@ | ||
58 | */ | 64 | */ |
59 | lazyTime: { type: Number, default: 0 }, | 65 | lazyTime: { type: Number, default: 0 }, |
60 | }); | 66 | }); |
61 | - const emit = defineEmits(['expand']); | 67 | + const emit = defineEmits(['expand', 'change', 'hchange']); |
62 | 68 | ||
63 | const show = ref(true); | 69 | const show = ref(true); |
64 | 70 | ||
@@ -69,6 +75,8 @@ | @@ -69,6 +75,8 @@ | ||
69 | */ | 75 | */ |
70 | function handleExpand() { | 76 | function handleExpand() { |
71 | show.value = !show.value; | 77 | show.value = !show.value; |
78 | + emit('change', !show.value); | ||
79 | + emit('hchange', !show.value); | ||
72 | if (props.triggerWindowResize) { | 80 | if (props.triggerWindowResize) { |
73 | // 200 milliseconds here is because the expansion has animation, | 81 | // 200 milliseconds here is because the expansion has animation, |
74 | useTimeoutFn(triggerWindowResize, 200); | 82 | useTimeoutFn(triggerWindowResize, 200); |
@@ -40,7 +40,7 @@ export const CoapSchemas: FormSchema[] = [ | @@ -40,7 +40,7 @@ export const CoapSchemas: FormSchema[] = [ | ||
40 | { label: 'Efento NB-IoT', value: 'EFENTO' }, | 40 | { label: 'Efento NB-IoT', value: 'EFENTO' }, |
41 | ], | 41 | ], |
42 | }, | 42 | }, |
43 | - colProps: { span: 22}, | 43 | + colProps: { span: 22 }, |
44 | }, | 44 | }, |
45 | { | 45 | { |
46 | field: 'transportPayloadType', | 46 | field: 'transportPayloadType', |
@@ -163,9 +163,7 @@ export const CoapSchemas: FormSchema[] = [ | @@ -163,9 +163,7 @@ export const CoapSchemas: FormSchema[] = [ | ||
163 | colProps: { span: 22 }, | 163 | colProps: { span: 22 }, |
164 | component: 'InputTextArea', | 164 | component: 'InputTextArea', |
165 | componentProps: { | 165 | componentProps: { |
166 | - autoSize: { | ||
167 | - maxRows: 10, | ||
168 | - }, | 166 | + rows: 17, |
169 | }, | 167 | }, |
170 | defaultValue: ` | 168 | defaultValue: ` |
171 | syntax ="proto3"; | 169 | syntax ="proto3"; |
@@ -193,9 +191,7 @@ export const CoapSchemas: FormSchema[] = [ | @@ -193,9 +191,7 @@ export const CoapSchemas: FormSchema[] = [ | ||
193 | colProps: { span: 22 }, | 191 | colProps: { span: 22 }, |
194 | component: 'InputTextArea', | 192 | component: 'InputTextArea', |
195 | componentProps: { | 193 | componentProps: { |
196 | - autoSize: { | ||
197 | - maxRows: 10, | ||
198 | - }, | 194 | + rows: 9, |
199 | }, | 195 | }, |
200 | defaultValue: ` | 196 | defaultValue: ` |
201 | syntax ="proto3"; | 197 | syntax ="proto3"; |
@@ -215,9 +211,7 @@ export const CoapSchemas: FormSchema[] = [ | @@ -215,9 +211,7 @@ export const CoapSchemas: FormSchema[] = [ | ||
215 | colProps: { span: 22 }, | 211 | colProps: { span: 22 }, |
216 | component: 'InputTextArea', | 212 | component: 'InputTextArea', |
217 | componentProps: { | 213 | componentProps: { |
218 | - autoSize: { | ||
219 | - maxRows: 10, | ||
220 | - }, | 214 | + rows: 11, |
221 | }, | 215 | }, |
222 | defaultValue: ` | 216 | defaultValue: ` |
223 | syntax ="proto3"; | 217 | syntax ="proto3"; |
@@ -238,9 +232,7 @@ export const CoapSchemas: FormSchema[] = [ | @@ -238,9 +232,7 @@ export const CoapSchemas: FormSchema[] = [ | ||
238 | colProps: { span: 22 }, | 232 | colProps: { span: 22 }, |
239 | component: 'InputTextArea', | 233 | component: 'InputTextArea', |
240 | componentProps: { | 234 | componentProps: { |
241 | - autoSize: { | ||
242 | - maxRows: 10, | ||
243 | - }, | 235 | + rows: 9, |
244 | }, | 236 | }, |
245 | defaultValue: ` | 237 | defaultValue: ` |
246 | syntax ="proto3"; | 238 | syntax ="proto3"; |
@@ -8,16 +8,12 @@ | @@ -8,16 +8,12 @@ | ||
8 | <script lang="ts" setup> | 8 | <script lang="ts" setup> |
9 | import { reactive } from 'vue'; | 9 | import { reactive } from 'vue'; |
10 | import { BasicForm, useForm } from '/@/components/Form'; | 10 | import { BasicForm, useForm } from '/@/components/Form'; |
11 | - import { | ||
12 | - CoapSchemas, | ||
13 | - // deviceTelemetryProtoSchemaData, | ||
14 | - // deviceAttributesProtoSchemaData, | ||
15 | - // deviceRpcRequestProtoSchemaData, | ||
16 | - // deviceRpcResponseProtoSchemaData, | ||
17 | - } from './Coap'; | 11 | + import { CoapSchemas } from './Coap'; |
18 | 12 | ||
19 | const emits = defineEmits(['prev']); | 13 | const emits = defineEmits(['prev']); |
20 | - let coapAllData = reactive({}); | 14 | + const coapAllData = reactive({ |
15 | + coapData: {}, | ||
16 | + }); | ||
21 | const transportCoapData: any = reactive({ | 17 | const transportCoapData: any = reactive({ |
22 | coapDeviceTypeConfiguration: { | 18 | coapDeviceTypeConfiguration: { |
23 | coapDeviceType: null, | 19 | coapDeviceType: null, |
@@ -61,25 +57,43 @@ | @@ -61,25 +57,43 @@ | ||
61 | const getFormData = async () => { | 57 | const getFormData = async () => { |
62 | const val = await validate(); | 58 | const val = await validate(); |
63 | if (!val) return; | 59 | if (!val) return; |
64 | - transportCoapData.coapDeviceTypeConfiguration.coapDeviceType = val.coapDeviceType; | ||
65 | - transportCoapData.coapDeviceTypeConfiguration.transportPayloadTypeConfiguration.transportPayloadType = | ||
66 | - val.transportPayloadType; | ||
67 | - transportCoapData.coapDeviceTypeConfiguration.transportPayloadTypeConfiguration.deviceTelemetryProtoSchema = | ||
68 | - val.deviceTelemetryProtoSchema; | ||
69 | - transportCoapData.coapDeviceTypeConfiguration.transportPayloadTypeConfiguration.deviceAttributesProtoSchema = | ||
70 | - val.deviceAttributesProtoSchema; | ||
71 | - transportCoapData.coapDeviceTypeConfiguration.transportPayloadTypeConfiguration.deviceRpcRequestProtoSchema = | ||
72 | - val.deviceRpcRequestProtoSchema; | ||
73 | - transportCoapData.coapDeviceTypeConfiguration.transportPayloadTypeConfiguration.deviceRpcResponseProtoSchema = | ||
74 | - val.deviceRpcResponseProtoSchema; | ||
75 | - transportCoapData.clientSettings.powerMode = val.powerMode; | ||
76 | - transportCoapData.clientSettings.edrxCycle = val.edrxCycle; | ||
77 | - transportCoapData.clientSettings.pagingTransmissionWindow = val.pagingTransmissionWindow; | ||
78 | - transportCoapData.clientSettings.psmActivityTimer = val.psmActivityTimer; | ||
79 | - coapAllData = { | 60 | + for (let o in val) { |
61 | + for (let u in transportCoapData) { | ||
62 | + switch (u) { | ||
63 | + case 'coapDeviceTypeConfiguration': | ||
64 | + for (let t in transportCoapData.coapDeviceTypeConfiguration) { | ||
65 | + if (t === 'coapDeviceType') { | ||
66 | + Reflect.set(transportCoapData.coapDeviceTypeConfiguration, t, val[t]); | ||
67 | + } | ||
68 | + if (t === 'transportPayloadTypeConfiguration') { | ||
69 | + for (let t in transportCoapData.coapDeviceTypeConfiguration | ||
70 | + .transportPayloadTypeConfiguration) { | ||
71 | + if (t === o) { | ||
72 | + Reflect.set( | ||
73 | + transportCoapData.coapDeviceTypeConfiguration | ||
74 | + .transportPayloadTypeConfiguration, | ||
75 | + t, | ||
76 | + val[t] | ||
77 | + ); | ||
78 | + } | ||
79 | + } | ||
80 | + } | ||
81 | + } | ||
82 | + break; | ||
83 | + case 'clientSettings': | ||
84 | + for (let t in transportCoapData.clientSettings) { | ||
85 | + if (t === o) { | ||
86 | + Reflect.set(transportCoapData.clientSettings, t, val[t]); | ||
87 | + } | ||
88 | + } | ||
89 | + break; | ||
90 | + } | ||
91 | + } | ||
92 | + } | ||
93 | + coapAllData.coapData = { | ||
80 | ...transportCoapData, | 94 | ...transportCoapData, |
81 | }; | 95 | }; |
82 | - return coapAllData; | 96 | + return coapAllData.coapData; |
83 | }; | 97 | }; |
84 | defineExpose({ | 98 | defineExpose({ |
85 | getFormData, | 99 | getFormData, |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | import { BasicForm, useForm } from '/@/components/Form'; | 7 | import { BasicForm, useForm } from '/@/components/Form'; |
8 | import { serverSchemas } from '../index'; | 8 | import { serverSchemas } from '../index'; |
9 | 9 | ||
10 | - const [registerServer, { getFieldsValue, setFieldsValue }] = useForm({ | 10 | + const [registerServer, { getFieldsValue, setFieldsValue, resetFields }] = useForm({ |
11 | labelWidth: 180, | 11 | labelWidth: 180, |
12 | schemas: serverSchemas, | 12 | schemas: serverSchemas, |
13 | actionColOptions: { | 13 | actionColOptions: { |
@@ -24,9 +24,11 @@ | @@ -24,9 +24,11 @@ | ||
24 | if (!value) return; | 24 | if (!value) return; |
25 | return value; | 25 | return value; |
26 | }; | 26 | }; |
27 | + const resetFormData = () => resetFields(); | ||
27 | defineExpose({ | 28 | defineExpose({ |
28 | getBootStrapFormFunc, | 29 | getBootStrapFormFunc, |
29 | editBootStrapFormFunc, | 30 | editBootStrapFormFunc, |
31 | + resetFormData, | ||
30 | }); | 32 | }); |
31 | </script> | 33 | </script> |
32 | <style lang="less" scoped></style> | 34 | <style lang="less" scoped></style> |
@@ -284,8 +284,11 @@ export const serverSchemas: FormSchema[] = [ | @@ -284,8 +284,11 @@ export const serverSchemas: FormSchema[] = [ | ||
284 | { | 284 | { |
285 | field: 'securityMode', | 285 | field: 'securityMode', |
286 | component: 'Select', | 286 | component: 'Select', |
287 | - label: '安全配置模式', | 287 | + label: '安全配置', |
288 | defaultValue: 'NO_SEC', | 288 | defaultValue: 'NO_SEC', |
289 | + helpMessage: [ | ||
290 | + 'X.509 Certificate模式和Raw Public Key模式和Pre-Shared Key模式下,port端口必须是5686', | ||
291 | + ], | ||
289 | componentProps: { | 292 | componentProps: { |
290 | options: [ | 293 | options: [ |
291 | { | 294 | { |
@@ -312,6 +315,7 @@ export const serverSchemas: FormSchema[] = [ | @@ -312,6 +315,7 @@ export const serverSchemas: FormSchema[] = [ | ||
312 | field: 'shortServerId', | 315 | field: 'shortServerId', |
313 | component: 'InputNumber', | 316 | component: 'InputNumber', |
314 | label: '短服务器ID', | 317 | label: '短服务器ID', |
318 | + helpMessage: ['短服务器ID是唯一的'], | ||
315 | required: true, | 319 | required: true, |
316 | defaultValue: 123, | 320 | defaultValue: 123, |
317 | colProps: { span: 8 }, | 321 | colProps: { span: 8 }, |
@@ -320,6 +324,7 @@ export const serverSchemas: FormSchema[] = [ | @@ -320,6 +324,7 @@ export const serverSchemas: FormSchema[] = [ | ||
320 | field: 'host', | 324 | field: 'host', |
321 | component: 'Input', | 325 | component: 'Input', |
322 | label: '主机', | 326 | label: '主机', |
327 | + helpMessage: ['主机是唯一的'], | ||
323 | required: true, | 328 | required: true, |
324 | defaultValue: '0.0.0.0', | 329 | defaultValue: '0.0.0.0', |
325 | colProps: { span: 8 }, | 330 | colProps: { span: 8 }, |
@@ -328,6 +333,7 @@ export const serverSchemas: FormSchema[] = [ | @@ -328,6 +333,7 @@ export const serverSchemas: FormSchema[] = [ | ||
328 | field: 'port', | 333 | field: 'port', |
329 | component: 'Input', | 334 | component: 'Input', |
330 | label: '端口', | 335 | label: '端口', |
336 | + helpMessage: ['端口必须是5685'], | ||
331 | required: true, | 337 | required: true, |
332 | defaultValue: 5685, | 338 | defaultValue: 5685, |
333 | colProps: { span: 8 }, | 339 | colProps: { span: 8 }, |
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | - <Tabs | ||
4 | - v-model:activeKey="currentKey" | ||
5 | - :size="currentSize" | ||
6 | - :animated="true" | ||
7 | - @change="handleChange" | ||
8 | - > | 3 | + <Tabs v-model:activeKey="currentKey" :size="currentSize" :animated="true"> |
9 | <TabPane forceRender key="1" tab="LWM2M Model"> | 4 | <TabPane forceRender key="1" tab="LWM2M Model"> |
10 | <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerModel" /> | 5 | <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerModel" /> |
11 | </TabPane> | 6 | </TabPane> |
@@ -17,22 +12,27 @@ | @@ -17,22 +12,27 @@ | ||
17 | >包括引导服务器更新 | 12 | >包括引导服务器更新 |
18 | </Checkbox> | 13 | </Checkbox> |
19 | <CollapseContainer | 14 | <CollapseContainer |
15 | + @hchange="hChange" | ||
16 | + @change="eChange(item, index)" | ||
20 | v-for="(item, index) in dynamicBOOTSTRAP.bootstrap" | 17 | v-for="(item, index) in dynamicBOOTSTRAP.bootstrap" |
21 | :key="item" | 18 | :key="item" |
22 | :title="collapseTitle(item)" | 19 | :title="collapseTitle(item)" |
23 | class="mt-4" | 20 | class="mt-4" |
21 | + :isClose="item.close" | ||
24 | > | 22 | > |
25 | <template #action> | 23 | <template #action> |
26 | - <Button | ||
27 | - style="margin-right: 1vw" | ||
28 | - size="small" | ||
29 | - type="text" | ||
30 | - @click="handleRemove(index)" | 24 | + <Popconfirm |
25 | + title="您确定要删除该项?" | ||
26 | + ok-text="确定" | ||
27 | + cancel-text="取消" | ||
28 | + @confirm="handleRemove(index)" | ||
31 | > | 29 | > |
32 | - <template #icon> | ||
33 | - <DeleteOutlined /> | ||
34 | - </template> | ||
35 | - </Button> | 30 | + <Button style="margin-right: 1vw" size="small" type="text"> |
31 | + <template #icon> | ||
32 | + <DeleteOutlined /> | ||
33 | + </template> | ||
34 | + </Button> | ||
35 | + </Popconfirm> | ||
36 | </template> | 36 | </template> |
37 | <div style="border: 1px solid #d9d9d9; width: 100%"> | 37 | <div style="border: 1px solid #d9d9d9; width: 100%"> |
38 | <div style="margin: 10px 15px"> | 38 | <div style="margin: 10px 15px"> |
@@ -89,17 +89,30 @@ | @@ -89,17 +89,30 @@ | ||
89 | import { modelSchemas, settingsSchemas, deviceSchemas } from './index'; | 89 | import { modelSchemas, settingsSchemas, deviceSchemas } from './index'; |
90 | import BootStrapForm from './cpns/BootStrapForm.vue'; | 90 | import BootStrapForm from './cpns/BootStrapForm.vue'; |
91 | import { DeleteOutlined, PlusCircleOutlined } from '@ant-design/icons-vue'; | 91 | import { DeleteOutlined, PlusCircleOutlined } from '@ant-design/icons-vue'; |
92 | - import { Button, Checkbox } from 'ant-design-vue'; | 92 | + import { Button, Checkbox, Popconfirm } from 'ant-design-vue'; |
93 | import { CollapseContainer } from '/@/components/Container'; | 93 | import { CollapseContainer } from '/@/components/Container'; |
94 | import { useModal } from '/@/components/Modal'; | 94 | import { useModal } from '/@/components/Modal'; |
95 | import ServerConfigModal from './cpns/ServerConfigModal.vue'; | 95 | import ServerConfigModal from './cpns/ServerConfigModal.vue'; |
96 | 96 | ||
97 | + const eChange = (_, e1) => { | ||
98 | + if (eS) { | ||
99 | + dynamicBOOTSTRAP.bootstrap.forEach((bootstrap, index: number) => { | ||
100 | + if (index === e1) { | ||
101 | + bootstrap.close = true; | ||
102 | + } | ||
103 | + }); | ||
104 | + } | ||
105 | + }; | ||
106 | + let eS = false; | ||
107 | + const hChange = (e) => { | ||
108 | + eS = e; | ||
109 | + }; | ||
97 | const collapseTitle = (item) => { | 110 | const collapseTitle = (item) => { |
98 | return `LwM2M Server Short server ID: ${item.shortServerId} Security config mode: ${item.securityMode}`; | 111 | return `LwM2M Server Short server ID: ${item.shortServerId} Security config mode: ${item.securityMode}`; |
99 | }; | 112 | }; |
100 | const bootstrapServerUpdateEnable = ref(false); | 113 | const bootstrapServerUpdateEnable = ref(false); |
101 | const dynamicBOOTSTRAP: any = reactive({ | 114 | const dynamicBOOTSTRAP: any = reactive({ |
102 | - bootstrap: [{ securityMode: 'NO_SEC', shortServerId: 1234 }], | 115 | + bootstrap: [{ securityMode: 'NO_SEC', shortServerId: 1234, close: false }], |
103 | }); | 116 | }); |
104 | const dynamicBindRef: any = { | 117 | const dynamicBindRef: any = { |
105 | BootStrapFormItemRef: ref([]), | 118 | BootStrapFormItemRef: ref([]), |
@@ -108,7 +121,6 @@ | @@ -108,7 +121,6 @@ | ||
108 | const currentSize = ref('large'); | 121 | const currentSize = ref('large'); |
109 | let allObj: any = reactive({}); | 122 | let allObj: any = reactive({}); |
110 | let allEchoObj: any = reactive({}); | 123 | let allEchoObj: any = reactive({}); |
111 | - let allEchoStatus = ref(false); | ||
112 | let clientLwM2mSettingsObj = reactive({}); | 124 | let clientLwM2mSettingsObj = reactive({}); |
113 | let observeAttrObj = reactive({ | 125 | let observeAttrObj = reactive({ |
114 | attribute: [], | 126 | attribute: [], |
@@ -160,55 +172,28 @@ | @@ -160,55 +172,28 @@ | ||
160 | dynamicBOOTSTRAP.bootstrap.push({ | 172 | dynamicBOOTSTRAP.bootstrap.push({ |
161 | securityMode: 'NO_SEC', | 173 | securityMode: 'NO_SEC', |
162 | shortServerId: 1234, | 174 | shortServerId: 1234, |
175 | + close: false, | ||
163 | }); | 176 | }); |
164 | } | 177 | } |
165 | }; | 178 | }; |
166 | const handleRemove = (index) => { | 179 | const handleRemove = (index) => { |
167 | dynamicBOOTSTRAP.bootstrap.splice(index, 1); | 180 | dynamicBOOTSTRAP.bootstrap.splice(index, 1); |
168 | }; | 181 | }; |
169 | - const handleChange = (e) => { | ||
170 | - if (allEchoStatus.value) { | ||
171 | - switch (e) { | ||
172 | - case '1': | ||
173 | - break; | ||
174 | - case '2': | ||
175 | - nextTick(() => { | ||
176 | - bootstrapServerUpdateEnable.value = allEchoObj.bootstrapServerUpdateEnable; | ||
177 | - dynamicBOOTSTRAP.bootstrap = allEchoObj.bootstrap; | ||
178 | - dynamicBOOTSTRAP.bootstrap.forEach((bootstrap, index: number) => { | ||
179 | - nextTick(() => { | ||
180 | - unref(dynamicBindRef.BootStrapFormItemRef)[index]?.editBootStrapFormFunc(bootstrap); | ||
181 | - }); | ||
182 | - }); | ||
183 | - }); | ||
184 | - break; | ||
185 | - case '3': | ||
186 | - nextTick(() => { | ||
187 | - settingsSetFieldsValueFunc({ | ||
188 | - powerMode: allEchoObj?.clientLwM2mSettings?.powerMode, | ||
189 | - psmActivityTimer: allEchoObj?.clientLwM2mSettings?.psmActivityTimer, | ||
190 | - edrxCycle: allEchoObj?.clientLwM2mSettings?.edrxCycle, | ||
191 | - pagingTransmissionWindow: allEchoObj?.clientLwM2mSettings?.pagingTransmissionWindow, | ||
192 | - fwUpdateStrategy: allEchoObj?.clientLwM2mSettings?.fwUpdateStrategy, | ||
193 | - swUpdateStrategy: allEchoObj?.clientLwM2mSettings?.swUpdateStrategy, | ||
194 | - clientOnlyObserveAfterConnect: | ||
195 | - allEchoObj?.clientLwM2mSettings?.clientOnlyObserveAfterConnect, | ||
196 | - fwUpdateResource: allEchoObj?.clientLwM2mSettings?.fwUpdateResource, | ||
197 | - swUpdateResource: allEchoObj?.clientLwM2mSettings?.swUpdateResource, | ||
198 | - compositeOperationsSupport: | ||
199 | - allEchoObj?.clientLwM2mSettings?.compositeOperationsSupport, | ||
200 | - }); | ||
201 | - }); | ||
202 | - break; | ||
203 | - case '4': | ||
204 | - break; | ||
205 | - } | ||
206 | - } | ||
207 | - }; | ||
208 | const setFormData = (v) => { | 182 | const setFormData = (v) => { |
209 | if (v) { | 183 | if (v) { |
210 | allEchoObj = v; | 184 | allEchoObj = v; |
211 | - allEchoStatus.value = true; | 185 | + settingsSetFieldsValueFunc({ |
186 | + ...allEchoObj?.clientLwM2mSettings, | ||
187 | + }); | ||
188 | + nextTick(() => { | ||
189 | + bootstrapServerUpdateEnable.value = allEchoObj.bootstrapServerUpdateEnable; | ||
190 | + dynamicBOOTSTRAP.bootstrap = allEchoObj.bootstrap; | ||
191 | + dynamicBOOTSTRAP.bootstrap.forEach((bootstrap, index: number) => { | ||
192 | + nextTick(() => { | ||
193 | + unref(dynamicBindRef.BootStrapFormItemRef)[index]?.editBootStrapFormFunc(bootstrap); | ||
194 | + }); | ||
195 | + }); | ||
196 | + }); | ||
212 | } | 197 | } |
213 | }; | 198 | }; |
214 | const tempBootStrap: any = []; | 199 | const tempBootStrap: any = []; |
@@ -249,11 +234,13 @@ | @@ -249,11 +234,13 @@ | ||
249 | }; | 234 | }; |
250 | 235 | ||
251 | const resetFormData = () => { | 236 | const resetFormData = () => { |
252 | - allEchoStatus.value = false; | ||
253 | nextTick(() => { | 237 | nextTick(() => { |
254 | resetObjectListValue(); | 238 | resetObjectListValue(); |
255 | resetSettingsValue(); | 239 | resetSettingsValue(); |
256 | resetDeviceValue(); | 240 | resetDeviceValue(); |
241 | + unref(dynamicBindRef.BootStrapFormItemRef).map((item) => { | ||
242 | + item.resetFormData(); | ||
243 | + }); | ||
257 | }); | 244 | }); |
258 | }; | 245 | }; |
259 | const selectCheckStatus = ref(false); | 246 | const selectCheckStatus = ref(false); |
@@ -272,12 +259,14 @@ | @@ -272,12 +259,14 @@ | ||
272 | dynamicBOOTSTRAP.bootstrap.push({ | 259 | dynamicBOOTSTRAP.bootstrap.push({ |
273 | securityMode: 'NO_SEC', | 260 | securityMode: 'NO_SEC', |
274 | shortServerId: 1234, | 261 | shortServerId: 1234, |
262 | + close: false, | ||
275 | }); | 263 | }); |
276 | break; | 264 | break; |
277 | case 'Bootstrap': | 265 | case 'Bootstrap': |
278 | dynamicBOOTSTRAP.bootstrap.push({ | 266 | dynamicBOOTSTRAP.bootstrap.push({ |
279 | securityMode: 'NO_SEC', | 267 | securityMode: 'NO_SEC', |
280 | shortServerId: 1234, | 268 | shortServerId: 1234, |
269 | + close: false, | ||
281 | }); | 270 | }); |
282 | break; | 271 | break; |
283 | } | 272 | } |
@@ -290,7 +279,6 @@ | @@ -290,7 +279,6 @@ | ||
290 | registerDevice, | 279 | registerDevice, |
291 | getFormData, | 280 | getFormData, |
292 | setFormData, | 281 | setFormData, |
293 | - handleChange, | ||
294 | resetFormData, | 282 | resetFormData, |
295 | dynamicBOOTSTRAP, | 283 | dynamicBOOTSTRAP, |
296 | dynamicBindRef, | 284 | dynamicBindRef, |
@@ -100,9 +100,7 @@ export const MqttSchemas: FormSchema[] = [ | @@ -100,9 +100,7 @@ export const MqttSchemas: FormSchema[] = [ | ||
100 | colProps: { span: 23 }, | 100 | colProps: { span: 23 }, |
101 | component: 'InputTextArea', | 101 | component: 'InputTextArea', |
102 | componentProps: { | 102 | componentProps: { |
103 | - autoSize: { | ||
104 | - maxRows: 10, | ||
105 | - }, | 103 | + rows: 17, |
106 | }, | 104 | }, |
107 | defaultValue: ` | 105 | defaultValue: ` |
108 | syntax ="proto3"; | 106 | syntax ="proto3"; |
@@ -129,9 +127,7 @@ export const MqttSchemas: FormSchema[] = [ | @@ -129,9 +127,7 @@ export const MqttSchemas: FormSchema[] = [ | ||
129 | colProps: { span: 23 }, | 127 | colProps: { span: 23 }, |
130 | component: 'InputTextArea', | 128 | component: 'InputTextArea', |
131 | componentProps: { | 129 | componentProps: { |
132 | - autoSize: { | ||
133 | - maxRows: 10, | ||
134 | - }, | 130 | + rows: 11, |
135 | }, | 131 | }, |
136 | defaultValue: ` | 132 | defaultValue: ` |
137 | syntax ="proto3"; | 133 | syntax ="proto3"; |
@@ -150,9 +146,7 @@ export const MqttSchemas: FormSchema[] = [ | @@ -150,9 +146,7 @@ export const MqttSchemas: FormSchema[] = [ | ||
150 | colProps: { span: 23 }, | 146 | colProps: { span: 23 }, |
151 | component: 'InputTextArea', | 147 | component: 'InputTextArea', |
152 | componentProps: { | 148 | componentProps: { |
153 | - autoSize: { | ||
154 | - maxRows: 10, | ||
155 | - }, | 149 | + rows: 11, |
156 | }, | 150 | }, |
157 | defaultValue: ` | 151 | defaultValue: ` |
158 | syntax ="proto3"; | 152 | syntax ="proto3"; |
@@ -172,9 +166,7 @@ export const MqttSchemas: FormSchema[] = [ | @@ -172,9 +166,7 @@ export const MqttSchemas: FormSchema[] = [ | ||
172 | colProps: { span: 23 }, | 166 | colProps: { span: 23 }, |
173 | component: 'InputTextArea', | 167 | component: 'InputTextArea', |
174 | componentProps: { | 168 | componentProps: { |
175 | - autoSize: { | ||
176 | - maxRows: 10, | ||
177 | - }, | 169 | + rows: 11, |
178 | }, | 170 | }, |
179 | defaultValue: ` | 171 | defaultValue: ` |
180 | syntax ="proto3"; | 172 | syntax ="proto3"; |
@@ -235,3 +227,19 @@ message RpcResponseMsg { | @@ -235,3 +227,19 @@ message RpcResponseMsg { | ||
235 | optional string payload = 1; | 227 | optional string payload = 1; |
236 | } | 228 | } |
237 | `; | 229 | `; |
230 | + | ||
231 | +export const fixedTextA = `支持单[+]和多级[#]通配符。 [+] is suitable for any topic filter | ||
232 | +level。例如:v1/devices/+/telemetry or +/devices/+/attributes。 [#]可以替换 topic | ||
233 | +filter 本身,并且必须是 topic 的最后一个符号。例如:# or v1/devices/me/#。`; | ||
234 | + | ||
235 | +export const fixedTextB = `启用时,默认情况下,平台将使用Protobuf有效载荷格式。如果解析失败,平台将尝试使用JSON负载格式。 | ||
236 | +有助于固件更新期间的向后兼容性。例如,固件的初始版本使用Json,而新版本使用Protobuf。 | ||
237 | +在设备组的固件更新过程中,需要同时支持Protobuf和JSON。兼容性模式会导致性能略有下降, | ||
238 | +因此建议在更新所有设备后禁用此模式。`; | ||
239 | + | ||
240 | +export const fixedTextC = `启用后,平台将使用Json负载格式通过以下主题推送属性 | ||
241 | +和RPC:v1/devices/me/attributes/response/$request id、v1/devices/me/attributes、 | ||
242 | +v1/devices/me/RPC/request/$request id、v1/devices/me/RPC/response/$request id。 | ||
243 | +此设置不会影响使用新(v2)主题发送的属性和rpc订阅: v2/a/res/$request | ||
244 | +id、v2/a、v2/r/req/$request id、v2/r/res/$request id。 其中,$request | ||
245 | +id是整数请求标识符。`; |
@@ -13,31 +13,21 @@ | @@ -13,31 +13,21 @@ | ||
13 | <template #descSlot> | 13 | <template #descSlot> |
14 | <div style="width: 47rem; margin-left: 2rem"> | 14 | <div style="width: 47rem; margin-left: 2rem"> |
15 | <p> | 15 | <p> |
16 | - 支持单[+]和多级[#]通配符。 [+] is suitable for any topic filter | ||
17 | - level。例如:v1/devices/+/telemetry or +/devices/+/attributes。 [#]可以替换 topic | ||
18 | - filter 本身,并且必须是 topic 的最后一个符号。例如:# or v1/devices/me/#。 | 16 | + {{ fixedTextA }} |
19 | </p> | 17 | </p> |
20 | </div> | 18 | </div> |
21 | </template> | 19 | </template> |
22 | <template #desc1> | 20 | <template #desc1> |
23 | <div style="width: 47rem; margin-left: 2rem"> | 21 | <div style="width: 47rem; margin-left: 2rem"> |
24 | <p> | 22 | <p> |
25 | - 启用时,默认情况下,平台将使用Protobuf有效载荷格式。如果解析失败,平台将尝试使用JSON负载格式。 | ||
26 | - 有助于固件更新期间的向后兼容性。例如,固件的初始版本使用Json,而新版本使用Protobuf。 | ||
27 | - 在设备组的固件更新过程中,需要同时支持Protobuf和JSON。兼容性模式会导致性能略有下降, | ||
28 | - 因此建议在更新所有设备后禁用此模式。 | 23 | + {{ fixedTextB }} |
29 | </p> | 24 | </p> |
30 | </div> | 25 | </div> |
31 | </template> | 26 | </template> |
32 | <template #desc2> | 27 | <template #desc2> |
33 | <div style="width: 47rem; margin-left: 2rem"> | 28 | <div style="width: 47rem; margin-left: 2rem"> |
34 | <p> | 29 | <p> |
35 | - 启用后,平台将使用Json负载格式通过以下主题推送属性 | ||
36 | - 和RPC:v1/devices/me/attributes/response/$request\u id、v1/devices/me/attributes、 | ||
37 | - v1/devices/me/RPC/request/$request\u id、v1/devices/me/RPC/response/$request\u id。 | ||
38 | - 此设置不会影响使用新(v2)主题发送的属性和rpc订阅: v2/a/res/$request\u | ||
39 | - id、v2/a、v2/r/req/$request\u id、v2/r/res/$request\u id。 其中,$request\u | ||
40 | - id是整数请求标识符。 | 30 | + {{ fixedTextC }} |
41 | </p> | 31 | </p> |
42 | </div> | 32 | </div> |
43 | </template> | 33 | </template> |
@@ -48,17 +38,13 @@ | @@ -48,17 +38,13 @@ | ||
48 | <script lang="ts" setup> | 38 | <script lang="ts" setup> |
49 | import { reactive } from 'vue'; | 39 | import { reactive } from 'vue'; |
50 | import { BasicForm, useForm } from '/@/components/Form'; | 40 | import { BasicForm, useForm } from '/@/components/Form'; |
51 | - import { | ||
52 | - MqttSchemas, | ||
53 | - // deviceTelemetryProtoSchemaData, | ||
54 | - // deviceAttributesProtoSchemaData, | ||
55 | - // deviceRpcRequestProtoSchemaData, | ||
56 | - // deviceRpcResponseProtoSchemaData, | ||
57 | - } from './Mqtt'; | 41 | + import { MqttSchemas, fixedTextA, fixedTextB, fixedTextC } from './Mqtt'; |
58 | 42 | ||
59 | const emits = defineEmits(['prev']); | 43 | const emits = defineEmits(['prev']); |
60 | 44 | ||
61 | - let allMqttData: any = reactive({}); | 45 | + const allMqttData: any = reactive({ |
46 | + mqttData: {}, | ||
47 | + }); | ||
62 | const transportMqttData: any = reactive({ | 48 | const transportMqttData: any = reactive({ |
63 | transportPayloadTypeConfiguration: { | 49 | transportPayloadTypeConfiguration: { |
64 | transportPayloadType: null, | 50 | transportPayloadType: null, |
@@ -94,33 +80,27 @@ | @@ -94,33 +80,27 @@ | ||
94 | const getFormData = async () => { | 80 | const getFormData = async () => { |
95 | let val = await validate(); | 81 | let val = await validate(); |
96 | if (!val) return; | 82 | if (!val) return; |
97 | - delete val.desc; | ||
98 | - transportMqttData.transportPayloadTypeConfiguration.transportPayloadType = | ||
99 | - val.transportPayloadType; | ||
100 | - transportMqttData.transportPayloadTypeConfiguration.enableCompatibilityWithJsonPayloadFormat = | ||
101 | - val.enableCompatibilityWithJsonPayloadFormat; | ||
102 | - transportMqttData.transportPayloadTypeConfiguration.useJsonPayloadFormatForDefaultDownlinkTopics = | ||
103 | - val.useJsonPayloadFormatForDefaultDownlinkTopics; | ||
104 | - transportMqttData.transportPayloadTypeConfiguration.deviceAttributesProtoSchema = | ||
105 | - val.deviceAttributesProtoSchema; | ||
106 | - transportMqttData.transportPayloadTypeConfiguration.deviceRpcRequestProtoSchema = | ||
107 | - val.deviceRpcRequestProtoSchema; | ||
108 | - transportMqttData.transportPayloadTypeConfiguration.deviceRpcResponseProtoSchema = | ||
109 | - val.deviceRpcResponseProtoSchema; | ||
110 | - transportMqttData.transportPayloadTypeConfiguration.deviceTelemetryProtoSchema = | ||
111 | - val.deviceTelemetryProtoSchema; | ||
112 | - allMqttData = { | 83 | + for (let o in val) { |
84 | + for (let u in transportMqttData) { | ||
85 | + if (u === 'transportPayloadTypeConfiguration') { | ||
86 | + for (let t in transportMqttData.transportPayloadTypeConfiguration) { | ||
87 | + if (t === o) { | ||
88 | + Reflect.set(transportMqttData.transportPayloadTypeConfiguration, t, val[t]); | ||
89 | + } | ||
90 | + } | ||
91 | + } | ||
92 | + } | ||
93 | + } | ||
94 | + for (let i in val) { | ||
95 | + if (i !== 'deviceAttributesTopic' && i !== 'deviceTelemetryTopic') { | ||
96 | + Reflect.deleteProperty(val, i); | ||
97 | + } | ||
98 | + } | ||
99 | + allMqttData.mqttData = { | ||
113 | ...val, | 100 | ...val, |
114 | ...transportMqttData, | 101 | ...transportMqttData, |
115 | }; | 102 | }; |
116 | - delete allMqttData.deviceTelemetryProtoSchema; | ||
117 | - delete allMqttData.deviceAttributesProtoSchema; | ||
118 | - delete allMqttData.deviceRpcRequestProtoSchema; | ||
119 | - delete allMqttData.deviceRpcResponseProtoSchema; | ||
120 | - delete allMqttData.useJsonPayloadFormatForDefaultDownlinkTopics; | ||
121 | - delete allMqttData.enableCompatibilityWithJsonPayloadFormat; | ||
122 | - delete allMqttData.transportPayloadType; | ||
123 | - return allMqttData; | 103 | + return allMqttData.mqttData; |
124 | }; | 104 | }; |
125 | defineExpose({ | 105 | defineExpose({ |
126 | getFormData, | 106 | getFormData, |
@@ -15,15 +15,15 @@ | @@ -15,15 +15,15 @@ | ||
15 | <!-- 基础表单 --> | 15 | <!-- 基础表单 --> |
16 | <!-- 触发器-begin --> | 16 | <!-- 触发器-begin --> |
17 | <!-- <Divider orientation="left">触发器</Divider> --> | 17 | <!-- <Divider orientation="left">触发器</Divider> --> |
18 | - <Divider orientation="left" | ||
19 | - ><a-tooltip> | 18 | + <Divider orientation="left"> |
19 | + <a-tooltip> | ||
20 | <template #title | 20 | <template #title |
21 | >场景联动触发的首要条件,"触发器"之间的关系为或,“执行条件”与“触发器”之间的关系为且。</template | 21 | >场景联动触发的首要条件,"触发器"之间的关系为或,“执行条件”与“触发器”之间的关系为且。</template |
22 | > | 22 | > |
23 | - 触发器<QuestionCircleOutlined | ||
24 | - :style="{ fontSize: '14px', marginLeft: '5px' }" | ||
25 | - /> </a-tooltip | ||
26 | - ></Divider> | 23 | + 触发器 |
24 | + <QuestionCircleOutlined :style="{ fontSize: '14px', marginLeft: '5px' }" /> | ||
25 | + </a-tooltip> | ||
26 | + </Divider> | ||
27 | <div> | 27 | <div> |
28 | <template v-for="(item, index) in triggerData" :key="item"> | 28 | <template v-for="(item, index) in triggerData" :key="item"> |
29 | <TriggerOrCondition | 29 | <TriggerOrCondition |
@@ -45,16 +45,16 @@ | @@ -45,16 +45,16 @@ | ||
45 | <!-- 触发器-end --> | 45 | <!-- 触发器-end --> |
46 | 46 | ||
47 | <!-- 执行条件-begin --> | 47 | <!-- 执行条件-begin --> |
48 | - <Divider orientation="left" | ||
49 | - ><a-tooltip> | 48 | + <Divider orientation="left"> |
49 | + <a-tooltip> | ||
50 | <template #title | 50 | <template #title |
51 | >场景联动触发的次要条件,"执行条件"之间的关系为或, | 51 | >场景联动触发的次要条件,"执行条件"之间的关系为或, |
52 | “执行条件”与“触发器”之间的关系为且。</template | 52 | “执行条件”与“触发器”之间的关系为且。</template |
53 | > | 53 | > |
54 | - 执行条件<QuestionCircleOutlined | ||
55 | - :style="{ fontSize: '14px', marginLeft: '5px' }" | ||
56 | - /> </a-tooltip | ||
57 | - ></Divider> | 54 | + 执行条件 |
55 | + <QuestionCircleOutlined :style="{ fontSize: '14px', marginLeft: '5px' }" /> | ||
56 | + </a-tooltip> | ||
57 | + </Divider> | ||
58 | <div> | 58 | <div> |
59 | <template v-for="(item, index) in conditionData" :key="item"> | 59 | <template v-for="(item, index) in conditionData" :key="item"> |
60 | <TriggerOrCondition | 60 | <TriggerOrCondition |
@@ -76,15 +76,15 @@ | @@ -76,15 +76,15 @@ | ||
76 | <!-- 执行条件-end --> | 76 | <!-- 执行条件-end --> |
77 | 77 | ||
78 | <!-- 执行动作-begin --> | 78 | <!-- 执行动作-begin --> |
79 | - <Divider orientation="left" | ||
80 | - ><a-tooltip> | 79 | + <Divider orientation="left"> |
80 | + <a-tooltip> | ||
81 | <template #title | 81 | <template #title |
82 | >触发器和执行条件都满足时,场景联动会做什么,例如:设备联动、告警通知等。</template | 82 | >触发器和执行条件都满足时,场景联动会做什么,例如:设备联动、告警通知等。</template |
83 | > | 83 | > |
84 | - 执行动作<QuestionCircleOutlined | ||
85 | - :style="{ fontSize: '14px', marginLeft: '5px' }" | ||
86 | - /> </a-tooltip | ||
87 | - ></Divider> | 84 | + 执行动作 |
85 | + <QuestionCircleOutlined :style="{ fontSize: '14px', marginLeft: '5px' }" /> | ||
86 | + </a-tooltip> | ||
87 | + </Divider> | ||
88 | <div> | 88 | <div> |
89 | <template v-for="(item, index) in actionData" :key="item"> | 89 | <template v-for="(item, index) in actionData" :key="item"> |
90 | <Action | 90 | <Action |
@@ -637,6 +637,30 @@ | @@ -637,6 +637,30 @@ | ||
637 | id: unref(id), | 637 | id: unref(id), |
638 | tenantId: unref(tenantId), | 638 | tenantId: unref(tenantId), |
639 | }; | 639 | }; |
640 | + //FT change | ||
641 | + let mustTriggerCondition = false; | ||
642 | + let mustCondition = false; | ||
643 | + if (postAddOrEditData?.triggers !== null && postAddOrEditData?.triggers.length > 0) { | ||
644 | + postAddOrEditData?.triggers.some((s) => { | ||
645 | + if (s.triggerCondition?.condition?.condition == undefined) { | ||
646 | + mustTriggerCondition = true; | ||
647 | + } | ||
648 | + }); | ||
649 | + } else { | ||
650 | + mustTriggerCondition = false; | ||
651 | + } | ||
652 | + if (postAddOrEditData?.doConditions !== null && postAddOrEditData?.doConditions.length > 0) { | ||
653 | + postAddOrEditData?.doConditions.some((s) => { | ||
654 | + if (s.triggerCondition?.condition?.condition == undefined) { | ||
655 | + mustCondition = true; | ||
656 | + } | ||
657 | + }); | ||
658 | + } else { | ||
659 | + mustCondition = false; | ||
660 | + } | ||
661 | + if (mustTriggerCondition) return; | ||
662 | + if (mustCondition) return; | ||
663 | + //FT change | ||
640 | await screenLinkPageAddApi(postAddOrEditData, unref(isUpdate)); | 664 | await screenLinkPageAddApi(postAddOrEditData, unref(isUpdate)); |
641 | createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); | 665 | createMessage.success(`${unref(isUpdate) ? '编辑' : '新增'}成功`); |
642 | closeDrawer(); | 666 | closeDrawer(); |
@@ -60,7 +60,7 @@ | @@ -60,7 +60,7 @@ | ||
60 | import { exportPage, deleteExportManage } from '/@/api/export/exportManager'; | 60 | import { exportPage, deleteExportManage } from '/@/api/export/exportManager'; |
61 | 61 | ||
62 | const searchInfo = reactive<Recordable>({}); | 62 | const searchInfo = reactive<Recordable>({}); |
63 | - const [registerTable, { reload, setProps, setTableData }] = useTable({ | 63 | + const [registerTable, { reload, setProps }] = useTable({ |
64 | title: '转换脚本列表', | 64 | title: '转换脚本列表', |
65 | api: exportPage, | 65 | api: exportPage, |
66 | columns, | 66 | columns, |
@@ -102,24 +102,6 @@ | @@ -102,24 +102,6 @@ | ||
102 | 102 | ||
103 | // 新增或编辑 | 103 | // 新增或编辑 |
104 | const handleCreateOrEdit = (record: Recordable | null) => { | 104 | const handleCreateOrEdit = (record: Recordable | null) => { |
105 | - setTableData([ | ||
106 | - { | ||
107 | - id: 1, | ||
108 | - reportConfigName: '11', | ||
109 | - organizationName: 0, | ||
110 | - dataType: '11', | ||
111 | - executeWay: '11', | ||
112 | - executeTime: '2022-05-21', | ||
113 | - }, | ||
114 | - { | ||
115 | - id: 2, | ||
116 | - reportConfigName: '11', | ||
117 | - organizationName: 0, | ||
118 | - dataType: '11', | ||
119 | - executeWay: '11', | ||
120 | - executeTime: '2022-05-21', | ||
121 | - }, | ||
122 | - ]); | ||
123 | if (record) { | 105 | if (record) { |
124 | openModal(true, { | 106 | openModal(true, { |
125 | isUpdate: false, | 107 | isUpdate: false, |