fix: bug#11006、11093

This commit is contained in:
jackhoo_98 2023-03-29 20:20:54 +08:00
parent 18abd85100
commit 384930fa4e
11 changed files with 37 additions and 73 deletions

View File

@ -187,19 +187,14 @@
<j-form-item
label="采集频率"
:name="['configuration', 'interval']"
:rules="[
...ModBusRules.interval,
{
validator: checkLength,
trigger: 'change',
},
]"
:rules="[...ModBusRules.interval]"
>
<j-input
<j-input-number
style="width: 100%"
placeholder="请输入采集频率"
v-model:value="formData.configuration.interval"
addon-after="ms"
:max="9999999999999998"
/>
</j-form-item>
@ -346,15 +341,6 @@ const changeFunction = (value: string) => {
value === 'InputRegisters' ? ['read'] : ['read', 'write'];
};
const checkLength = (_rule: Rule, value: string): Promise<any> =>
new Promise(async (resolve, reject) => {
if (value) {
return String(value).length > 64
? reject('最多可输入64个字符')
: resolve('');
}
});
const checkProvider = (_rule: Rule, value: string): Promise<any> =>
new Promise(async (resolve, reject) => {
if (value) {

View File

@ -49,19 +49,14 @@
<j-form-item
label="采集频率"
:name="['configuration', 'interval']"
:rules="[
...OPCUARules.interval,
{
validator: checkLength,
trigger: 'change',
},
]"
:rules="[...OPCUARules.interval]"
>
<j-input
<j-input-number
style="width: 100%"
placeholder="请输入采集频率"
v-model:value="formData.configuration.interval"
addon-after="ms"
:max="9999999999999998"
/>
</j-form-item>
<j-form-item label="" :name="['features']">
@ -156,17 +151,6 @@ const handleCancel = () => {
emit('change', false);
};
const checkLength = (_rule: Rule, value: string): Promise<any> =>
new Promise(async (resolve, reject) => {
if (value) {
return String(value).length > 64
? reject('最多可输入64个字符')
: resolve('');
} else {
reject('');
}
});
const filterOption = (input: string, option: any) => {
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
};

View File

@ -111,17 +111,13 @@
'value',
]"
:rules="[
{
validator: checkLength,
trigger: 'change',
},
{
pattern: regOnlyNumber,
message: '请输入0或者正整数',
},
]"
>
<j-input
<j-input-number
style="width: 60%"
v-model:value="
record.configuration[dataIndex].value
@ -129,12 +125,13 @@
placeholder="请输入"
allowClear
addon-after="ms"
:max="9999999999999998"
:disabled="
index !== 0 &&
record.configuration[dataIndex].check
"
@blur="changeValue(index, dataIndex)"
></j-input>
></j-input-number>
<j-checkbox
style="margin-left: 5px; margin-top: 5px"
v-show="index !== 0"

View File

@ -36,10 +36,6 @@
pattern: regOnlyNumber,
message: '请输入0或者正整数',
},
{
validator: checkLength,
trigger: 'change',
},
]"
>
<template #label>
@ -53,11 +49,12 @@
</j-tooltip>
</span>
</template>
<j-input
<j-input-number
style="width: 100%"
placeholder="请输入采集频率"
v-model:value="formData.interval"
addon-after="ms"
:max="9999999999999998"
/>
</j-form-item>

View File

@ -572,20 +572,20 @@ const handleClick = (dt: any) => {
};
const subscribeProperty = (value: any) => {
const list = value.map((item: any) => item.id);
const id = `collector-${props.data?.channelId || 'channel'}-${
props.data?.id || 'point'
}-data-${list.join('-')}`;
const topic = `/collector/${props.data?.channelId || '*'}/${
props.data?.id || '*'
}/data`;
subRef.value = getWebSocket(id, topic, {
pointId: list.join(','),
})
?.pipe(map((res: any) => res.payload))
.subscribe((payload: any) => {
propertyValue.value.set(payload.pointId, payload);
});
// const list = value.map((item: any) => item.id);
// const id = `collector-${props.data?.channelId || 'channel'}-${
// props.data?.id || 'point'
// }-data-${list.join('-')}`;
// const topic = `/collector/${props.data?.channelId || '*'}/${
// props.data?.id || '*'
// }/data`;
// subRef.value = getWebSocket(id, topic, {
// pointId: list.join(','),
// })
// ?.pipe(map((res: any) => res.payload))
// .subscribe((payload: any) => {
// propertyValue.value.set(payload.pointId, payload);
// });
};
const onCheckAllChange = (e: any) => {

View File

@ -237,7 +237,8 @@ const handleSearch = async (value: any) => {
if (clickSearch) {
defualtDataSource.value = res.result;
if (res.result.length !== 0) {
selectedKeys.value = [res.result[0].id]; //
selectedKeys.value.length === 0 &&
(selectedKeys.value = [res.result[0].id]); //
}
} else {
defualtDataSource.value = _.cloneDeep(root);
@ -285,7 +286,11 @@ watch(
watch(
() => searchValue.value,
(value) => {
!value && handleSearch(value);
if (!value) {
setTimeout(() => {
handleSearch(value);
}, 0);
}
},
);
</script>

View File

@ -30,7 +30,7 @@ const changeTree = (row: any) => {
collectorId: row?.id,
};
spinning.value = false;
}, 300);
}, 1000);
};
</script>

View File

@ -86,7 +86,7 @@ export const pointParams = (data: any) => {
from: Number(data.time.time[0]),
to: Number(data.time.time[1]),
interval: getParams(data.time).interval,
format: getParams(data.time).format,
format: 'YYYY-MM-dd HH:mm',
},
},
];

View File

@ -53,7 +53,6 @@ import * as echarts from 'echarts';
import { dashboard } from '@/api/link/dashboard';
import dayjs from 'dayjs';
import {
getTimeFormat,
getTimeByType,
arrayReverse,
defulteParamsData,
@ -84,9 +83,7 @@ const getCPUEcharts = async (val: any) => {
const value = item.data.value;
const nodeID = item.data.clusterNodeId;
_cpuXAxis.add(
dayjs(value.timestamp).format(
getTimeFormat(data.value.type),
),
dayjs(value.timestamp).format('YYYY-MM-DD HH:mm'),
);
if (!_cpuOptions[nodeID]) {

View File

@ -53,7 +53,6 @@ import * as echarts from 'echarts';
import { dashboard } from '@/api/link/dashboard';
import dayjs from 'dayjs';
import {
getTimeFormat,
getTimeByType,
arrayReverse,
typeDataLine,
@ -95,9 +94,7 @@ const getJVMEcharts = async (val: any) => {
_jvmOptions[nodeID] = [];
}
_jvmXAxis.add(
dayjs(value.timestamp).format(
getTimeFormat(data.value.type),
),
dayjs(value.timestamp).format('YYYY-MM-DD HH:mm'),
);
_jvmOptions[nodeID].push(_value);
});

View File

@ -114,6 +114,7 @@ export const defulteParamsData = (group: any, val: any) => [
params: {
from: dayjs(val.time[0]).valueOf(),
to: dayjs(val.time[1]).valueOf(),
format: 'YYYY-MM-dd HH:mm',
},
},
];