Commit e875774465bdfe1a78fff802d39503406c304a7b
Merge branch 'f-dev' into 'main'
pref:翻译数据流转字段 See merge request huang/yun-teng-iot-front!261
Showing
15 changed files
with
652 additions
and
591 deletions
@@ -93,6 +93,7 @@ export const formSchema: FormSchema[] = [ | @@ -93,6 +93,7 @@ export const formSchema: FormSchema[] = [ | ||
93 | component: 'Input', | 93 | component: 'Input', |
94 | componentProps: { | 94 | componentProps: { |
95 | placeholder: '请输入手机号码', | 95 | placeholder: '请输入手机号码', |
96 | + maxLength: 11, | ||
96 | }, | 97 | }, |
97 | rules: phoneRule, | 98 | rules: phoneRule, |
98 | }, | 99 | }, |
@@ -4,6 +4,12 @@ import { deviceProfile, getGATEWAYdevice } from '/@/api/device/deviceManager'; | @@ -4,6 +4,12 @@ import { deviceProfile, getGATEWAYdevice } from '/@/api/device/deviceManager'; | ||
4 | import { getOrganizationList } from '/@/api/system/system'; | 4 | import { getOrganizationList } from '/@/api/system/system'; |
5 | import { copyTransFun } from '/@/utils/fnUtils'; | 5 | import { copyTransFun } from '/@/utils/fnUtils'; |
6 | 6 | ||
7 | +export enum TypeEnum { | ||
8 | + IS_GATEWAY = 'GATEWAY', | ||
9 | +} | ||
10 | +export const isGateWay = (type: string) => { | ||
11 | + return type === TypeEnum.IS_GATEWAY; | ||
12 | +}; | ||
7 | // 第一步的表单 | 13 | // 第一步的表单 |
8 | export const step1Schemas: FormSchema[] = [ | 14 | export const step1Schemas: FormSchema[] = [ |
9 | { | 15 | { |
@@ -45,6 +51,27 @@ export const step1Schemas: FormSchema[] = [ | @@ -45,6 +51,27 @@ export const step1Schemas: FormSchema[] = [ | ||
45 | }, | 51 | }, |
46 | }, | 52 | }, |
47 | { | 53 | { |
54 | + field: 'field7', | ||
55 | + component: 'RadioGroup', | ||
56 | + label: '选择厂家', | ||
57 | + colProps: { | ||
58 | + span: 8, | ||
59 | + }, | ||
60 | + componentProps: { | ||
61 | + options: [ | ||
62 | + { | ||
63 | + label: '自定义厂家', | ||
64 | + value: '1', | ||
65 | + }, | ||
66 | + { | ||
67 | + label: 'TBox边缘网关', | ||
68 | + value: '2', | ||
69 | + }, | ||
70 | + ], | ||
71 | + }, | ||
72 | + ifShow: ({ values }) => isGateWay(values.deviceType), | ||
73 | + }, | ||
74 | + { | ||
48 | field: 'profileId', | 75 | field: 'profileId', |
49 | label: '设备配置', | 76 | label: '设备配置', |
50 | required: true, | 77 | required: true, |
@@ -120,7 +120,7 @@ | @@ -120,7 +120,7 @@ | ||
120 | 120 | ||
121 | const [register, { validate, resetFields, setFieldsValue, getFieldsValue, updateSchema }] = | 121 | const [register, { validate, resetFields, setFieldsValue, getFieldsValue, updateSchema }] = |
122 | useForm({ | 122 | useForm({ |
123 | - labelWidth: 100, | 123 | + labelWidth: 120, |
124 | schemas: step1Schemas, | 124 | schemas: step1Schemas, |
125 | actionColOptions: { | 125 | actionColOptions: { |
126 | span: 14, | 126 | span: 14, |
@@ -387,4 +387,7 @@ | @@ -387,4 +387,7 @@ | ||
387 | width: 450px; | 387 | width: 450px; |
388 | margin: 0 auto; | 388 | margin: 0 auto; |
389 | } | 389 | } |
390 | + :deep(.ant-radio-group) { | ||
391 | + width: 15vw; | ||
392 | + } | ||
390 | </style> | 393 | </style> |
@@ -52,7 +52,13 @@ | @@ -52,7 +52,13 @@ | ||
52 | <div class="mt-4"> | 52 | <div class="mt-4"> |
53 | <a-button type="primary" class="mr-4" @click="copyTbDeviceId">复制设备ID</a-button> | 53 | <a-button type="primary" class="mr-4" @click="copyTbDeviceId">复制设备ID</a-button> |
54 | <a-button type="primary" class="mr-4" @click="copyDeviceToken">复制访问令牌</a-button> | 54 | <a-button type="primary" class="mr-4" @click="copyDeviceToken">复制访问令牌</a-button> |
55 | - <a-button type="primary" @click="manageDeviceToken">管理设备凭证</a-button> | 55 | + <a-button type="primary" class="mr-4" @click="manageDeviceToken">管理设备凭证</a-button> |
56 | + <a-button | ||
57 | + type="primary" | ||
58 | + v-if="deviceDetail.deviceType == 'GATEWAY'" | ||
59 | + @click="remoteConnectiondGateway" | ||
60 | + >远程连接边缘网关</a-button | ||
61 | + > | ||
56 | <ManageDeviceTokenModal @register="registerModal" /> | 62 | <ManageDeviceTokenModal @register="registerModal" /> |
57 | </div> | 63 | </div> |
58 | <div v-if="deviceDetail?.deviceInfo?.address" class="mt-4"> | 64 | <div v-if="deviceDetail?.deviceInfo?.address" class="mt-4"> |
@@ -160,6 +166,7 @@ | @@ -160,6 +166,7 @@ | ||
160 | }; | 166 | }; |
161 | 167 | ||
162 | const [registerTopicModal, { openModal: openTopicModal }] = useModal(); | 168 | const [registerTopicModal, { openModal: openTopicModal }] = useModal(); |
169 | + const remoteConnectiondGateway = () => {}; | ||
163 | 170 | ||
164 | return { | 171 | return { |
165 | wrapRef, | 172 | wrapRef, |
@@ -173,6 +180,7 @@ | @@ -173,6 +180,7 @@ | ||
173 | registerTopicModal, | 180 | registerTopicModal, |
174 | DeviceTypeEnum, | 181 | DeviceTypeEnum, |
175 | copyTopic, | 182 | copyTopic, |
183 | + remoteConnectiondGateway, | ||
176 | }; | 184 | }; |
177 | }, | 185 | }, |
178 | }); | 186 | }); |
@@ -81,10 +81,12 @@ | @@ -81,10 +81,12 @@ | ||
81 | let profileDataObj: any = reactive({ | 81 | let profileDataObj: any = reactive({ |
82 | profileData: null, | 82 | profileData: null, |
83 | }); | 83 | }); |
84 | - | 84 | + let isEdit = ref(true); |
85 | + let noEditObj: any = reactive({}); | ||
85 | const getTitle = computed(() => | 86 | const getTitle = computed(() => |
86 | isUpdate.value == 1 ? '新增设备配置' : isUpdate.value == 2 ? '编辑设备配置' : '设备配置详情' | 87 | isUpdate.value == 1 ? '新增设备配置' : isUpdate.value == 2 ? '编辑设备配置' : '设备配置详情' |
87 | ); | 88 | ); |
89 | + const editTransportType = ref(''); | ||
88 | const getViewTitle = computed(() => (!unref(isShowOkBtnFalse) ? '设备配置详情' : '')); | 90 | const getViewTitle = computed(() => (!unref(isShowOkBtnFalse) ? '设备配置详情' : '')); |
89 | const [register, { closeModal }] = useModalInner(async (data) => { | 91 | const [register, { closeModal }] = useModalInner(async (data) => { |
90 | isUpdate.value = data.isUpdate; | 92 | isUpdate.value = data.isUpdate; |
@@ -92,12 +94,15 @@ | @@ -92,12 +94,15 @@ | ||
92 | handleCancel(); | 94 | handleCancel(); |
93 | isShowOkBtnFalse.value = true; | 95 | isShowOkBtnFalse.value = true; |
94 | current.value = 0; | 96 | current.value = 0; |
97 | + isEdit.value = false; | ||
95 | } else if (isUpdate.value == 2) { | 98 | } else if (isUpdate.value == 2) { |
99 | + isEdit.value = true; | ||
96 | handleCancel(); | 100 | handleCancel(); |
97 | isShowOkBtnFalse.value = true; | 101 | isShowOkBtnFalse.value = true; |
98 | current.value = 0; | 102 | current.value = 0; |
99 | postEditId.value = data.record.id; | 103 | postEditId.value = data.record.id; |
100 | createTime.value = data.record.createTime; | 104 | createTime.value = data.record.createTime; |
105 | + editTransportType.value = data.record.transportType; | ||
101 | editData.value = await deviceConfigGetDetail(postEditId.value); | 106 | editData.value = await deviceConfigGetDetail(postEditId.value); |
102 | proxy.$refs.DeviceProfileStep1Ref.setStepOneFieldsValueFunc({ | 107 | proxy.$refs.DeviceProfileStep1Ref.setStepOneFieldsValueFunc({ |
103 | name: editData.value.name, | 108 | name: editData.value.name, |
@@ -106,6 +111,19 @@ | @@ -106,6 +111,19 @@ | ||
106 | description: editData.value.description, | 111 | description: editData.value.description, |
107 | image: editData.value.image, | 112 | image: editData.value.image, |
108 | }); | 113 | }); |
114 | + noEditObj = { | ||
115 | + id: editData.value.id, | ||
116 | + name: editData.value?.name, | ||
117 | + createTime: createTime.value, | ||
118 | + transportType: editTransportType.value, | ||
119 | + type: editData.value?.type, | ||
120 | + profileData: editData.value?.profileData, | ||
121 | + defaultQueueName: editData.value.defaultQueueName, | ||
122 | + image: editData.value.image, | ||
123 | + defaultRuleChainId: editData.value.defaultRuleChainId, | ||
124 | + description: editData.value.description, | ||
125 | + tenantId: editData.value.tenantId, | ||
126 | + }; | ||
109 | } else if (isUpdate.value == 3) { | 127 | } else if (isUpdate.value == 3) { |
110 | handleCancel(); | 128 | handleCancel(); |
111 | isShowOkBtnFalse.value = false; | 129 | isShowOkBtnFalse.value = false; |
@@ -124,6 +142,28 @@ | @@ -124,6 +142,28 @@ | ||
124 | }); | 142 | }); |
125 | function handleStepPrev() { | 143 | function handleStepPrev() { |
126 | current.value--; | 144 | current.value--; |
145 | + if (isUpdate.value == 2) { | ||
146 | + isEdit.value = true; | ||
147 | + noEditObj = { | ||
148 | + id: editData.value.id, | ||
149 | + name: editData.value?.name, | ||
150 | + createTime: createTime.value, | ||
151 | + transportType: editTransportType.value, | ||
152 | + type: editData.value?.type, | ||
153 | + profileData: editData.value?.profileData, | ||
154 | + defaultQueueName: editData.value.defaultQueueName, | ||
155 | + image: editData.value.image, | ||
156 | + defaultRuleChainId: editData.value.defaultRuleChainId, | ||
157 | + description: editData.value.description, | ||
158 | + tenantId: editData.value.tenantId, | ||
159 | + }; | ||
160 | + nextTick(async () => { | ||
161 | + let getPic = null; | ||
162 | + const getStep1Obj = await proxy.$refs.DeviceProfileStep1Ref?.getStep1Func(); | ||
163 | + getPic = getStep1Obj.icon; | ||
164 | + Object.assign(noEditObj, { image: getPic }, getStep1Obj.key); | ||
165 | + }); | ||
166 | + } | ||
127 | } | 167 | } |
128 | //第一步 | 168 | //第一步 |
129 | function handleStepNext1(v, v1) { | 169 | function handleStepNext1(v, v1) { |
@@ -136,6 +176,7 @@ | @@ -136,6 +176,7 @@ | ||
136 | } | 176 | } |
137 | current.value++; | 177 | current.value++; |
138 | if (isUpdate.value == 2) { | 178 | if (isUpdate.value == 2) { |
179 | + isEdit.value = false; | ||
139 | proxy.$refs.DeviceProfileStep2Ref?.setStepTwoFieldsValueFunc(editData.value); | 180 | proxy.$refs.DeviceProfileStep2Ref?.setStepTwoFieldsValueFunc(editData.value); |
140 | } else if (isUpdate.value == 3) { | 181 | } else if (isUpdate.value == 3) { |
141 | proxy.$refs.DeviceProfileStep2Ref?.setStepTwoFieldsValueFunc(editData.value); | 182 | proxy.$refs.DeviceProfileStep2Ref?.setStepTwoFieldsValueFunc(editData.value); |
@@ -155,6 +196,7 @@ | @@ -155,6 +196,7 @@ | ||
155 | ...getStep1Obj.key, | 196 | ...getStep1Obj.key, |
156 | ...{ image: getPic }, | 197 | ...{ image: getPic }, |
157 | }; | 198 | }; |
199 | + Object.assign(noEditObj, { image: getPic }, getStep1Obj.key); | ||
158 | } | 200 | } |
159 | const id = isUpdate.value == 1 ? '' : postEditId.value; | 201 | const id = isUpdate.value == 1 ? '' : postEditId.value; |
160 | const createTimePost = isUpdate.value == 1 ? {} : { createTime: createTime.value }; | 202 | const createTimePost = isUpdate.value == 1 ? {} : { createTime: createTime.value }; |
@@ -172,7 +214,46 @@ | @@ -172,7 +214,46 @@ | ||
172 | if (isUpdate.value == 1) { | 214 | if (isUpdate.value == 1) { |
173 | delete postDeviceConfogData.id; | 215 | delete postDeviceConfogData.id; |
174 | } | 216 | } |
175 | - deviceConfigAddOrEdit(postDeviceConfogData) | 217 | + //1 TODO 待解决OID对象唯一标识不能重复问题验证 |
218 | + let isMappings = false; | ||
219 | + // let isQuerying = false; | ||
220 | + postDeviceConfogData?.profileData?.transportConfiguration?.communicationConfigs?.forEach( | ||
221 | + (f) => { | ||
222 | + // if (f.spec == 'TELEMETRY_QUERYING' && f.queryingFrequencyMs == null) { | ||
223 | + // isQuerying = true; | ||
224 | + // } else { | ||
225 | + // isQuerying = false; | ||
226 | + // } | ||
227 | + // if (f.spec == 'CLIENT_ATTRIBUTES_QUERYING' && f.queryingFrequencyMs == null) { | ||
228 | + // isQuerying = true; | ||
229 | + // } else { | ||
230 | + // isQuerying = false; | ||
231 | + // } | ||
232 | + if (f.mappings.length == 0) { | ||
233 | + isMappings = true; | ||
234 | + } else { | ||
235 | + f.mappings.forEach((f1) => { | ||
236 | + const findNoneKey = Object.keys(f1).includes(''); | ||
237 | + if (findNoneKey) { | ||
238 | + isMappings = findNoneKey; | ||
239 | + } else { | ||
240 | + isMappings = false; | ||
241 | + } | ||
242 | + }); | ||
243 | + f.mappings.forEach((f2) => { | ||
244 | + const findNoneVal = Object.values(f2).includes(''); | ||
245 | + if (findNoneVal) { | ||
246 | + isMappings = findNoneVal; | ||
247 | + } else { | ||
248 | + isMappings = false; | ||
249 | + } | ||
250 | + }); | ||
251 | + } | ||
252 | + } | ||
253 | + ); | ||
254 | + // if (isQuerying) return createMessage.error('请填写Querying frequency,ms'); | ||
255 | + if (isMappings) return createMessage.error('请填写Date key和OID'); | ||
256 | + deviceConfigAddOrEdit(isEdit.value ? noEditObj : postDeviceConfogData) | ||
176 | .then((res) => { | 257 | .then((res) => { |
177 | if (!res) return; | 258 | if (!res) return; |
178 | createMessage.success(isUpdate.value == 1 ? '新增' + '成功' : '编辑' + '成功'); | 259 | createMessage.success(isUpdate.value == 1 ? '新增' + '成功' : '编辑' + '成功'); |
1 | <template> | 1 | <template> |
2 | <div class="step2-style"> | 2 | <div class="step2-style"> |
3 | - <div style="margin-top: 0.1vh; overflow: scroll"> | 3 | + <div |
4 | + style="margin-top: 0.1vh; height: 15vh" | ||
5 | + :style="[ | ||
6 | + isMqttType == 'MQTT' | ||
7 | + ? { minHeight: 45 + 'vh' } | ||
8 | + : isMqttType == 'COAP' | ||
9 | + ? { minHeight: 35 + 'vh' } | ||
10 | + : isMqttType == 'LWM2M' | ||
11 | + ? { minHeight: 55 + 'vh' } | ||
12 | + : isMqttType == 'SNMP' | ||
13 | + ? { minHeight: 60 + 'vh' } | ||
14 | + : { minHeight: 25 + 'vh' }, | ||
15 | + ]" | ||
16 | + > | ||
4 | <BasicForm :showResetButton="false" :showSubmitButton="false" @register="register" /> | 17 | <BasicForm :showResetButton="false" :showSubmitButton="false" @register="register" /> |
5 | - <div v-if="isMqttType == 'MQTT'"> | 18 | + <div style="margin-top: 5vh" v-if="isMqttType == 'MQTT'"> |
6 | <MqttCpns ref="mqttRef" /> | 19 | <MqttCpns ref="mqttRef" /> |
7 | </div> | 20 | </div> |
8 | - <div v-else-if="isMqttType == 'COAP'"> | 21 | + <div style="margin-top: 5vh" v-else-if="isMqttType == 'COAP'"> |
9 | <CoapCpns ref="coapRef" /> | 22 | <CoapCpns ref="coapRef" /> |
10 | </div> | 23 | </div> |
11 | - <div v-else-if="isMqttType == 'LWM2M'"> | 24 | + <div style="margin-top: 1vh" v-else-if="isMqttType == 'LWM2M'"> |
12 | <Lwm2mCpns ref="lwm2mRef" /> | 25 | <Lwm2mCpns ref="lwm2mRef" /> |
13 | </div> | 26 | </div> |
14 | - <div v-else-if="isMqttType == 'SNMP1'"> | 27 | + <div style="margin-top: 5vh" v-else-if="isMqttType == 'SNMP'"> |
15 | <SnmpCpns ref="snmpRef" /> | 28 | <SnmpCpns ref="snmpRef" /> |
16 | </div> | 29 | </div> |
17 | <div | 30 | <div |
@@ -85,7 +98,7 @@ | @@ -85,7 +98,7 @@ | ||
85 | proxy.$refs.mqttRef?.setStepFieldsValueFunc(v?.profileData?.transportConfiguration); | 98 | proxy.$refs.mqttRef?.setStepFieldsValueFunc(v?.profileData?.transportConfiguration); |
86 | proxy.$refs.coapRef?.setStepFieldsValueFunc(v?.profileData?.transportConfiguration); | 99 | proxy.$refs.coapRef?.setStepFieldsValueFunc(v?.profileData?.transportConfiguration); |
87 | proxy.$refs.lwm2mRef?.setStepFieldsValueFunc(v?.profileData?.transportConfiguration); | 100 | proxy.$refs.lwm2mRef?.setStepFieldsValueFunc(v?.profileData?.transportConfiguration); |
88 | - // proxy.$refs.snmpRef?.setStepFieldsValueFunc(v?.profileData?.transportConfiguration); | 101 | + proxy.$refs.snmpRef?.setStepFieldsValueFunc(v?.profileData?.transportConfiguration); |
89 | }, 100); | 102 | }, 100); |
90 | }; | 103 | }; |
91 | 104 | ||
@@ -111,7 +124,7 @@ | @@ -111,7 +124,7 @@ | ||
111 | { label: 'MQTT', value: 'MQTT' }, | 124 | { label: 'MQTT', value: 'MQTT' }, |
112 | { label: 'CoAP', value: 'COAP' }, | 125 | { label: 'CoAP', value: 'COAP' }, |
113 | { label: 'LWM2M', value: 'LWM2M' }, | 126 | { label: 'LWM2M', value: 'LWM2M' }, |
114 | - // { label: 'SNMP', value: 'SNMP' }, | 127 | + { label: 'SNMP', value: 'SNMP' }, |
115 | ], | 128 | ], |
116 | onChange(e) { | 129 | onChange(e) { |
117 | isMqttType.value = e; | 130 | isMqttType.value = e; |
@@ -129,12 +142,12 @@ | @@ -129,12 +142,12 @@ | ||
129 | const getMqttVal = await proxy.$refs.mqttRef?.getDataFunc(); | 142 | const getMqttVal = await proxy.$refs.mqttRef?.getDataFunc(); |
130 | const getCoapVal = await proxy.$refs.coapRef?.getDataFunc(); | 143 | const getCoapVal = await proxy.$refs.coapRef?.getDataFunc(); |
131 | const getLwm2mVal = await proxy.$refs.lwm2mRef?.getDataFunc(); | 144 | const getLwm2mVal = await proxy.$refs.lwm2mRef?.getDataFunc(); |
132 | - // const getSnmpVal = await proxy.$refs.snmpRef?.getSnmpForm(); | 145 | + const getSnmpVal = await proxy.$refs.snmpRef?.getSnmpForm(); |
133 | step2Data.transportConfiguration = { | 146 | step2Data.transportConfiguration = { |
134 | ...getMqttVal, | 147 | ...getMqttVal, |
135 | ...getCoapVal, | 148 | ...getCoapVal, |
136 | ...getLwm2mVal, | 149 | ...getLwm2mVal, |
137 | - // ...getSnmpVal, | 150 | + ...getSnmpVal, |
138 | ...val, | 151 | ...val, |
139 | }; | 152 | }; |
140 | return step2Data; | 153 | return step2Data; |
@@ -163,4 +176,8 @@ | @@ -163,4 +176,8 @@ | ||
163 | ::-webkit-scrollbar { | 176 | ::-webkit-scrollbar { |
164 | display: none; | 177 | display: none; |
165 | } | 178 | } |
179 | + :deep(.ant-btn) { | ||
180 | + color: white; | ||
181 | + background: #377dff; | ||
182 | + } | ||
166 | </style> | 183 | </style> |
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 | }); |
@@ -4,7 +4,7 @@ export const snmpSchemas: FormSchema[] = [ | @@ -4,7 +4,7 @@ export const snmpSchemas: FormSchema[] = [ | ||
4 | { | 4 | { |
5 | field: 'timeoutMs', | 5 | field: 'timeoutMs', |
6 | component: 'InputNumber', | 6 | component: 'InputNumber', |
7 | - label: 'Timeout,ns', | 7 | + label: '超时毫秒', |
8 | required: true, | 8 | required: true, |
9 | defaultValue: 500, | 9 | defaultValue: 500, |
10 | colProps: { span: 11 }, | 10 | colProps: { span: 11 }, |
@@ -12,13 +12,13 @@ export const snmpSchemas: FormSchema[] = [ | @@ -12,13 +12,13 @@ export const snmpSchemas: FormSchema[] = [ | ||
12 | { | 12 | { |
13 | field: 'retries', | 13 | field: 'retries', |
14 | component: 'InputNumber', | 14 | component: 'InputNumber', |
15 | - label: 'Retries', | 15 | + label: '重试次数', |
16 | required: true, | 16 | required: true, |
17 | defaultValue: 0, | 17 | defaultValue: 0, |
18 | colProps: { span: 11 }, | 18 | colProps: { span: 11 }, |
19 | }, | 19 | }, |
20 | { | 20 | { |
21 | - field: 'noknown', | 21 | + field: '1', |
22 | component: 'Input', | 22 | component: 'Input', |
23 | label: '', | 23 | label: '', |
24 | slot: 'add', | 24 | slot: 'add', |
1 | <template> | 1 | <template> |
2 | - <div v-for="(param, index) in dynamicInput.params" :key="index" style="display: flex"> | 2 | + <div |
3 | + v-for="(param, index) in dynamicInput.params" | ||
4 | + :key="index" | ||
5 | + style="display: flex; margin-top: 0.2vh" | ||
6 | + > | ||
3 | <Select | 7 | <Select |
4 | v-model:value="param.dataType" | 8 | v-model:value="param.dataType" |
5 | style="width: 140px" | 9 | style="width: 140px" |
6 | :options="selectOptions" | 10 | :options="selectOptions" |
7 | - @focus="focus" | ||
8 | - @change="handleChange" | 11 | + @change="emitChange" |
9 | /> | 12 | /> |
10 | <a-input | 13 | <a-input |
11 | placeholder="请输入Data key" | 14 | placeholder="请输入Data key" |
12 | v-model:value="param.key" | 15 | v-model:value="param.key" |
13 | - style="width: 38%; margin-bottom: 5px" | 16 | + style="width: 38%; margin-bottom: 5px; margin-left: 1vh" |
14 | @change="emitChange" | 17 | @change="emitChange" |
15 | /> | 18 | /> |
16 | <a-input | 19 | <a-input |
17 | placeholder="请输入OID" | 20 | placeholder="请输入OID" |
18 | v-model:value="param.oid" | 21 | v-model:value="param.oid" |
19 | - style="width: 38%; margin: 0 0 5px 60px" | 22 | + style="width: 38%; margin: 0 0 5px 8px" |
20 | @change="emitChange" | 23 | @change="emitChange" |
21 | /> | 24 | /> |
22 | <MinusCircleOutlined | 25 | <MinusCircleOutlined |
@@ -60,7 +63,7 @@ | @@ -60,7 +63,7 @@ | ||
60 | //自定义删除按钮多少才会显示 | 63 | //自定义删除按钮多少才会显示 |
61 | min: propTypes.integer.def(0), | 64 | min: propTypes.integer.def(0), |
62 | }, | 65 | }, |
63 | - emits: ['change', 'update:value'], | 66 | + emits: ['change', 'update:value', 'dynamicReduceHeight', 'dynamicAddHeight'], |
64 | setup(props, { emit }) { | 67 | setup(props, { emit }) { |
65 | const selectOptions = ref<SelectTypes['options']>([ | 68 | const selectOptions = ref<SelectTypes['options']>([ |
66 | { | 69 | { |
@@ -84,13 +87,6 @@ | @@ -84,13 +87,6 @@ | ||
84 | value: 'JSON', | 87 | value: 'JSON', |
85 | }, | 88 | }, |
86 | ]); | 89 | ]); |
87 | - const focus = () => { | ||
88 | - console.log('focus'); | ||
89 | - }; | ||
90 | - | ||
91 | - const handleChange = (value: string) => { | ||
92 | - console.log(`selected ${value}`); | ||
93 | - }; | ||
94 | 90 | ||
95 | //input动态数据 | 91 | //input动态数据 |
96 | const dynamicInput: UnwrapRef<{ params: Params[] }> = reactive({ params: [] }); | 92 | const dynamicInput: UnwrapRef<{ params: Params[] }> = reactive({ params: [] }); |
@@ -101,16 +97,18 @@ | @@ -101,16 +97,18 @@ | ||
101 | dynamicInput.params.splice(index, 1); | 97 | dynamicInput.params.splice(index, 1); |
102 | } | 98 | } |
103 | emitChange(); | 99 | emitChange(); |
100 | + emit('dynamicReduceHeight'); | ||
104 | }; | 101 | }; |
105 | 102 | ||
106 | //新增Input | 103 | //新增Input |
107 | const add = () => { | 104 | const add = () => { |
108 | dynamicInput.params.push({ | 105 | dynamicInput.params.push({ |
109 | - dataType: '', | 106 | + dataType: 'STRING', |
110 | key: '', | 107 | key: '', |
111 | oid: '', | 108 | oid: '', |
112 | }); | 109 | }); |
113 | emitChange(); | 110 | emitChange(); |
111 | + emit('dynamicAddHeight'); | ||
114 | }; | 112 | }; |
115 | 113 | ||
116 | //监听传入数据value | 114 | //监听传入数据value |
@@ -158,8 +156,6 @@ | @@ -158,8 +156,6 @@ | ||
158 | remove, | 156 | remove, |
159 | add, | 157 | add, |
160 | selectOptions, | 158 | selectOptions, |
161 | - focus, | ||
162 | - handleChange, | ||
163 | }; | 159 | }; |
164 | }, | 160 | }, |
165 | }); | 161 | }); |
1 | +<!-- eslint-disable vue/no-mutating-props --> | ||
1 | <template> | 2 | <template> |
2 | - <div class="snmp-form"> | ||
3 | - <div class="form-item1"> | 3 | + <div class="snmp-form" :style="{ height: dynamicHeight + 'vh' }"> |
4 | + <div class="form-item1" :style="{ height: dynamicHeight + 'vh' }"> | ||
4 | <div style="margin-left: 1vw"> | 5 | <div style="margin-left: 1vw"> |
5 | - <h3 style="color: gray">Scope</h3> | ||
6 | - <Select | ||
7 | - v-model:value="selectValue" | ||
8 | - style="width: 140px" | ||
9 | - :options="selectOptions" | ||
10 | - @focus="focus" | ||
11 | - @change="handleChange" | ||
12 | - /> | 6 | + <h3 style="color: gray">范围*</h3> |
7 | + <slot></slot> | ||
13 | </div> | 8 | </div> |
14 | </div> | 9 | </div> |
15 | - <div class="form-item2"> | 10 | + <div class="form-item2" :style="{ height: dynamicHeight + 'vh' }"> |
16 | <div style="margin-left: 1vw"> | 11 | <div style="margin-left: 1vw"> |
17 | - <h3 style="color: gray">Querying frequency,ms*</h3> | ||
18 | - <InputNumber v-model:value="inputNmberValue" :min="1" :max="50000" /> | ||
19 | - <MappingsForm :value="mappings" @change="handleMappingsChange" /> | 12 | + <h3 |
13 | + v-if="item.spec == 'TELEMETRY_QUERYING' || item.spec == 'CLIENT_ATTRIBUTES_QUERYING'" | ||
14 | + style="color: gray" | ||
15 | + >查询频率(毫秒*)</h3 | ||
16 | + > | ||
17 | + <InputNumber | ||
18 | + v-if="item.spec == 'TELEMETRY_QUERYING' || item.spec == 'CLIENT_ATTRIBUTES_QUERYING'" | ||
19 | + v-model:value="item.queryingFrequencyMs" | ||
20 | + :min="5000" | ||
21 | + :max="1000000000" | ||
22 | + /> | ||
23 | + <MappingsForm | ||
24 | + :value="item.mappings" | ||
25 | + @change="handleMappingsChange" | ||
26 | + @dynamicAddHeight="dynamicHeight += 4" | ||
27 | + @dynamicReduceHeight="dynamicHeight -= 4" | ||
28 | + /> | ||
20 | </div> | 29 | </div> |
21 | </div> | 30 | </div> |
22 | - <div class="form-item3"> | ||
23 | - <div style="text-align: center; line-height: 20vh"> | ||
24 | - <Button size="small" type="default" @click="handleRemove(item)"> | 31 | + <div class="form-item3" :style="{ height: dynamicHeight + 'vh' }"> |
32 | + <div | ||
33 | + style="text-align: center; line-height: 20vh" | ||
34 | + :style="{ lineHeight: dynamicHeight + 'vh' }" | ||
35 | + > | ||
36 | + <Button size="small" type="dashed" @click="handleRemove(item, index)"> | ||
25 | <template #icon> | 37 | <template #icon> |
26 | <MinusCircleOutlined /> | 38 | <MinusCircleOutlined /> |
27 | </template> | 39 | </template> |
@@ -32,113 +44,90 @@ | @@ -32,113 +44,90 @@ | ||
32 | </template> | 44 | </template> |
33 | <script setup lang="ts"> | 45 | <script setup lang="ts"> |
34 | import { ref } from 'vue'; | 46 | import { ref } from 'vue'; |
35 | - import { SelectTypes } from 'ant-design-vue/es/select'; | ||
36 | - import { Select, Button, InputNumber } from 'ant-design-vue'; | 47 | + import { Button, InputNumber } from 'ant-design-vue'; |
37 | import { MinusCircleOutlined } from '@ant-design/icons-vue'; | 48 | import { MinusCircleOutlined } from '@ant-design/icons-vue'; |
38 | import MappingsForm from './MappingsForm.vue'; | 49 | import MappingsForm from './MappingsForm.vue'; |
39 | - // interface Params { | ||
40 | - // dataType: string; | ||
41 | - // key: string; | ||
42 | - // oid: string; | ||
43 | - // } | ||
44 | - defineProps({ | 50 | + |
51 | + const props = defineProps({ | ||
45 | item: { | 52 | item: { |
46 | type: Object, | 53 | type: Object, |
47 | default: () => {}, | 54 | default: () => {}, |
48 | }, | 55 | }, |
49 | - mappings: { | ||
50 | - type: Array, | ||
51 | - default: () => [], | 56 | + index: { |
57 | + type: Number, | ||
52 | }, | 58 | }, |
53 | }); | 59 | }); |
54 | const emit = defineEmits(['removeItem']); | 60 | const emit = defineEmits(['removeItem']); |
55 | - const selectValue = ref('CLIENT_ATTRIBUTES_QUERYING'); | ||
56 | - const inputNmberValue = ref(5000); | ||
57 | - // const isHasItem = [ | ||
58 | - // 'TELEMETRY_QUERYING', | ||
59 | - // 'CLIENT_ATTRIBUTES_QUERYING', | ||
60 | - // 'SHARED_ATTRIBUTES_SETTING', | ||
61 | - // 'TO_DEVICE_RPC_REQUEST', | ||
62 | - // ]; | ||
63 | - const selectOptions = ref<SelectTypes['options']>([ | ||
64 | - { | ||
65 | - label: 'Telemetry', | ||
66 | - value: 'TELEMETRY_QUERYING', | ||
67 | - }, | ||
68 | - { | ||
69 | - label: 'Client attributes', | ||
70 | - value: 'CLIENT_ATTRIBUTES_QUERYING', | ||
71 | - }, | ||
72 | - { | ||
73 | - label: 'Shared attributes', | ||
74 | - value: 'SHARED_ATTRIBUTES_SETTING', | ||
75 | - }, | ||
76 | - { | ||
77 | - label: 'RPC request', | ||
78 | - value: 'TO_DEVICE_RPC_REQUEST', | ||
79 | - }, | ||
80 | - ]); | ||
81 | - const focus = () => { | ||
82 | - console.log('focus'); | ||
83 | - }; | 61 | + const dynamicHeight = ref(25); |
84 | 62 | ||
85 | - const handleChange = (value: string) => { | ||
86 | - selectValue.value = value; | ||
87 | - }; | ||
88 | - const mapping: any = ref([]); | ||
89 | const handleMappingsChange = (e) => { | 63 | const handleMappingsChange = (e) => { |
90 | - mapping.value = e; | 64 | + // eslint-disable-next-line vue/no-mutating-props |
65 | + props.item.mappings = e; | ||
91 | }; | 66 | }; |
92 | - | ||
93 | - const handleRemove = (item) => { | ||
94 | - emit('removeItem', item); | 67 | + const handleRemove = (item, index) => { |
68 | + emit('removeItem', item, index); | ||
95 | }; | 69 | }; |
96 | - //设置回显表单值 | ||
97 | - const setFieldsValueFunc = (item, inputValue) => { | ||
98 | - selectValue.value = item; | ||
99 | - inputNmberValue.value = inputValue; | 70 | + //设置回显的高度 |
71 | + const setFieldsValueFunc = () => { | ||
72 | + dynamicHeight.value = props.item.mappings.length * 3 + props.item.mappings.length + 15; | ||
100 | }; | 73 | }; |
101 | //获取表单的值 | 74 | //获取表单的值 |
102 | const getSnmpFormFunc = () => { | 75 | const getSnmpFormFunc = () => { |
103 | let obj: any = {}; | 76 | let obj: any = {}; |
104 | obj = { | 77 | obj = { |
105 | - ...{ spec: selectValue.value }, | ||
106 | - ...{ mappings: mapping.value }, | ||
107 | - ...{ queryingFrequencyMs: inputNmberValue.value }, | 78 | + ...{ spec: props.item.spec }, |
79 | + ...{ mappings: props.item.mappings }, | ||
80 | + ...{ | ||
81 | + queryingFrequencyMs: | ||
82 | + props.item.spec == 'TELEMETRY_QUERYING' || props.item.spec == 'CLIENT_ATTRIBUTES_QUERYING' | ||
83 | + ? props.item.queryingFrequencyMs | ||
84 | + : null, | ||
85 | + }, | ||
108 | }; | 86 | }; |
109 | return obj; | 87 | return obj; |
110 | }; | 88 | }; |
111 | defineExpose({ | 89 | defineExpose({ |
112 | getSnmpFormFunc, | 90 | getSnmpFormFunc, |
113 | setFieldsValueFunc, | 91 | setFieldsValueFunc, |
92 | + handleMappingsChange, | ||
114 | }); | 93 | }); |
115 | </script> | 94 | </script> |
116 | <style lang="less" scoped> | 95 | <style lang="less" scoped> |
96 | + ::-webkit-scrollbar { | ||
97 | + display: none; | ||
98 | + width: 0 !important; | ||
99 | + height: 0 !important; | ||
100 | + -webkit-appearance: none; | ||
101 | + background: transparent; | ||
102 | + } | ||
103 | + | ||
117 | .snmp-form { | 104 | .snmp-form { |
118 | display: flex; | 105 | display: flex; |
119 | align-items: center; | 106 | align-items: center; |
120 | justify-content: space-between; | 107 | justify-content: space-between; |
121 | width: 40vw; | 108 | width: 40vw; |
122 | height: 20vh; | 109 | height: 20vh; |
123 | - border: 1px solid gray; | 110 | + border: 0.1px solid #bfbfbf; |
124 | margin-top: 2vh; | 111 | margin-top: 2vh; |
125 | 112 | ||
126 | .form-item1 { | 113 | .form-item1 { |
127 | width: 9vw; | 114 | width: 9vw; |
128 | height: 20vh; | 115 | height: 20vh; |
129 | - border: 1px solid gray; | 116 | + border: 0.1px solid #bfbfbf; |
130 | } | 117 | } |
131 | 118 | ||
132 | .form-item2 { | 119 | .form-item2 { |
133 | width: 28vw; | 120 | width: 28vw; |
134 | height: 20vh; | 121 | height: 20vh; |
135 | - border: 1px solid gray; | 122 | + border: 0.1px solid #bfbfbf; |
123 | + overflow: hidden; | ||
124 | + overflow-y: scroll; | ||
136 | } | 125 | } |
137 | 126 | ||
138 | .form-item3 { | 127 | .form-item3 { |
139 | width: 2vw; | 128 | width: 2vw; |
140 | height: 20vh; | 129 | height: 20vh; |
141 | - border: 1px solid gray; | 130 | + border: 0.1px solid #bfbfbf; |
142 | } | 131 | } |
143 | } | 132 | } |
144 | </style> | 133 | </style> |
@@ -12,19 +12,37 @@ | @@ -12,19 +12,37 @@ | ||
12 | <BasicForm :showResetButton="false" :showSubmitButton="false" @register="register"> | 12 | <BasicForm :showResetButton="false" :showSubmitButton="false" @register="register"> |
13 | <template #add> | 13 | <template #add> |
14 | <div> | 14 | <div> |
15 | - <template v-for="(item, index) in dynamicSNMP.communicationConfigs" :key="index"> | ||
16 | - <span style="display: none">{{ item }}</span> | ||
17 | - <span style="display: none">{{ index }}</span> | 15 | + <template v-for="(item, index) in dynamicSNMP.communicationConfigs" :key="item"> |
18 | <!-- snmp表单项 --> | 16 | <!-- snmp表单项 --> |
19 | <SnmpForm | 17 | <SnmpForm |
18 | + :index="index" | ||
20 | :item="item" | 19 | :item="item" |
21 | :ref="dynamicBindRef.SnmpFormItemRef" | 20 | :ref="dynamicBindRef.SnmpFormItemRef" |
22 | :mappings="item.mappings" | 21 | :mappings="item.mappings" |
23 | @removeItem="handleRemoveItem" | 22 | @removeItem="handleRemoveItem" |
24 | - /> | 23 | + > |
24 | + <Select | ||
25 | + v-model:value="item.spec" | ||
26 | + style="width: 140px" | ||
27 | + :options="selectOptions" | ||
28 | + @change="handleChange(item.spec)" | ||
29 | + allowClear | ||
30 | + > | ||
31 | + <SelectOption | ||
32 | + v-for="it in selectOptions" | ||
33 | + :value="it.value" | ||
34 | + :key="it.value" | ||
35 | + :label="it.label" | ||
36 | + :disabled="it.disabled" | ||
37 | + /> | ||
38 | + </Select> | ||
39 | + </SnmpForm> | ||
25 | </template> | 40 | </template> |
26 | - <div style="margin-left: 0vw; margin-top: 2vh"> | ||
27 | - <Button size="small" type="default" @click="handleAdd"> | 41 | + <div |
42 | + v-if="dynamicSNMP.communicationConfigs.length < 4" | ||
43 | + style="margin-left: 0vw; margin-top: 2vh" | ||
44 | + > | ||
45 | + <Button size="middle" type="dashed" @click="handleAdd"> | ||
28 | <template #icon> | 46 | <template #icon> |
29 | <PlusCircleOutlined /> | 47 | <PlusCircleOutlined /> |
30 | </template> | 48 | </template> |
@@ -42,7 +60,7 @@ | @@ -42,7 +60,7 @@ | ||
42 | import { BasicForm, useForm } from '/@/components/Form'; | 60 | import { BasicForm, useForm } from '/@/components/Form'; |
43 | import { snmpSchemas } from './config'; | 61 | import { snmpSchemas } from './config'; |
44 | import { PlusCircleOutlined } from '@ant-design/icons-vue'; | 62 | import { PlusCircleOutlined } from '@ant-design/icons-vue'; |
45 | - import { Button } from 'ant-design-vue'; | 63 | + import { Button, Select, SelectOption } from 'ant-design-vue'; |
46 | import SnmpForm from './cpns/SnmpForm.vue'; | 64 | import SnmpForm from './cpns/SnmpForm.vue'; |
47 | 65 | ||
48 | interface mappingsI { | 66 | interface mappingsI { |
@@ -55,7 +73,49 @@ | @@ -55,7 +73,49 @@ | ||
55 | queryingFrequencyMs: number; | 73 | queryingFrequencyMs: number; |
56 | mappings: mappingsI[]; | 74 | mappings: mappingsI[]; |
57 | } | 75 | } |
58 | - const dynamicBindRef = { | 76 | + const selectOptions: any = ref([ |
77 | + { | ||
78 | + label: 'Telemetry', | ||
79 | + value: 'TELEMETRY_QUERYING', | ||
80 | + disabled: false, | ||
81 | + }, | ||
82 | + { | ||
83 | + label: 'Client attributes', | ||
84 | + value: 'CLIENT_ATTRIBUTES_QUERYING', | ||
85 | + disabled: false, | ||
86 | + }, | ||
87 | + { | ||
88 | + label: 'Shared attributes', | ||
89 | + value: 'SHARED_ATTRIBUTES_SETTING', | ||
90 | + disabled: false, | ||
91 | + }, | ||
92 | + { | ||
93 | + label: 'RPC request', | ||
94 | + value: 'TO_DEVICE_RPC_REQUEST', | ||
95 | + disabled: false, | ||
96 | + }, | ||
97 | + ]); | ||
98 | + const selectValue = ref(''); | ||
99 | + //解决新增选择框互斥问题和编辑回显互斥问题 | ||
100 | + const handleChange = (value: string) => { | ||
101 | + selectValue.value = value; | ||
102 | + selectOptions.value.forEach((ele: any) => { | ||
103 | + ele.disabled = false; | ||
104 | + dynamicSNMP.communicationConfigs.forEach((element: any) => { | ||
105 | + if (element.spec === ele.value) { | ||
106 | + ele.disabled = true; | ||
107 | + selectOptions.value.forEach((it: any) => { | ||
108 | + if ((ele.disabled = true)) { | ||
109 | + if (ele.value == it.value) { | ||
110 | + it.disabled = true; | ||
111 | + } | ||
112 | + } | ||
113 | + }); | ||
114 | + } | ||
115 | + }); | ||
116 | + }); | ||
117 | + }; | ||
118 | + const dynamicBindRef: any = { | ||
59 | SnmpFormItemRef: ref([]), | 119 | SnmpFormItemRef: ref([]), |
60 | }; | 120 | }; |
61 | const dynamicSNMP: UnwrapRef<{ communicationConfigs: Params[] }> = reactive({ | 121 | const dynamicSNMP: UnwrapRef<{ communicationConfigs: Params[] }> = reactive({ |
@@ -69,7 +129,7 @@ | @@ -69,7 +129,7 @@ | ||
69 | oid: '', | 129 | oid: '', |
70 | }, | 130 | }, |
71 | ], | 131 | ], |
72 | - queryingFrequencyMs: 0, | 132 | + queryingFrequencyMs: 5000, |
73 | }, | 133 | }, |
74 | ], | 134 | ], |
75 | }); | 135 | }); |
@@ -85,33 +145,32 @@ | @@ -85,33 +145,32 @@ | ||
85 | spec: '', | 145 | spec: '', |
86 | mappings: [ | 146 | mappings: [ |
87 | { | 147 | { |
88 | - dataType: '', | 148 | + dataType: 'STRING', |
89 | key: '', | 149 | key: '', |
90 | oid: '', | 150 | oid: '', |
91 | }, | 151 | }, |
92 | ], | 152 | ], |
93 | - queryingFrequencyMs: 0, | 153 | + queryingFrequencyMs: 5000, |
94 | }); | 154 | }); |
95 | }; | 155 | }; |
96 | - const handleRemoveItem = (item) => { | ||
97 | - let index = dynamicSNMP.communicationConfigs.indexOf(item); | ||
98 | - if (index !== -1) { | ||
99 | - dynamicSNMP.communicationConfigs.splice(index, 1); | ||
100 | - } | 156 | + const handleRemoveItem = (item, index) => { |
157 | + console.log(item.spec); | ||
158 | + //2 TODO待解决删除时清空互斥问题 | ||
159 | + dynamicSNMP.communicationConfigs.splice(index, 1); | ||
101 | }; | 160 | }; |
102 | //回显表单值 | 161 | //回显表单值 |
162 | + //TODO 采用这种方式动态绑定ref 都会造成回显数据顺序是随机的但不影响回显数据的正确性 | ||
103 | const setStepFieldsValueFunc = (v) => { | 163 | const setStepFieldsValueFunc = (v) => { |
104 | setFieldsValue({ | 164 | setFieldsValue({ |
105 | timeoutMs: v.timeoutMs, | 165 | timeoutMs: v.timeoutMs, |
106 | retries: v.retries, | 166 | retries: v.retries, |
107 | }); | 167 | }); |
108 | dynamicSNMP.communicationConfigs = v.communicationConfigs; | 168 | dynamicSNMP.communicationConfigs = v.communicationConfigs; |
109 | - dynamicSNMP.communicationConfigs.forEach((snmp: any, index: number) => { | 169 | + dynamicSNMP.communicationConfigs.forEach((snmp, index: number) => { |
110 | nextTick(() => { | 170 | nextTick(() => { |
111 | - unref(dynamicBindRef.SnmpFormItemRef)[index]?.setFieldsValueFunc( | ||
112 | - snmp?.spec, | ||
113 | - snmp?.queryingFrequencyMs | ||
114 | - ); | 171 | + //编辑回显互斥赋值 |
172 | + handleChange(snmp.spec); | ||
173 | + unref(dynamicBindRef.SnmpFormItemRef)[index]?.setFieldsValueFunc(); | ||
115 | }); | 174 | }); |
116 | }); | 175 | }); |
117 | }; | 176 | }; |
@@ -78,11 +78,10 @@ export const step2Schemas: FormSchema[] = [ | @@ -78,11 +78,10 @@ export const step2Schemas: FormSchema[] = [ | ||
78 | { label: 'MQTT', value: 'MQTT' }, | 78 | { label: 'MQTT', value: 'MQTT' }, |
79 | { label: 'CoAP', value: 'COAP' }, | 79 | { label: 'CoAP', value: 'COAP' }, |
80 | { label: 'LWM2M', value: 'LWM2M' }, | 80 | { label: 'LWM2M', value: 'LWM2M' }, |
81 | - // { label: 'SNMP', value: 'SNMP' }, | 81 | + { label: 'SNMP', value: 'SNMP' }, |
82 | ], | 82 | ], |
83 | - onChange(e) {}, | ||
84 | }; | 83 | }; |
85 | }, | 84 | }, |
86 | - colProps: { span: 11 }, | 85 | + colProps: { span: 10 }, |
87 | }, | 86 | }, |
88 | ]; | 87 | ]; |
1 | import { FormSchema } from '/@/components/Form'; | 1 | import { FormSchema } from '/@/components/Form'; |
2 | import { findDictItemByCode } from '/@/api/system/dict'; | 2 | import { findDictItemByCode } from '/@/api/system/dict'; |
3 | import { ref } from 'vue'; | 3 | import { ref } from 'vue'; |
4 | -// import { useMessage } from '/@/hooks/web/useMessage'; | ||
5 | import { isExistDataManagerNameApi } from '/@/api/datamanager/dataManagerApi'; | 4 | import { isExistDataManagerNameApi } from '/@/api/datamanager/dataManagerApi'; |
6 | -// const { createMessage } = useMessage(); | ||
7 | 5 | ||
8 | const typeValue = ref(''); | 6 | const typeValue = ref(''); |
9 | - | ||
10 | export enum CredentialsEnum { | 7 | export enum CredentialsEnum { |
11 | IS_ANONYMOUS = 'anonymous', | 8 | IS_ANONYMOUS = 'anonymous', |
12 | IS_BASIC = 'basic', | 9 | IS_BASIC = 'basic', |
13 | IS_PEM = 'pem', | 10 | IS_PEM = 'pem', |
14 | } | 11 | } |
15 | - | ||
16 | export const isBasic = (type: string) => { | 12 | export const isBasic = (type: string) => { |
17 | return type === CredentialsEnum.IS_BASIC; | 13 | return type === CredentialsEnum.IS_BASIC; |
18 | }; | 14 | }; |
@@ -55,31 +51,6 @@ export const modeForm: FormSchema[] = [ | @@ -55,31 +51,6 @@ export const modeForm: FormSchema[] = [ | ||
55 | }, | 51 | }, |
56 | ]; | 52 | ]; |
57 | 53 | ||
58 | -export const modeApiInseretKeyAndValueForm: FormSchema[] = [ | ||
59 | - { | ||
60 | - field: 'key', | ||
61 | - label: 'Header', | ||
62 | - colProps: { span: 12 }, | ||
63 | - required: true, | ||
64 | - component: 'Input', | ||
65 | - componentProps: { | ||
66 | - maxLength: 255, | ||
67 | - placeholder: '请输入Header', | ||
68 | - }, | ||
69 | - }, | ||
70 | - { | ||
71 | - field: 'value', | ||
72 | - label: 'Value', | ||
73 | - colProps: { span: 12 }, | ||
74 | - required: true, | ||
75 | - component: 'Input', | ||
76 | - componentProps: { | ||
77 | - maxLength: 255, | ||
78 | - placeholder: '请输入Value', | ||
79 | - }, | ||
80 | - }, | ||
81 | -]; | ||
82 | - | ||
83 | export const modeKafkaForm: FormSchema[] = [ | 54 | export const modeKafkaForm: FormSchema[] = [ |
84 | { | 55 | { |
85 | field: 'name', | 56 | field: 'name', |
@@ -117,7 +88,7 @@ export const modeKafkaForm: FormSchema[] = [ | @@ -117,7 +88,7 @@ export const modeKafkaForm: FormSchema[] = [ | ||
117 | defaultValue: 'my-topic', | 88 | defaultValue: 'my-topic', |
118 | componentProps: { | 89 | componentProps: { |
119 | maxLength: 255, | 90 | maxLength: 255, |
120 | - placeholder: '请输入Topic pattern', | 91 | + placeholder: '请输入消息次数', |
121 | }, | 92 | }, |
122 | }, | 93 | }, |
123 | { | 94 | { |
@@ -140,7 +111,6 @@ export const modeKafkaForm: FormSchema[] = [ | @@ -140,7 +111,6 @@ export const modeKafkaForm: FormSchema[] = [ | ||
140 | defaultValue: 0, | 111 | defaultValue: 0, |
141 | componentProps: { | 112 | componentProps: { |
142 | maxLength: 255, | 113 | maxLength: 255, |
143 | - placeholder: '请输入Automatically retry times if fails', | ||
144 | }, | 114 | }, |
145 | }, | 115 | }, |
146 | { | 116 | { |
@@ -151,7 +121,6 @@ export const modeKafkaForm: FormSchema[] = [ | @@ -151,7 +121,6 @@ export const modeKafkaForm: FormSchema[] = [ | ||
151 | defaultValue: 16384, | 121 | defaultValue: 16384, |
152 | componentProps: { | 122 | componentProps: { |
153 | maxLength: 255, | 123 | maxLength: 255, |
154 | - placeholder: '请输入Produces batch size in bytes', | ||
155 | }, | 124 | }, |
156 | }, | 125 | }, |
157 | { | 126 | { |
@@ -162,7 +131,6 @@ export const modeKafkaForm: FormSchema[] = [ | @@ -162,7 +131,6 @@ export const modeKafkaForm: FormSchema[] = [ | ||
162 | defaultValue: 0, | 131 | defaultValue: 0, |
163 | componentProps: { | 132 | componentProps: { |
164 | maxLength: 255, | 133 | maxLength: 255, |
165 | - placeholder: '请输入Time to buffer locally(ms)', | ||
166 | }, | 134 | }, |
167 | }, | 135 | }, |
168 | { | 136 | { |
@@ -173,7 +141,6 @@ export const modeKafkaForm: FormSchema[] = [ | @@ -173,7 +141,6 @@ export const modeKafkaForm: FormSchema[] = [ | ||
173 | defaultValue: 33554432, | 141 | defaultValue: 33554432, |
174 | componentProps: { | 142 | componentProps: { |
175 | maxLength: 255, | 143 | maxLength: 255, |
176 | - placeholder: '请输入Client buffer max size in bytes', | ||
177 | }, | 144 | }, |
178 | }, | 145 | }, |
179 | { | 146 | { |
@@ -183,7 +150,7 @@ export const modeKafkaForm: FormSchema[] = [ | @@ -183,7 +150,7 @@ export const modeKafkaForm: FormSchema[] = [ | ||
183 | colProps: { span: 12 }, | 150 | colProps: { span: 12 }, |
184 | defaultValue: '-1', | 151 | defaultValue: '-1', |
185 | componentProps: { | 152 | componentProps: { |
186 | - placeholder: '请选择Number of acknowledgments', | 153 | + placeholder: '请选择响应码', |
187 | options: [ | 154 | options: [ |
188 | { label: 'all', value: 'all' }, | 155 | { label: 'all', value: 'all' }, |
189 | { label: '-1', value: '-1' }, | 156 | { label: '-1', value: '-1' }, |
@@ -224,7 +191,7 @@ export const modeKafkaForm: FormSchema[] = [ | @@ -224,7 +191,7 @@ export const modeKafkaForm: FormSchema[] = [ | ||
224 | }, | 191 | }, |
225 | { | 192 | { |
226 | field: 'addMetadataKeyValuesAsKafkaHeaders', | 193 | field: 'addMetadataKeyValuesAsKafkaHeaders', |
227 | - label: '', | 194 | + label: '是否启用', |
228 | colProps: { span: 12 }, | 195 | colProps: { span: 12 }, |
229 | component: 'Checkbox', | 196 | component: 'Checkbox', |
230 | renderComponentContent: '将消息的元数据以键值对的方式添加到Kafka消息头中', | 197 | renderComponentContent: '将消息的元数据以键值对的方式添加到Kafka消息头中', |
@@ -232,12 +199,12 @@ export const modeKafkaForm: FormSchema[] = [ | @@ -232,12 +199,12 @@ export const modeKafkaForm: FormSchema[] = [ | ||
232 | { | 199 | { |
233 | field: 'kafkaHeadersCharset', | 200 | field: 'kafkaHeadersCharset', |
234 | component: 'Select', | 201 | component: 'Select', |
235 | - label: 'Charset', | 202 | + label: '字符集', |
236 | required: true, | 203 | required: true, |
237 | colProps: { span: 12 }, | 204 | colProps: { span: 12 }, |
238 | defaultValue: 'UTF-8', | 205 | defaultValue: 'UTF-8', |
239 | componentProps: { | 206 | componentProps: { |
240 | - placeholder: '请选择Charset encoding', | 207 | + placeholder: '请选择字符集编码', |
241 | options: [ | 208 | options: [ |
242 | { label: 'US-ASCII', value: 'US' }, | 209 | { label: 'US-ASCII', value: 'US' }, |
243 | { label: 'ISO-8859-1', value: 'ISO-8859-1' }, | 210 | { label: 'ISO-8859-1', value: 'ISO-8859-1' }, |
@@ -277,7 +244,7 @@ export const modeMqttForm: FormSchema[] = [ | @@ -277,7 +244,7 @@ export const modeMqttForm: FormSchema[] = [ | ||
277 | }, | 244 | }, |
278 | { | 245 | { |
279 | field: 'topicPattern', | 246 | field: 'topicPattern', |
280 | - label: 'Topic', | 247 | + label: '主题模式', |
281 | colProps: { span: 12 }, | 248 | colProps: { span: 12 }, |
282 | required: true, | 249 | required: true, |
283 | component: 'Input', | 250 | component: 'Input', |
@@ -289,7 +256,7 @@ export const modeMqttForm: FormSchema[] = [ | @@ -289,7 +256,7 @@ export const modeMqttForm: FormSchema[] = [ | ||
289 | }, | 256 | }, |
290 | { | 257 | { |
291 | field: 'host', | 258 | field: 'host', |
292 | - label: 'Host', | 259 | + label: '主机', |
293 | colProps: { span: 12 }, | 260 | colProps: { span: 12 }, |
294 | component: 'Input', | 261 | component: 'Input', |
295 | componentProps: { | 262 | componentProps: { |
@@ -299,7 +266,7 @@ export const modeMqttForm: FormSchema[] = [ | @@ -299,7 +266,7 @@ export const modeMqttForm: FormSchema[] = [ | ||
299 | }, | 266 | }, |
300 | { | 267 | { |
301 | field: 'port', | 268 | field: 'port', |
302 | - label: 'Port', | 269 | + label: '端口', |
303 | colProps: { span: 12 }, | 270 | colProps: { span: 12 }, |
304 | component: 'InputNumber', | 271 | component: 'InputNumber', |
305 | defaultValue: 1883, | 272 | defaultValue: 1883, |
@@ -311,7 +278,7 @@ export const modeMqttForm: FormSchema[] = [ | @@ -311,7 +278,7 @@ export const modeMqttForm: FormSchema[] = [ | ||
311 | }, | 278 | }, |
312 | { | 279 | { |
313 | field: 'connectTimeoutSec', | 280 | field: 'connectTimeoutSec', |
314 | - label: 'Connection', | 281 | + label: '连接超时(秒)', |
315 | colProps: { span: 12 }, | 282 | colProps: { span: 12 }, |
316 | component: 'InputNumber', | 283 | component: 'InputNumber', |
317 | defaultValue: 10, | 284 | defaultValue: 10, |
@@ -323,7 +290,7 @@ export const modeMqttForm: FormSchema[] = [ | @@ -323,7 +290,7 @@ export const modeMqttForm: FormSchema[] = [ | ||
323 | }, | 290 | }, |
324 | { | 291 | { |
325 | field: 'clientId', | 292 | field: 'clientId', |
326 | - label: 'Client ID', | 293 | + label: '客户端ID', |
327 | colProps: { span: 12 }, | 294 | colProps: { span: 12 }, |
328 | component: 'Input', | 295 | component: 'Input', |
329 | componentProps: ({ formActionType }) => { | 296 | componentProps: ({ formActionType }) => { |
@@ -353,29 +320,29 @@ export const modeMqttForm: FormSchema[] = [ | @@ -353,29 +320,29 @@ export const modeMqttForm: FormSchema[] = [ | ||
353 | colProps: { span: 12 }, | 320 | colProps: { span: 12 }, |
354 | defaultValue: false, | 321 | defaultValue: false, |
355 | component: 'Checkbox', | 322 | component: 'Checkbox', |
356 | - renderComponentContent: 'Add Service ID as suffix to Client ID', | 323 | + renderComponentContent: '将服务ID作为后缀添加到客户端ID', |
357 | show: false, | 324 | show: false, |
358 | }, | 325 | }, |
359 | { | 326 | { |
360 | field: 'cleanSession', | 327 | field: 'cleanSession', |
361 | - label: 'Clean', | 328 | + label: '是否启用', |
362 | colProps: { span: 12 }, | 329 | colProps: { span: 12 }, |
363 | defaultValue: true, | 330 | defaultValue: true, |
364 | component: 'Checkbox', | 331 | component: 'Checkbox', |
365 | - renderComponentContent: 'Clean session', | 332 | + renderComponentContent: '清除会话', |
366 | }, | 333 | }, |
367 | { | 334 | { |
368 | field: 'ssl', | 335 | field: 'ssl', |
369 | - label: 'Enable', | 336 | + label: '是否启用', |
370 | colProps: { span: 12 }, | 337 | colProps: { span: 12 }, |
371 | defaultValue: false, | 338 | defaultValue: false, |
372 | component: 'Checkbox', | 339 | component: 'Checkbox', |
373 | - renderComponentContent: 'Enable SSL', | 340 | + renderComponentContent: '启用SSL', |
374 | }, | 341 | }, |
375 | { | 342 | { |
376 | field: 'type', | 343 | field: 'type', |
377 | component: 'Select', | 344 | component: 'Select', |
378 | - label: 'type', | 345 | + label: '凭据类型', |
379 | colProps: { span: 12 }, | 346 | colProps: { span: 12 }, |
380 | defaultValue: 'anonymous', | 347 | defaultValue: 'anonymous', |
381 | componentProps: { | 348 | componentProps: { |
@@ -460,12 +427,12 @@ export const modeMqttForm: FormSchema[] = [ | @@ -460,12 +427,12 @@ export const modeMqttForm: FormSchema[] = [ | ||
460 | }, | 427 | }, |
461 | { | 428 | { |
462 | field: 'password', | 429 | field: 'password', |
463 | - label: 'Password', | 430 | + label: '密码', |
464 | colProps: { span: 12 }, | 431 | colProps: { span: 12 }, |
465 | component: 'InputPassword', | 432 | component: 'InputPassword', |
466 | componentProps: { | 433 | componentProps: { |
467 | maxLength: 255, | 434 | maxLength: 255, |
468 | - placeholder: '请输入Password', | 435 | + placeholder: '请输入密码', |
469 | }, | 436 | }, |
470 | ifShow: ({ values }) => isPem(Reflect.get(values, 'type')), | 437 | ifShow: ({ values }) => isPem(Reflect.get(values, 'type')), |
471 | }, | 438 | }, |
@@ -511,31 +478,31 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -511,31 +478,31 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
511 | }, | 478 | }, |
512 | { | 479 | { |
513 | field: 'exchangeNamePattern', | 480 | field: 'exchangeNamePattern', |
514 | - label: 'Exchange', | 481 | + label: '交换名称模式', |
515 | colProps: { span: 12 }, | 482 | colProps: { span: 12 }, |
516 | component: 'Input', | 483 | component: 'Input', |
517 | componentProps: { | 484 | componentProps: { |
518 | maxLength: 255, | 485 | maxLength: 255, |
519 | - placeholder: '请输入pattern', | 486 | + placeholder: '请输入模式', |
520 | }, | 487 | }, |
521 | }, | 488 | }, |
522 | { | 489 | { |
523 | field: 'routingKeyPattern', | 490 | field: 'routingKeyPattern', |
524 | - label: 'Routing', | 491 | + label: '路由密钥模式', |
525 | colProps: { span: 12 }, | 492 | colProps: { span: 12 }, |
526 | component: 'Input', | 493 | component: 'Input', |
527 | componentProps: { | 494 | componentProps: { |
528 | maxLength: 255, | 495 | maxLength: 255, |
529 | - placeholder: '请输入pattern', | 496 | + placeholder: '请输入模式', |
530 | }, | 497 | }, |
531 | }, | 498 | }, |
532 | { | 499 | { |
533 | field: 'messageProperties', | 500 | field: 'messageProperties', |
534 | component: 'Select', | 501 | component: 'Select', |
535 | - label: 'Message', | 502 | + label: '消息属性', |
536 | colProps: { span: 12 }, | 503 | colProps: { span: 12 }, |
537 | componentProps: { | 504 | componentProps: { |
538 | - placeholder: '请选择Message properties', | 505 | + placeholder: '请选择消息属性', |
539 | options: [ | 506 | options: [ |
540 | { label: 'BASIC', value: 'BASIC' }, | 507 | { label: 'BASIC', value: 'BASIC' }, |
541 | { label: 'TEXT_PLAIN', value: 'TEXT_PLAIN' }, | 508 | { label: 'TEXT_PLAIN', value: 'TEXT_PLAIN' }, |
@@ -548,7 +515,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -548,7 +515,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
548 | }, | 515 | }, |
549 | { | 516 | { |
550 | field: 'host', | 517 | field: 'host', |
551 | - label: 'Host', | 518 | + label: '主机', |
552 | colProps: { span: 12 }, | 519 | colProps: { span: 12 }, |
553 | component: 'Input', | 520 | component: 'Input', |
554 | required: true, | 521 | required: true, |
@@ -560,7 +527,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -560,7 +527,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
560 | }, | 527 | }, |
561 | { | 528 | { |
562 | field: 'port', | 529 | field: 'port', |
563 | - label: 'Port', | 530 | + label: '端口', |
564 | colProps: { span: 12 }, | 531 | colProps: { span: 12 }, |
565 | component: 'InputNumber', | 532 | component: 'InputNumber', |
566 | defaultValue: 5672, | 533 | defaultValue: 5672, |
@@ -572,7 +539,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -572,7 +539,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
572 | }, | 539 | }, |
573 | { | 540 | { |
574 | field: 'virtualHost', | 541 | field: 'virtualHost', |
575 | - label: 'Virtual', | 542 | + label: '虚拟端口', |
576 | colProps: { span: 12 }, | 543 | colProps: { span: 12 }, |
577 | component: 'Input', | 544 | component: 'Input', |
578 | defaultValue: '/', | 545 | defaultValue: '/', |
@@ -583,36 +550,36 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -583,36 +550,36 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
583 | }, | 550 | }, |
584 | { | 551 | { |
585 | field: 'username', | 552 | field: 'username', |
586 | - label: 'Username', | 553 | + label: '用户名', |
587 | colProps: { span: 12 }, | 554 | colProps: { span: 12 }, |
588 | component: 'Input', | 555 | component: 'Input', |
589 | defaultValue: 'guest', | 556 | defaultValue: 'guest', |
590 | componentProps: { | 557 | componentProps: { |
591 | maxLength: 255, | 558 | maxLength: 255, |
592 | - placeholder: '请输入Username', | 559 | + placeholder: '请输入用户名', |
593 | }, | 560 | }, |
594 | }, | 561 | }, |
595 | { | 562 | { |
596 | field: 'password', | 563 | field: 'password', |
597 | - label: 'Password', | 564 | + label: '密码', |
598 | colProps: { span: 12 }, | 565 | colProps: { span: 12 }, |
599 | component: 'InputPassword', | 566 | component: 'InputPassword', |
600 | defaultValue: 'guest', | 567 | defaultValue: 'guest', |
601 | componentProps: { | 568 | componentProps: { |
602 | maxLength: 255, | 569 | maxLength: 255, |
603 | - placeholder: '请输入Password', | 570 | + placeholder: '请输入密码', |
604 | }, | 571 | }, |
605 | }, | 572 | }, |
606 | { | 573 | { |
607 | field: 'automaticRecoveryEnabled', | 574 | field: 'automaticRecoveryEnabled', |
608 | - label: ' Automatic', | 575 | + label: '是否启用', |
609 | colProps: { span: 12 }, | 576 | colProps: { span: 12 }, |
610 | component: 'Checkbox', | 577 | component: 'Checkbox', |
611 | - renderComponentContent: 'Automatic recovery', | 578 | + renderComponentContent: '自动恢复', |
612 | }, | 579 | }, |
613 | { | 580 | { |
614 | field: 'connectionTimeout', | 581 | field: 'connectionTimeout', |
615 | - label: 'Connect', | 582 | + label: '连接超时(毫秒)', |
616 | colProps: { span: 12 }, | 583 | colProps: { span: 12 }, |
617 | component: 'InputNumber', | 584 | component: 'InputNumber', |
618 | defaultValue: 60000, | 585 | defaultValue: 60000, |
@@ -623,7 +590,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | @@ -623,7 +590,7 @@ export const modeRabbitMqForm: FormSchema[] = [ | ||
623 | }, | 590 | }, |
624 | { | 591 | { |
625 | field: 'handshakeTimeout', | 592 | field: 'handshakeTimeout', |
626 | - label: 'Handshake', | 593 | + label: '握手超时(毫秒)', |
627 | colProps: { span: 12 }, | 594 | colProps: { span: 12 }, |
628 | component: 'InputNumber', | 595 | component: 'InputNumber', |
629 | defaultValue: 10000, | 596 | defaultValue: 10000, |
@@ -697,7 +664,7 @@ export const modeApiForm: FormSchema[] = [ | @@ -697,7 +664,7 @@ export const modeApiForm: FormSchema[] = [ | ||
697 | }, | 664 | }, |
698 | { | 665 | { |
699 | field: 'restEndpointUrlPattern', | 666 | field: 'restEndpointUrlPattern', |
700 | - label: 'Endpoint', | 667 | + label: '端点URL模式', |
701 | colProps: { span: 12 }, | 668 | colProps: { span: 12 }, |
702 | required: true, | 669 | required: true, |
703 | defaultValue: 'http://localhost/api', | 670 | defaultValue: 'http://localhost/api', |
@@ -710,7 +677,7 @@ export const modeApiForm: FormSchema[] = [ | @@ -710,7 +677,7 @@ export const modeApiForm: FormSchema[] = [ | ||
710 | { | 677 | { |
711 | field: 'requestMethod', | 678 | field: 'requestMethod', |
712 | component: 'Select', | 679 | component: 'Select', |
713 | - label: 'Request', | 680 | + label: '请求方式', |
714 | colProps: { span: 12 }, | 681 | colProps: { span: 12 }, |
715 | defaultValue: 'POST', | 682 | defaultValue: 'POST', |
716 | componentProps: { | 683 | componentProps: { |
@@ -725,15 +692,15 @@ export const modeApiForm: FormSchema[] = [ | @@ -725,15 +692,15 @@ export const modeApiForm: FormSchema[] = [ | ||
725 | }, | 692 | }, |
726 | { | 693 | { |
727 | field: 'enableProxy', | 694 | field: 'enableProxy', |
728 | - label: '选择', | 695 | + label: '是否启用', |
729 | colProps: { span: 12 }, | 696 | colProps: { span: 12 }, |
730 | component: 'Checkbox', | 697 | component: 'Checkbox', |
731 | - renderComponentContent: 'Enable proxy', | 698 | + renderComponentContent: '启用代理', |
732 | }, | 699 | }, |
733 | 700 | ||
734 | { | 701 | { |
735 | field: 'proxyHost', | 702 | field: 'proxyHost', |
736 | - label: 'Host', | 703 | + label: '代理主机', |
737 | colProps: { span: 12 }, | 704 | colProps: { span: 12 }, |
738 | required: true, | 705 | required: true, |
739 | component: 'Input', | 706 | component: 'Input', |
@@ -747,7 +714,7 @@ export const modeApiForm: FormSchema[] = [ | @@ -747,7 +714,7 @@ export const modeApiForm: FormSchema[] = [ | ||
747 | }, | 714 | }, |
748 | { | 715 | { |
749 | field: 'proxyPort', | 716 | field: 'proxyPort', |
750 | - label: 'Port', | 717 | + label: '代理端口', |
751 | colProps: { span: 12 }, | 718 | colProps: { span: 12 }, |
752 | required: true, | 719 | required: true, |
753 | component: 'InputNumber', | 720 | component: 'InputNumber', |
@@ -762,13 +729,13 @@ export const modeApiForm: FormSchema[] = [ | @@ -762,13 +729,13 @@ export const modeApiForm: FormSchema[] = [ | ||
762 | }, | 729 | }, |
763 | { | 730 | { |
764 | field: 'proxyUser', | 731 | field: 'proxyUser', |
765 | - label: 'User', | 732 | + label: '代理用户', |
766 | colProps: { span: 12 }, | 733 | colProps: { span: 12 }, |
767 | required: true, | 734 | required: true, |
768 | component: 'Input', | 735 | component: 'Input', |
769 | componentProps: { | 736 | componentProps: { |
770 | maxLength: 255, | 737 | maxLength: 255, |
771 | - placeholder: '请输入Proxy user', | 738 | + placeholder: '请输入代理用户', |
772 | }, | 739 | }, |
773 | ifShow: ({ values }) => { | 740 | ifShow: ({ values }) => { |
774 | return !!values.enableProxy; | 741 | return !!values.enableProxy; |
@@ -776,13 +743,13 @@ export const modeApiForm: FormSchema[] = [ | @@ -776,13 +743,13 @@ export const modeApiForm: FormSchema[] = [ | ||
776 | }, | 743 | }, |
777 | { | 744 | { |
778 | field: 'proxyPassword', | 745 | field: 'proxyPassword', |
779 | - label: 'Password', | 746 | + label: '代理密码', |
780 | colProps: { span: 12 }, | 747 | colProps: { span: 12 }, |
781 | required: true, | 748 | required: true, |
782 | component: 'InputPassword', | 749 | component: 'InputPassword', |
783 | componentProps: { | 750 | componentProps: { |
784 | maxLength: 255, | 751 | maxLength: 255, |
785 | - placeholder: '请输入Proxy password', | 752 | + placeholder: '请输入代理密码', |
786 | }, | 753 | }, |
787 | ifShow: ({ values }) => { | 754 | ifShow: ({ values }) => { |
788 | return !!values.enableProxy; | 755 | return !!values.enableProxy; |
@@ -791,21 +758,20 @@ export const modeApiForm: FormSchema[] = [ | @@ -791,21 +758,20 @@ export const modeApiForm: FormSchema[] = [ | ||
791 | 758 | ||
792 | { | 759 | { |
793 | field: 'useSystemProxyProperties', | 760 | field: 'useSystemProxyProperties', |
794 | - label: '选择', | 761 | + label: '是否启用', |
795 | colProps: { span: 12 }, | 762 | colProps: { span: 12 }, |
796 | component: 'Checkbox', | 763 | component: 'Checkbox', |
797 | - renderComponentContent: 'Use system proxy properties', | 764 | + renderComponentContent: '使用系统代理属性', |
798 | }, | 765 | }, |
799 | { | 766 | { |
800 | field: 'maxParallelRequestsCount', | 767 | field: 'maxParallelRequestsCount', |
801 | - label: 'Max', | 768 | + label: '最大并行请求数', |
802 | colProps: { span: 12 }, | 769 | colProps: { span: 12 }, |
803 | required: true, | 770 | required: true, |
804 | component: 'InputNumber', | 771 | component: 'InputNumber', |
805 | defaultValue: 0, | 772 | defaultValue: 0, |
806 | componentProps: { | 773 | componentProps: { |
807 | maxLength: 255, | 774 | maxLength: 255, |
808 | - placeholder: '请输入Max number of paraller requests', | ||
809 | }, | 775 | }, |
810 | ifShow: ({ values }) => { | 776 | ifShow: ({ values }) => { |
811 | return !!values.useSystemProxyProperties; | 777 | return !!values.useSystemProxyProperties; |
@@ -813,21 +779,20 @@ export const modeApiForm: FormSchema[] = [ | @@ -813,21 +779,20 @@ export const modeApiForm: FormSchema[] = [ | ||
813 | }, | 779 | }, |
814 | { | 780 | { |
815 | field: 'ignoreRequestBody', | 781 | field: 'ignoreRequestBody', |
816 | - label: '选择', | 782 | + label: '是否启用', |
817 | colProps: { span: 12 }, | 783 | colProps: { span: 12 }, |
818 | component: 'Checkbox', | 784 | component: 'Checkbox', |
819 | - renderComponentContent: 'Without request body', | 785 | + renderComponentContent: '无请求正文', |
820 | }, | 786 | }, |
821 | { | 787 | { |
822 | field: 'readTimeoutMs', | 788 | field: 'readTimeoutMs', |
823 | - label: 'Read', | 789 | + label: '读取超时(毫秒)', |
824 | colProps: { span: 12 }, | 790 | colProps: { span: 12 }, |
825 | required: true, | 791 | required: true, |
826 | component: 'InputNumber', | 792 | component: 'InputNumber', |
827 | defaultValue: 0, | 793 | defaultValue: 0, |
828 | componentProps: { | 794 | componentProps: { |
829 | maxLength: 255, | 795 | maxLength: 255, |
830 | - placeholder: '请输入Read timeout in times', | ||
831 | }, | 796 | }, |
832 | ifShow: ({ values }) => { | 797 | ifShow: ({ values }) => { |
833 | return !values.useSystemProxyProperties; | 798 | return !values.useSystemProxyProperties; |
@@ -835,14 +800,13 @@ export const modeApiForm: FormSchema[] = [ | @@ -835,14 +800,13 @@ export const modeApiForm: FormSchema[] = [ | ||
835 | }, | 800 | }, |
836 | { | 801 | { |
837 | field: 'maxParallelRequestsCount', | 802 | field: 'maxParallelRequestsCount', |
838 | - label: 'Max', | 803 | + label: '最大并行请求数', |
839 | colProps: { span: 12 }, | 804 | colProps: { span: 12 }, |
840 | required: true, | 805 | required: true, |
841 | component: 'InputNumber', | 806 | component: 'InputNumber', |
842 | defaultValue: 0, | 807 | defaultValue: 0, |
843 | componentProps: { | 808 | componentProps: { |
844 | maxLength: 255, | 809 | maxLength: 255, |
845 | - placeholder: '请输入Max number of paraller requests', | ||
846 | }, | 810 | }, |
847 | ifShow: ({ values }) => { | 811 | ifShow: ({ values }) => { |
848 | return !values.useSystemProxyProperties; | 812 | return !values.useSystemProxyProperties; |
@@ -858,31 +822,30 @@ export const modeApiForm: FormSchema[] = [ | @@ -858,31 +822,30 @@ export const modeApiForm: FormSchema[] = [ | ||
858 | 822 | ||
859 | { | 823 | { |
860 | field: 'useRedisQueueForMsgPersistence', | 824 | field: 'useRedisQueueForMsgPersistence', |
861 | - label: '选择', | 825 | + label: '是否启用', |
862 | colProps: { span: 12 }, | 826 | colProps: { span: 12 }, |
863 | component: 'Checkbox', | 827 | component: 'Checkbox', |
864 | - renderComponentContent: 'Use redis queue for message persistence', | 828 | + renderComponentContent: '使用redis队列进行消息持久性', |
865 | }, | 829 | }, |
866 | { | 830 | { |
867 | field: 'trimQueue', | 831 | field: 'trimQueue', |
868 | - label: '选择', | 832 | + label: '是否启用', |
869 | colProps: { span: 12 }, | 833 | colProps: { span: 12 }, |
870 | component: 'Checkbox', | 834 | component: 'Checkbox', |
871 | - renderComponentContent: 'Trim redis queue', | 835 | + renderComponentContent: '修剪redis队列', |
872 | ifShow: ({ values }) => { | 836 | ifShow: ({ values }) => { |
873 | return !!values.useRedisQueueForMsgPersistence; | 837 | return !!values.useRedisQueueForMsgPersistence; |
874 | }, | 838 | }, |
875 | }, | 839 | }, |
876 | { | 840 | { |
877 | field: 'maxQueueSize', | 841 | field: 'maxQueueSize', |
878 | - label: 'Redis', | 842 | + label: 'Redis队列最大数', |
879 | colProps: { span: 12 }, | 843 | colProps: { span: 12 }, |
880 | required: true, | 844 | required: true, |
881 | component: 'InputNumber', | 845 | component: 'InputNumber', |
882 | defaultValue: 0, | 846 | defaultValue: 0, |
883 | componentProps: { | 847 | componentProps: { |
884 | maxLength: 255, | 848 | maxLength: 255, |
885 | - placeholder: '请输入Redis queue max size', | ||
886 | }, | 849 | }, |
887 | ifShow: ({ values }) => { | 850 | ifShow: ({ values }) => { |
888 | return !!values.useRedisQueueForMsgPersistence; | 851 | return !!values.useRedisQueueForMsgPersistence; |
@@ -892,11 +855,11 @@ export const modeApiForm: FormSchema[] = [ | @@ -892,11 +855,11 @@ export const modeApiForm: FormSchema[] = [ | ||
892 | { | 855 | { |
893 | field: 'type', | 856 | field: 'type', |
894 | component: 'Select', | 857 | component: 'Select', |
895 | - label: 'type', | 858 | + label: '凭据类型', |
896 | colProps: { span: 12 }, | 859 | colProps: { span: 12 }, |
897 | defaultValue: 'anonymous', | 860 | defaultValue: 'anonymous', |
898 | componentProps: { | 861 | componentProps: { |
899 | - placeholder: '请选择Number of acknowledgments', | 862 | + placeholder: '请选择凭据类型', |
900 | options: [ | 863 | options: [ |
901 | { label: 'Anonymous', value: 'anonymous' }, | 864 | { label: 'Anonymous', value: 'anonymous' }, |
902 | { label: 'Basic', value: 'basic' }, | 865 | { label: 'Basic', value: 'basic' }, |
@@ -906,25 +869,25 @@ export const modeApiForm: FormSchema[] = [ | @@ -906,25 +869,25 @@ export const modeApiForm: FormSchema[] = [ | ||
906 | }, | 869 | }, |
907 | { | 870 | { |
908 | field: 'username', | 871 | field: 'username', |
909 | - label: 'Username', | 872 | + label: '用户名', |
910 | colProps: { span: 12 }, | 873 | colProps: { span: 12 }, |
911 | component: 'Input', | 874 | component: 'Input', |
912 | required: true, | 875 | required: true, |
913 | componentProps: { | 876 | componentProps: { |
914 | maxLength: 255, | 877 | maxLength: 255, |
915 | - placeholder: '请输入Username', | 878 | + placeholder: '请输入用户名', |
916 | }, | 879 | }, |
917 | ifShow: ({ values }) => isBasic(Reflect.get(values, 'type')), | 880 | ifShow: ({ values }) => isBasic(Reflect.get(values, 'type')), |
918 | }, | 881 | }, |
919 | { | 882 | { |
920 | field: 'password', | 883 | field: 'password', |
921 | - label: 'Password', | 884 | + label: '密码', |
922 | colProps: { span: 12 }, | 885 | colProps: { span: 12 }, |
923 | component: 'InputPassword', | 886 | component: 'InputPassword', |
924 | required: true, | 887 | required: true, |
925 | componentProps: { | 888 | componentProps: { |
926 | maxLength: 255, | 889 | maxLength: 255, |
927 | - placeholder: '请输入Password', | 890 | + placeholder: '请输入密码', |
928 | }, | 891 | }, |
929 | ifShow: ({ values }) => isBasic(Reflect.get(values, 'type')), | 892 | ifShow: ({ values }) => isBasic(Reflect.get(values, 'type')), |
930 | }, | 893 | }, |
@@ -978,12 +941,12 @@ export const modeApiForm: FormSchema[] = [ | @@ -978,12 +941,12 @@ export const modeApiForm: FormSchema[] = [ | ||
978 | }, | 941 | }, |
979 | { | 942 | { |
980 | field: 'password', | 943 | field: 'password', |
981 | - label: 'Password', | 944 | + label: '密码', |
982 | colProps: { span: 12 }, | 945 | colProps: { span: 12 }, |
983 | component: 'InputPassword', | 946 | component: 'InputPassword', |
984 | componentProps: { | 947 | componentProps: { |
985 | maxLength: 255, | 948 | maxLength: 255, |
986 | - placeholder: '请输入Password', | 949 | + placeholder: '请输入密码', |
987 | }, | 950 | }, |
988 | ifShow: ({ values }) => isPem(Reflect.get(values, 'type')), | 951 | ifShow: ({ values }) => isPem(Reflect.get(values, 'type')), |
989 | }, | 952 | }, |