1.被检设备监测点新增是否参与检测
2.调整通道配对只显示绑定和参与检测的通道数
This commit is contained in:
@@ -697,6 +697,7 @@ function refreshStatusList() {
|
||||
* 校验选中设备的一致性,然后打开通道配对弹窗
|
||||
*/
|
||||
const handleTest2 = async () => {
|
||||
|
||||
// 检查是否选择了设备
|
||||
if (devNum == 0) {
|
||||
ElMessageBox.confirm('请先选择被检设备', '提示', {
|
||||
@@ -747,7 +748,6 @@ const handleTest2 = async () => {
|
||||
}
|
||||
|
||||
const devBindMonList = await getPqMonList({ devIds: channelsSelection.value.map(d => d.id) })
|
||||
|
||||
// 创建一个映射来存储每个设备的监测点信息(支持多个监测点)
|
||||
const deviceMonitoringMap = new Map<string, any[]>()
|
||||
devBindMonList.data.forEach((item: any) => {
|
||||
@@ -759,6 +759,33 @@ const handleTest2 = async () => {
|
||||
deviceMonitoringMap.set(item.devId, [item])
|
||||
}
|
||||
})
|
||||
|
||||
// 收集所有监测点都未参与检测的设备
|
||||
const allUncheckedDevices: string[] = [];
|
||||
// 创建新对象存储过滤掉checkFlag === 0的监测点
|
||||
const filteredDeviceMonitoringMap = new Map<string, any[]>();
|
||||
deviceMonitoringMap.forEach((monitoringPoints, deviceId) => {
|
||||
// 检查是否所有监测点的 checkFlag 都为 0
|
||||
const allUnchecked = monitoringPoints.every(point => point.checkFlag === 0);
|
||||
|
||||
if (allUnchecked) {
|
||||
// 根据deviceId找到设备名称
|
||||
const device = channelsSelection.value.find(d => d.id === deviceId);
|
||||
if (device) {
|
||||
allUncheckedDevices.push(device.name);
|
||||
}
|
||||
}else {
|
||||
// 过滤掉checkFlag === 0的监测点,只保留参与检测的监测点
|
||||
const filteredPoints = monitoringPoints.filter(point => point.checkFlag !== 0);
|
||||
filteredDeviceMonitoringMap.set(deviceId, filteredPoints);
|
||||
}
|
||||
});
|
||||
|
||||
// 统一提示所有所有监测点都未参与检测的设备
|
||||
if (allUncheckedDevices.length > 0) {
|
||||
ElMessage.warning(`以下设备的所有监测点都不参与检测,请重新选择: ${allUncheckedDevices.join(', ')}`);
|
||||
return
|
||||
}
|
||||
|
||||
// 过滤出至少有一个监测点的设备
|
||||
const filteredChannelsSelection = channelsSelection.value.filter(device => {
|
||||
@@ -767,6 +794,7 @@ const handleTest2 = async () => {
|
||||
|
||||
// 如果没有设备有监测点,则提示并返回
|
||||
if (filteredChannelsSelection.length === 0) {
|
||||
|
||||
ElMessageBox.confirm('所选设备均无监测点,请检查设备配置', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
@@ -800,7 +828,8 @@ const handleTest2 = async () => {
|
||||
}
|
||||
|
||||
// 只传递有监测点的设备
|
||||
deviceConnectionPopupRef.value?.open(filteredChannelsSelection, pqStandardDevList.value, props.id)
|
||||
|
||||
deviceConnectionPopupRef.value?.open(filteredChannelsSelection, pqStandardDevList.value, props.id,filteredDeviceMonitoringMap)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user