Commit 2161ab684eb059ca6cdacf6ec3d218b6ea245cba

Authored by fengtao
1 parent d2d55b61

refractor:重构设备配置里的LWM2M TB修改了数据格式

  1 +<template>
  2 + <div style="margin-left: -5vw">
  3 + <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerServer" />
  4 + </div>
  5 +</template>
  6 +<script setup lang="ts">
  7 + import { BasicForm, useForm } from '/@/components/Form';
  8 + import { serverSchemas } from '../index';
  9 +
  10 + const [registerServer, { getFieldsValue, setFieldsValue }] = useForm({
  11 + labelWidth: 180,
  12 + schemas: serverSchemas,
  13 + actionColOptions: {
  14 + span: 14,
  15 + },
  16 + });
  17 + //回显表单值
  18 + const editBootStrapFormFunc = (v) => {
  19 + setFieldsValue(v);
  20 + };
  21 +
  22 + const getBootStrapFormFunc = () => {
  23 + const value = getFieldsValue();
  24 + if (!value) return;
  25 + return value;
  26 + };
  27 + defineExpose({
  28 + getBootStrapFormFunc,
  29 + editBootStrapFormFunc,
  30 + });
  31 +</script>
  32 +<style lang="less" scoped></style>
@@ -45,268 +45,6 @@ export const modelSchemas: FormSchema[] = [ @@ -45,268 +45,6 @@ export const modelSchemas: FormSchema[] = [
45 }, 45 },
46 ]; 46 ];
47 47
48 -export const serverSchemas: FormSchema[] = [  
49 - //servers  
50 - {  
51 - field: 'shortId',  
52 - component: 'InputNumber',  
53 - label: 'Short ID',  
54 - required: true,  
55 - defaultValue: 123,  
56 - colProps: { span: 8 },  
57 - },  
58 - {  
59 - field: 'lifetime',  
60 - component: 'InputNumber',  
61 - label: '客户端注册生存期',  
62 - required: true,  
63 - defaultValue: 300,  
64 - colProps: { span: 8 },  
65 - },  
66 - {  
67 - field: 'defaultMinPeriod',  
68 - component: 'InputNumber',  
69 - label: '两次通知之间的最短期限',  
70 - required: true,  
71 - defaultValue: 1,  
72 - colProps: { span: 8 },  
73 - },  
74 - {  
75 - field: 'binding',  
76 - component: 'Select',  
77 - label: 'Binding',  
78 - defaultValue: 'UQ',  
79 - componentProps: {  
80 - options: [  
81 - {  
82 - label: 'U: UDP connection in standard mode',  
83 - value: 'U',  
84 - },  
85 - {  
86 - label: 'UQ: UDP connection in queue mode',  
87 - value: 'UQ',  
88 - },  
89 - {  
90 - label: 'T: TCP connection in standard mode',  
91 - value: 'T',  
92 - },  
93 - {  
94 - label: 'TQ: TCP connection in queue mode',  
95 - value: 'TQ',  
96 - },  
97 - {  
98 - label: 'S: SMS connection in standard mode',  
99 - value: 'S',  
100 - },  
101 - {  
102 - label: 'SQ: SMS connection in queue mode',  
103 - value: 'SQ',  
104 - },  
105 - {  
106 - label: 'US: both UDP and SMS connections active, both in standard mode',  
107 - value: 'US',  
108 - },  
109 - {  
110 - label: 'TS: both TCP and SMS connections active, both in standard mode',  
111 - value: 'TS',  
112 - },  
113 - {  
114 - label:  
115 - 'UQS: both UDP and SMS connections active; UDP in queue mode, SMS in standard mode',  
116 - value: 'UQS',  
117 - },  
118 - {  
119 - label:  
120 - 'TQS: both TCP and SMS connections active; TCP in queue mode, SMS in standard mode',  
121 - value: 'TQS',  
122 - },  
123 - ],  
124 - },  
125 - colProps: { span: 11 },  
126 - },  
127 - {  
128 - field: 'notifIfDisabled',  
129 - label: '启用',  
130 - colProps: { span: 22 },  
131 - component: 'Checkbox',  
132 - defaultValue: true,  
133 - renderComponentContent: '禁用或脱机时的通知存储',  
134 - },  
135 - //servers  
136 - //Bootstrap Server  
137 - {  
138 - field: 'securityMode',  
139 - component: 'Select',  
140 - label: '配置模式',  
141 - defaultValue: 'NO_SEC',  
142 - componentProps: {  
143 - options: [  
144 - {  
145 - label: 'No Security',  
146 - value: 'NO_SEC',  
147 - },  
148 - {  
149 - label: 'Pre-Shared Key',  
150 - value: 'PSK',  
151 - },  
152 - {  
153 - label: 'Raw Public Key',  
154 - value: 'RPK',  
155 - },  
156 - {  
157 - label: 'X.509 Certificate',  
158 - value: 'X509',  
159 - },  
160 - ],  
161 - },  
162 - colProps: { span: 8 },  
163 - },  
164 - {  
165 - field: 'host',  
166 - component: 'Input',  
167 - label: 'Host',  
168 - required: true,  
169 - defaultValue: 'localhost',  
170 - colProps: { span: 8 },  
171 - },  
172 - {  
173 - field: 'port',  
174 - component: 'InputNumber',  
175 - label: 'Port',  
176 - required: true,  
177 - defaultValue: 5687,  
178 - colProps: { span: 8 },  
179 - },  
180 - {  
181 - field: 'serverId',  
182 - component: 'InputNumber',  
183 - label: 'Short ID',  
184 - required: true,  
185 - defaultValue: 111,  
186 - colProps: { span: 8 },  
187 - },  
188 - {  
189 - field: 'clientHoldOffTime',  
190 - component: 'InputNumber',  
191 - label: '拖延时间',  
192 - required: true,  
193 - defaultValue: 1,  
194 - colProps: { span: 8 },  
195 - },  
196 - {  
197 - field: 'bootstrapServerAccountTimeout2',  
198 - component: 'InputNumber',  
199 - label: '超时后的帐户',  
200 - required: true,  
201 - defaultValue: 0,  
202 - colProps: { span: 8 },  
203 - },  
204 - {  
205 - field: 'serverPublicKey',  
206 - component: 'InputTextArea',  
207 - label: '服务器公钥',  
208 - required: true,  
209 - defaultValue: `3059301306072a8648ce3d020106082a8648ce3d03010703420004e353af009b814ee2f9ab393a975e0c  
210 - 39e2fff60e3603fd6ee54a43b89a4f56258a7aa9c7e4a577760edb289dc955d91968473ee8a1bfc2b9c423563796113009`,  
211 - colProps: { span: 22 },  
212 - componentProps: {  
213 - autoSize: {  
214 - maxRows: 10,  
215 - },  
216 - },  
217 - ifShow: ({ values }) =>  
218 - isCertificate(Reflect.get(values, 'securityMode')) ||  
219 - isPawPublicKey(Reflect.get(values, 'securityMode')),  
220 - },  
221 - //Bootstrap Server  
222 - //LwM2M Server  
223 - {  
224 - field: 'securityMode1',  
225 - component: 'Select',  
226 - label: '配置模式',  
227 - defaultValue: 'NO_SEC',  
228 - componentProps: {  
229 - options: [  
230 - {  
231 - label: 'No Security',  
232 - value: 'NO_SEC',  
233 - },  
234 - {  
235 - label: 'Pre-Shared Key',  
236 - value: 'PSK',  
237 - },  
238 - {  
239 - label: 'Raw Public Key',  
240 - value: 'RPK',  
241 - },  
242 - {  
243 - label: 'X.509 Certificate',  
244 - value: 'X509',  
245 - },  
246 - ],  
247 - },  
248 - colProps: { span: 8 },  
249 - },  
250 - {  
251 - field: 'host1',  
252 - component: 'Input',  
253 - label: 'Host',  
254 - required: true,  
255 - defaultValue: 'localhost',  
256 - colProps: { span: 8 },  
257 - },  
258 - {  
259 - field: 'port1',  
260 - component: 'InputNumber',  
261 - label: 'Port',  
262 - required: true,  
263 - defaultValue: 5685,  
264 - colProps: { span: 8 },  
265 - },  
266 - {  
267 - field: 'serverId1',  
268 - component: 'InputNumber',  
269 - label: 'Short ID',  
270 - required: true,  
271 - defaultValue: 123,  
272 - colProps: { span: 8 },  
273 - },  
274 - {  
275 - field: 'clientHoldOffTime1',  
276 - component: 'InputNumber',  
277 - label: '拖延时间',  
278 - required: true,  
279 - defaultValue: 1,  
280 - colProps: { span: 8 },  
281 - },  
282 - {  
283 - field: 'bootstrapServerAccountTimeout1',  
284 - component: 'InputNumber',  
285 - label: '超时后的帐户',  
286 - required: true,  
287 - defaultValue: 0,  
288 - colProps: { span: 8 },  
289 - },  
290 - {  
291 - field: 'serverPublicKey1',  
292 - component: 'InputTextArea',  
293 - label: '服务器公钥',  
294 - required: true,  
295 - defaultValue: `3059301306072a8648ce3d020106082a8648ce3d03010703420004e353af009b814ee2f9ab393a975e0  
296 - c39e2fff60e3603fd6ee54a43b89a4f56258a7aa9c7e4a577760edb289dc955d91968473ee8a1bfc2b9c423563796113009`,  
297 - colProps: { span: 22 },  
298 - componentProps: {  
299 - autoSize: {  
300 - maxRows: 10,  
301 - },  
302 - },  
303 - ifShow: ({ values }) =>  
304 - isCertificate(Reflect.get(values, 'securityMode1')) ||  
305 - isPawPublicKey(Reflect.get(values, 'securityMode1')),  
306 - },  
307 - //LwM2M Server  
308 -];  
309 -  
310 export const settingsSchemas: FormSchema[] = [ 48 export const settingsSchemas: FormSchema[] = [
311 { 49 {
312 field: 'fwUpdateStrategy', 50 field: 'fwUpdateStrategy',
@@ -556,3 +294,169 @@ export const deviceSchemas: FormSchema[] = [ @@ -556,3 +294,169 @@ export const deviceSchemas: FormSchema[] = [
556 `, 294 `,
557 }, 295 },
558 ]; 296 ];
  297 +
  298 +export const serverSchemas: FormSchema[] = [
  299 + {
  300 + field: 'securityMode',
  301 + component: 'Select',
  302 + label: '安全配置模式',
  303 + defaultValue: 'NO_SEC',
  304 + componentProps: {
  305 + options: [
  306 + {
  307 + label: 'No Security',
  308 + value: 'NO_SEC',
  309 + },
  310 + {
  311 + label: 'Pre-Shared Key',
  312 + value: 'PSK',
  313 + },
  314 + {
  315 + label: 'Raw Public Key',
  316 + value: 'RPK',
  317 + },
  318 + {
  319 + label: 'X.509 Certificate',
  320 + value: 'X509',
  321 + },
  322 + ],
  323 + },
  324 + colProps: { span: 8 },
  325 + },
  326 + {
  327 + field: 'shortServerId',
  328 + component: 'InputNumber',
  329 + label: '短服务器ID',
  330 + required: true,
  331 + defaultValue: 123,
  332 + colProps: { span: 8 },
  333 + },
  334 + {
  335 + field: 'host',
  336 + component: 'Input',
  337 + label: '主机',
  338 + required: true,
  339 + defaultValue: '0.0.0.0',
  340 + colProps: { span: 8 },
  341 + },
  342 + {
  343 + field: 'port',
  344 + component: 'Input',
  345 + label: '端口',
  346 + required: true,
  347 + defaultValue: 5685,
  348 + colProps: { span: 8 },
  349 + },
  350 + {
  351 + field: 'clientHoldOffTime',
  352 + component: 'InputNumber',
  353 + label: '延迟时间',
  354 + required: true,
  355 + defaultValue: 1,
  356 + colProps: { span: 8 },
  357 + },
  358 + {
  359 + field: 'bootstrapServerAccountTimeout',
  360 + component: 'InputNumber',
  361 + label: '超时后的帐户',
  362 + required: true,
  363 + defaultValue: 0,
  364 + colProps: { span: 8 },
  365 + },
  366 + {
  367 + field: 'lifetime',
  368 + component: 'InputNumber',
  369 + label: '注册生存期',
  370 + required: true,
  371 + defaultValue: 300,
  372 + colProps: { span: 8 },
  373 + },
  374 + {
  375 + field: 'defaultMinPeriod',
  376 + component: 'InputNumber',
  377 + label: '两次通知之间的最小周期',
  378 + required: true,
  379 + defaultValue: 1,
  380 + colProps: { span: 8 },
  381 + },
  382 + {
  383 + field: 'binding',
  384 + component: 'Select',
  385 + label: 'Binding',
  386 + defaultValue: 'UQ',
  387 + componentProps: {
  388 + options: [
  389 + {
  390 + label: 'U: Client is reachable via the UDP binding at any time.',
  391 + value: 'U',
  392 + },
  393 + {
  394 + label: 'M: Client is reachable via the MQTT binding at any time.',
  395 + value: 'M',
  396 + },
  397 + {
  398 + label: 'H: Client is reachable via the HTTP binding at any time.',
  399 + value: 'H',
  400 + },
  401 + {
  402 + label: 'T: Client is reachable via the TCP binding at any time.',
  403 + value: 'T',
  404 + },
  405 + {
  406 + label: 'S: Client is reachable via the SMS binding at any time.',
  407 + value: 'S',
  408 + },
  409 + {
  410 + label:
  411 + 'N: Client MUST send the response to such a request over the Non-IP binding (is supported since LWM',
  412 + value: 'N',
  413 + },
  414 + {
  415 + label: 'UQ: UDP connection in queue mode (is not supported since LWM2M 1.1)',
  416 + value: 'UQ',
  417 + },
  418 + {
  419 + label:
  420 + 'UQS: both UDP and SMS connections active; UDP in queue mode, SMS in standard mode (is not supported since LWM2M 1.1)',
  421 + value: 'UQS',
  422 + },
  423 + {
  424 + label: 'TQ: TCP connection in queue mode (is not supported since LWM2M 1.1)',
  425 + value: 'TQ:',
  426 + },
  427 + {
  428 + label:
  429 + 'TQS: both TCP and SMS connections active; TCP in queue mode, SMS in standard mode (is not supported since LWM2M 1.1) ',
  430 + value: 'TQS',
  431 + },
  432 + {
  433 + label: 'SQ: SMS connection in queue mode (is not supported since LWM2M 1.1)',
  434 + value: 'SQ',
  435 + },
  436 + ],
  437 + },
  438 + colProps: { span: 11 },
  439 + },
  440 + {
  441 + field: 'notifIfDisabled',
  442 + label: '是否启用',
  443 + colProps: { span: 22 },
  444 + component: 'Checkbox',
  445 + defaultValue: true,
  446 + renderComponentContent: '禁用或脱机时的通知存储',
  447 + },
  448 + {
  449 + field: 'serverPublicKey',
  450 + component: 'InputTextArea',
  451 + label: '服务器公钥',
  452 + required: true,
  453 + colProps: { span: 22 },
  454 + componentProps: {
  455 + maxLength: 255,
  456 + placeholder: '请输入服务器公钥',
  457 + },
  458 + ifShow: ({ values }) =>
  459 + isCertificate(Reflect.get(values, 'securityMode')) ||
  460 + isPawPublicKey(Reflect.get(values, 'securityMode')),
  461 + },
  462 +];
@@ -6,21 +6,39 @@ @@ -6,21 +6,39 @@
6 :animated="true" 6 :animated="true"
7 @change="handleChange" 7 @change="handleChange"
8 > 8 >
9 - <TabPane key="1" tab="LWM2M Model"> 9 + <TabPane forceRender key="1" tab="LWM2M Model">
10 <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerModel" /> 10 <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerModel" />
11 </TabPane> 11 </TabPane>
12 - <TabPane key="2" tab="Servers">  
13 - <div style="display: flex; width: 43vw; border: 1px solid gray; border-radius: 5px">  
14 - <div style="margin-left: -4.6vw; margin-top: 1.5vh">  
15 - <BasicForm  
16 - :showResetButton="false"  
17 - :showSubmitButton="false"  
18 - @register="registerServer"  
19 - /> 12 + <TabPane forceRender key="2" tab="Bootstrap">
  13 + <div>
  14 + <Checkbox v-model:checked="bootstrapServerUpdateEnable">包括引导服务器更新</Checkbox>
  15 + <Card
  16 + v-for="(item, index) in dynamicBOOTSTRAP.bootstrap"
  17 + :key="item"
  18 + title="LwM2M Server"
  19 + style="width: 99%; margin-top: 2vh"
  20 + >
  21 + <template #extra>
  22 + <Button size="small" type="dashed" @click="handleRemove(index)">
  23 + <template #icon>
  24 + <MinusCircleOutlined />
  25 + </template>
  26 + </Button>
  27 + </template>
  28 + <!-- BootStrapForm表单项 -->
  29 + <BootStrapForm :ref="dynamicBindRef.BootStrapFormItemRef" :index="index" :item="item" />
  30 + </Card>
  31 + <div style="margin-top: 2vh">
  32 + <Button size="middle" type="dashed" @click="handleAdd">
  33 + <template #icon>
  34 + <PlusCircleOutlined />
  35 + </template>
  36 + Add LwM2M Server
  37 + </Button>
20 </div> 38 </div>
21 </div> 39 </div>
22 </TabPane> 40 </TabPane>
23 - <TabPane key="3" tab="Other settings"> 41 + <TabPane forceRender key="3" tab="Other settings">
24 <div 42 <div
25 style=" 43 style="
26 display: flex; 44 display: flex;
@@ -39,7 +57,7 @@ @@ -39,7 +57,7 @@
39 </div> 57 </div>
40 </div> 58 </div>
41 </TabPane> 59 </TabPane>
42 - <TabPane key="4" tab="Json Config Profile Device"> 60 + <TabPane forceRender key="4" tab="Json Config Profile Device">
43 <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerDevice" /> 61 <BasicForm :showResetButton="false" :showSubmitButton="false" @register="registerDevice" />
44 </TabPane> 62 </TabPane>
45 </Tabs> 63 </Tabs>
@@ -47,10 +65,13 @@ @@ -47,10 +65,13 @@
47 </template> 65 </template>
48 66
49 <script lang="ts"> 67 <script lang="ts">
50 - import { defineComponent, ref, reactive, nextTick } from 'vue';  
51 - import { Tabs } from 'ant-design-vue'; 68 + import { defineComponent, ref, reactive, nextTick, unref } from 'vue';
  69 + import { Tabs, Card } from 'ant-design-vue';
52 import { BasicForm, useForm } from '/@/components/Form'; 70 import { BasicForm, useForm } from '/@/components/Form';
53 - import { modelSchemas, serverSchemas, settingsSchemas, deviceSchemas } from './index'; 71 + import { modelSchemas, settingsSchemas, deviceSchemas } from './index';
  72 + import BootStrapForm from './cpns/BootStrapForm.vue';
  73 + import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons-vue';
  74 + import { Button, Checkbox } from 'ant-design-vue';
54 75
55 export default defineComponent({ 76 export default defineComponent({
56 name: 'index', 77 name: 'index',
@@ -58,18 +79,26 @@ @@ -58,18 +79,26 @@
58 Tabs, 79 Tabs,
59 TabPane: Tabs.TabPane, 80 TabPane: Tabs.TabPane,
60 BasicForm, 81 BasicForm,
  82 + BootStrapForm,
  83 + MinusCircleOutlined,
  84 + Card,
  85 + PlusCircleOutlined,
  86 + Button,
  87 + Checkbox,
61 }, 88 },
62 setup() { 89 setup() {
  90 + const bootstrapServerUpdateEnable = ref(false);
  91 + const dynamicBOOTSTRAP: any = reactive({
  92 + bootstrap: [{}],
  93 + });
  94 + const dynamicBindRef: any = {
  95 + BootStrapFormItemRef: ref([]),
  96 + };
63 const currentKey = ref('1'); 97 const currentKey = ref('1');
64 const currentSize = ref('large'); 98 const currentSize = ref('large');
65 let allObj: any = reactive({}); 99 let allObj: any = reactive({});
66 let allEchoObj: any = reactive({}); 100 let allEchoObj: any = reactive({});
67 let allEchoStatus = ref(false); 101 let allEchoStatus = ref(false);
68 - let bootstrapObj = reactive({  
69 - servers: {},  
70 - bootstrapServer: {},  
71 - lwm2mServer: {},  
72 - });  
73 let clientLwM2mSettingsObj = reactive({}); 102 let clientLwM2mSettingsObj = reactive({});
74 let observeAttrObj = reactive({ 103 let observeAttrObj = reactive({
75 attribute: [], 104 attribute: [],
@@ -90,20 +119,6 @@ @@ -90,20 +119,6 @@
90 }, 119 },
91 }); 120 });
92 const [ 121 const [
93 - registerServer,  
94 - {  
95 - resetFields: resetServerValue,  
96 - validate: serverValidate,  
97 - setFieldsValue: serverSetFieldsValueFunc,  
98 - },  
99 - ] = useForm({  
100 - labelWidth: 180,  
101 - schemas: serverSchemas,  
102 - actionColOptions: {  
103 - span: 14,  
104 - },  
105 - });  
106 - const [  
107 registerSettings, 122 registerSettings,
108 { 123 {
109 resetFields: resetSettingsValue, 124 resetFields: resetSettingsValue,
@@ -126,6 +141,12 @@ @@ -126,6 +141,12 @@
126 }, 141 },
127 }); 142 });
128 143
  144 + const handleAdd = () => {
  145 + dynamicBOOTSTRAP.bootstrap.push({});
  146 + };
  147 + const handleRemove = (index) => {
  148 + dynamicBOOTSTRAP.bootstrap.splice(index, 1);
  149 + };
129 const handleChange = (e) => { 150 const handleChange = (e) => {
130 if (allEchoStatus.value) { 151 if (allEchoStatus.value) {
131 switch (e) { 152 switch (e) {
@@ -133,36 +154,14 @@ @@ -133,36 +154,14 @@
133 break; 154 break;
134 case '2': 155 case '2':
135 nextTick(() => { 156 nextTick(() => {
136 - serverSetFieldsValueFunc({  
137 - //servers  
138 - binding: allEchoObj?.bootstrap?.servers?.binding,  
139 - shortId: allEchoObj?.bootstrap?.servers?.shortId,  
140 - lifetime: allEchoObj?.bootstrap?.servers?.lifetime,  
141 - notifIfDisabled: allEchoObj?.bootstrap?.servers?.notifIfDisabled,  
142 - defaultMinPeriod: allEchoObj?.bootstrap?.servers?.defaultMinPeriod,  
143 - bootstrapServerAccountTimeout:  
144 - allEchoObj?.bootstrap?.servers?.bootstrapServerAccountTimeout,  
145 - //servers  
146 - //lwm2mServer  
147 - host1: allEchoObj?.bootstrap?.lwm2mServer?.host,  
148 - port1: allEchoObj?.bootstrap?.lwm2mServer?.port,  
149 - serverId1: allEchoObj?.bootstrap?.lwm2mServer?.serverId,  
150 - securityMode1: allEchoObj?.bootstrap?.lwm2mServer?.securityMode,  
151 - serverPublicKey1: allEchoObj?.bootstrap?.lwm2mServer?.serverPublicKey,  
152 - clientHoldOffTime1: allEchoObj?.bootstrap?.lwm2mServer?.clientHoldOffTime,  
153 - bootstrapServerAccountTimeout1:  
154 - allEchoObj?.bootstrap?.lwm2mServer?.bootstrapServerAccountTimeout,  
155 - //lwm2mServer  
156 - //bootstrapServer  
157 - host: allEchoObj?.bootstrap?.bootstrapServer?.host,  
158 - port: allEchoObj?.bootstrap?.bootstrapServer?.port,  
159 - serverId: allEchoObj?.bootstrap?.bootstrapServer?.serverId,  
160 - securityMode: allEchoObj?.bootstrap?.bootstrapServer?.securityMode,  
161 - serverPublicKey: allEchoObj?.bootstrap?.bootstrapServer?.serverPublicKey,  
162 - clientHoldOffTime: allEchoObj?.bootstrap?.bootstrapServer?.clientHoldOffTime,  
163 - bootstrapServerAccountTimeout2:  
164 - allEchoObj?.bootstrap?.servers?.bootstrapServerAccountTimeout,  
165 - //bootstrapServer 157 + bootstrapServerUpdateEnable.value = allEchoObj.bootstrapServerUpdateEnable;
  158 + dynamicBOOTSTRAP.bootstrap = allEchoObj.bootstrap;
  159 + dynamicBOOTSTRAP.bootstrap.forEach((bootstrap, index: number) => {
  160 + nextTick(() => {
  161 + unref(dynamicBindRef.BootStrapFormItemRef)[index]?.editBootStrapFormFunc(
  162 + bootstrap
  163 + );
  164 + });
166 }); 165 });
167 }); 166 });
168 break; 167 break;
@@ -196,43 +195,22 @@ @@ -196,43 +195,22 @@
196 allEchoStatus.value = true; 195 allEchoStatus.value = true;
197 } 196 }
198 }; 197 };
  198 + const tempBootStrap: any = [];
  199 + const getBootStrapFormValue = () => {
  200 + //获取BootStrap的值
  201 + unref(dynamicBindRef.BootStrapFormItemRef)?.map((item: any) =>
  202 + tempBootStrap.push(item.getBootStrapFormFunc())
  203 + );
  204 + };
199 205
200 const getDataFunc = async () => { 206 const getDataFunc = async () => {
201 const objectListVal = getObjectListValue(); 207 const objectListVal = getObjectListValue();
202 const deviceVal = getDeviceValue(); 208 const deviceVal = getDeviceValue();
203 console.log('第一个tab', objectListVal); 209 console.log('第一个tab', objectListVal);
204 console.log('第四个tab', deviceVal); 210 console.log('第四个tab', deviceVal);
205 - const serverVal = await serverValidate(); 211 + getBootStrapFormValue();
206 const settingsVal = await settingsValidate(); 212 const settingsVal = await settingsValidate();
207 - if (!serverVal) return;  
208 if (!settingsVal) return; 213 if (!settingsVal) return;
209 - Reflect.set(bootstrapObj.servers, 'binding', serverVal.binding);  
210 - Reflect.set(bootstrapObj.servers, 'shortId', serverVal.shortId);  
211 - Reflect.set(bootstrapObj.servers, 'lifetime', serverVal.lifetime);  
212 - Reflect.set(bootstrapObj.servers, 'notifIfDisabled', serverVal.notifIfDisabled);  
213 - Reflect.set(bootstrapObj.servers, 'defaultMinPeriod', serverVal.defaultMinPeriod);  
214 - Reflect.set(bootstrapObj.bootstrapServer, 'serverId', serverVal.serverId);  
215 - Reflect.set(bootstrapObj.bootstrapServer, 'host', serverVal.host);  
216 - Reflect.set(bootstrapObj.bootstrapServer, 'port', serverVal.port);  
217 - Reflect.set(bootstrapObj.bootstrapServer, 'securityMode', serverVal.securityMode);  
218 - Reflect.set(bootstrapObj.bootstrapServer, 'serverPublicKey', serverVal.serverPublicKey);  
219 - Reflect.set(bootstrapObj.bootstrapServer, 'clientHoldOffTime', serverVal.clientHoldOffTime);  
220 - Reflect.set(  
221 - bootstrapObj.servers,  
222 - 'bootstrapServerAccountTimeout',  
223 - serverVal.bootstrapServerAccountTimeout2  
224 - );  
225 - Reflect.set(bootstrapObj.lwm2mServer, 'serverId', serverVal.serverId1);  
226 - Reflect.set(bootstrapObj.lwm2mServer, 'host', serverVal.host1);  
227 - Reflect.set(bootstrapObj.lwm2mServer, 'port', serverVal.port1);  
228 - Reflect.set(bootstrapObj.lwm2mServer, 'securityMode', serverVal.securityMode1);  
229 - Reflect.set(bootstrapObj.lwm2mServer, 'serverPublicKey', serverVal.serverPublicKey1);  
230 - Reflect.set(bootstrapObj.lwm2mServer, 'clientHoldOffTime', serverVal.clientHoldOffTime1);  
231 - Reflect.set(  
232 - bootstrapObj.lwm2mServer,  
233 - 'bootstrapServerAccountTimeout',  
234 - serverVal.bootstrapServerAccountTimeout1  
235 - );  
236 delete settingsVal.unit; 214 delete settingsVal.unit;
237 delete settingsVal.unit2; 215 delete settingsVal.unit2;
238 clientLwM2mSettingsObj = { 216 clientLwM2mSettingsObj = {
@@ -243,8 +221,9 @@ @@ -243,8 +221,9 @@
243 clientLwM2mSettings: clientLwM2mSettingsObj, 221 clientLwM2mSettings: clientLwM2mSettingsObj,
244 }, 222 },
245 ...{ 223 ...{
246 - bootstrap: bootstrapObj, 224 + bootstrap: tempBootStrap,
247 }, 225 },
  226 + ...{ bootstrapServerUpdateEnable: bootstrapServerUpdateEnable.value },
248 ...{ 227 ...{
249 observeAttr: observeAttrObj, 228 observeAttr: observeAttrObj,
250 }, 229 },
@@ -257,7 +236,6 @@ @@ -257,7 +236,6 @@
257 allEchoStatus.value = false; 236 allEchoStatus.value = false;
258 nextTick(() => { 237 nextTick(() => {
259 resetObjectListValue(); 238 resetObjectListValue();
260 - resetServerValue();  
261 resetSettingsValue(); 239 resetSettingsValue();
262 resetDeviceValue(); 240 resetDeviceValue();
263 }); 241 });
@@ -267,13 +245,17 @@ @@ -267,13 +245,17 @@
267 currentKey, 245 currentKey,
268 currentSize, 246 currentSize,
269 registerModel, 247 registerModel,
270 - registerServer,  
271 registerSettings, 248 registerSettings,
272 registerDevice, 249 registerDevice,
273 getDataFunc, 250 getDataFunc,
274 setStepFieldsValueFunc, 251 setStepFieldsValueFunc,
275 handleChange, 252 handleChange,
276 resetStepFieldsValueFunc, 253 resetStepFieldsValueFunc,
  254 + dynamicBOOTSTRAP,
  255 + dynamicBindRef,
  256 + handleAdd,
  257 + handleRemove,
  258 + bootstrapServerUpdateEnable,
277 }; 259 };
278 }, 260 },
279 }); 261 });