|
@@ -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
|
});
|