fix: bug#11233、11276

This commit is contained in:
jackhoo_98 2023-03-31 14:33:58 +08:00
parent 63ec13e49b
commit 11cf92b90e
3 changed files with 19 additions and 26 deletions

View File

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

View File

@ -107,11 +107,7 @@
/>
</j-form-item>
<div style="color: #616161" v-if="visibleEndian">
<p>
当前内存布局:{{
endianMap.get(formData.configuration.endian)
}}{{ endianMap.get(formData.configuration.endianIn) }}
</p>
<p>当前内存布局: {{ endianData }}</p>
<p>
只有4字节数据类型(int32ieee754 float)
具有4种内存布局其它只有ABCDDCBA两种内存布局(以双字配置为准)
@ -182,10 +178,21 @@ const emit = defineEmits(['change']);
const id = props.data.id;
const formRef = ref<FormInstance>();
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,

View File

@ -1366,10 +1366,7 @@ const getDetail = () => {
...configuration,
};
} else {
dynamicValidateForm.cluster = {
...cloneDeep(FormStates2), //
...cluster,
};
dynamicValidateForm.cluster = cluster;
}
if (dynamicValidateForm.cluster.length === 1) {