fix: bug#11117、11096、11095、11060、11061 修复采集器部分bug

This commit is contained in:
jackhoo_98 2023-03-28 14:36:49 +08:00
parent 2aaa3ae945
commit 9d24bf8799
6 changed files with 49 additions and 24 deletions

View File

@ -12,7 +12,7 @@ export const FormState: FormDataType = {
securityPolicy: 'None',
securityMode: undefined,
certificate: undefined,
authType: 'username',
authType: 'anonymous',
username: '',
password: '',
},

View File

@ -133,6 +133,7 @@
{ label: '读', value: 'read' },
{ label: '写', value: 'write' },
]"
:column="2"
/>
</j-form-item>
<j-form-item
@ -165,6 +166,7 @@
{ label: '否', value: false },
]"
@change="changeWriteByteCount"
:column="2"
/>
</j-form-item>
<j-form-item

View File

@ -43,6 +43,7 @@
{ label: '写', value: 'write' },
{ label: '订阅', value: 'subscribe' },
]"
:column="3"
/>
</j-form-item>
<j-form-item
@ -161,6 +162,8 @@ const checkLength = (_rule: Rule, value: string): Promise<any> =>
return String(value).length > 64
? reject('最多可输入64个字符')
: resolve('');
} else {
reject('');
}
});

View File

@ -42,12 +42,15 @@
/></template>
扫描
</PermissionButton>
<j-dropdown v-if="data?.provider === 'OPC_UA'">
<j-button
<j-dropdown
v-if="data?.provider === 'OPC_UA'"
:trigger="['click']"
>
<j-button @click.prevent="clickBatch"
>批量操作 <AIcon type="DownOutlined"
/></j-button>
<template #overlay>
<j-menu>
<j-menu v-if="showBatch">
<j-menu-item>
<PermissionButton
hasPermission="DataCollect/Collector:update"
@ -145,13 +148,13 @@
style="max-width: 150px"
>
{{
propertyValue.get(
getParseData(
slotProps.id,
)?.parseData[0] || 0
)[0]
}}({{
propertyValue.get(
getParseData(
slotProps.id,
)?.dataType
)[1]
}})
</j-ellipsis>
</div>
@ -280,7 +283,7 @@ import SaveModBus from './Save/SaveModBus.vue';
import SaveOPCUA from './Save/SaveOPCUA.vue';
import Scan from './Scan/index.vue';
import { colorMap, getState } from '../data.ts';
import { cloneDeep } from 'lodash-es';
import { cloneDeep, isNumber } from 'lodash-es';
import { getWebSocket } from '@/utils/websocket';
import { map } from 'rxjs/operators';
import dayjs from 'dayjs';
@ -410,6 +413,17 @@ const columns = [
const subRef = ref();
const propertyValue = ref(new Map());
const showBatch = ref(false);
const clickBatch = () => {
if (_selectedRowKeys.value.length === 0) {
onlyMessage('请先选择', 'warning');
showBatch.value = false;
} else {
showBatch.value = true;
}
};
const handlAdd = () => {
visible.saveModBus = true;
current.value = {
@ -440,21 +454,10 @@ const handlDelete = async (id: string | undefined = undefined) => {
};
const handlBatchDelete = () => {
if (_selectedRowKeys.value.length === 0) {
onlyMessage('请先选择', 'warning');
return;
} else {
console.log(2);
handlDelete();
}
handlDelete();
};
const handlBatchUpdate = () => {
if (_selectedRowKeys.value.length === 0) {
onlyMessage('请先选择', 'warning');
return;
}
const dataSet = new Set(_selectedRowKeys.value);
const dataMap = new Map();
tableRef?.value?._dataSource.forEach((i: any) => {
@ -506,6 +509,12 @@ const getAccessModes = (item: Partial<Record<string, any>>) => {
return item?.accessModes?.map((i: any) => i?.value);
};
const getParseData = (id: string) => {
const { parseData, dataType } = propertyValue.value.get(id);
const data = isNumber(parseData) ? parseData || 0 : parseData;
return [data, dataType];
};
const saveChange = (value: object) => {
for (let key in visible) {
visible[key] = false;

View File

@ -96,6 +96,7 @@
{ label: 'BA', value: 'LITTLE' },
]"
@change="changeCardSelectEndian"
:column="2"
/>
</j-form-item>
<j-form-item label="说明" name="description">

View File

@ -65,7 +65,13 @@
: '禁用',
}"
hasPermission="DataCollect/Collector:update"
@click="handlUpdate(data)"
:popConfirm="{
title:
data?.state?.value === 'disabled'
? '确定启用?'
: '确定禁用?',
onConfirm: () => handlUpdate(data),
}"
>
<AIcon
:type="
@ -81,7 +87,7 @@
:tooltip="{
title:
data?.state?.value !== 'disabled'
? '正常的采集器不能删除'
? '请先禁用,再删除'
: '删除',
}"
:danger="data?.state?.value === 'disabled'"
@ -200,7 +206,8 @@ const saveChange = (value: object) => {
};
const handleSearch = async (value: any) => {
let clickSearch = false;
let clickSearch = !!channelId; //
if (!searchValue.value && !value) {
params.value = _.cloneDeep(defualtParams);
} else if (!!searchValue.value) {
@ -223,6 +230,9 @@ const handleSearch = async (value: any) => {
if (res.status === 200) {
if (clickSearch) {
defualtDataSource.value = res.result;
if (res.result.length !== 0) {
selectedKeys.value = [res.result[0].id]; //
}
} else {
defualtDataSource.value = _.cloneDeep(root);
defualtDataSource.value[0].children = res.result;