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