diff --git a/src/views/DataCollect/Collector/Point/index.vue b/src/views/DataCollect/Collector/Point/index.vue index 70af667b..266e91bb 100644 --- a/src/views/DataCollect/Collector/Point/index.vue +++ b/src/views/DataCollect/Collector/Point/index.vue @@ -334,7 +334,7 @@ import SaveModBus from './Save/SaveModBus.vue'; import SaveOPCUA from './Save/SaveOPCUA.vue'; import Scan from './Scan/index.vue'; import { colorMap } from '../data.ts'; -import { cloneDeep, isNumber } from 'lodash-es'; +import { cloneDeep, isNumber, throttle } from 'lodash-es'; import { getWebSocket } from '@/utils/websocket'; import { map } from 'rxjs/operators'; import dayjs from 'dayjs'; @@ -616,17 +616,6 @@ const handleClick = (dt: any) => { } }; -//节流 -let timer: any = null; -function throttle(fn: any, delay = 1000) { - if (timer == null) { - timer = setTimeout(() => { - fn(); - clearTimeout(timer); - timer = null; - }, delay); - } -} const subscribeProperty = (value: any) => { const list = value.map((item: any) => item.id); const id = `collector-${props.data?.channelId || 'channel'}-${ @@ -643,7 +632,7 @@ const subscribeProperty = (value: any) => { //防止刷新过快 throttle(() => { propertyValue.value.set(payload.pointId, payload); - }); + }, 1000); }); }; diff --git a/src/views/DataCollect/Collector/Tree/Save/index.vue b/src/views/DataCollect/Collector/Tree/Save/index.vue index 0c8782fb..7f325ae7 100644 --- a/src/views/DataCollect/Collector/Tree/Save/index.vue +++ b/src/views/DataCollect/Collector/Tree/Save/index.vue @@ -107,11 +107,7 @@ />
-

- 当前内存布局:{{ - endianMap.get(formData.configuration.endian) - }}{{ endianMap.get(formData.configuration.endianIn) }} -

+

当前内存布局: {{ endianData }}

只有4字节数据类型(int32、ieee754 float) 具有4种内存布局,其它只有ABCD、DCBA两种内存布局(以双字配置为准) @@ -182,10 +178,21 @@ const emit = defineEmits(['change']); const id = props.data.id; const formRef = ref(); -const endianMap = new Map([ - ['BIG', 'AB'], - ['LITTLE', 'BA'], -]); + +const endianData = computed(() => { + const { endian, endianIn } = formData.value.configuration; + if (endian) { + if (endianIn) { + if (endian === 'BIG') { + return endianIn === 'BIG' ? 'ABCD' : 'BADC'; + } else { + return endianIn === 'BIG' ? 'CDBA' : 'DCBA'; + } + } else { + return endian === 'BIG' ? 'ABCD' : 'DCBA'; + } + } +}); const formData = ref({ channelId: undefined, diff --git a/src/views/link/Type/Detail/index.vue b/src/views/link/Type/Detail/index.vue index cd2f8a18..7204ba69 100644 --- a/src/views/link/Type/Detail/index.vue +++ b/src/views/link/Type/Detail/index.vue @@ -1366,10 +1366,7 @@ const getDetail = () => { ...configuration, }; } else { - dynamicValidateForm.cluster = { - ...cloneDeep(FormStates2), //同上 - ...cluster, - }; + dynamicValidateForm.cluster = cluster; } if (dynamicValidateForm.cluster.length === 1) {