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