From 9319dd06c57cf23905fbf437ce1d13d03b435721 Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Fri, 15 Aug 2025 16:22:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E5=88=A4=E6=96=AD=E8=A2=AB?= =?UTF-8?q?=E6=A3=80=E8=AE=BE=E5=A4=87=E4=B8=8B=E7=BB=91=E5=AE=9A=E7=9B=91?= =?UTF-8?q?=E6=B5=8B=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/device/monitor/index.ts | 21 +----- .../views/home/components/comparePreTest.vue | 16 ++--- .../src/views/home/components/compareTest.vue | 2 +- .../home/components/deviceConnectionPopup.vue | 1 + .../src/views/home/components/preTest.vue | 2 +- frontend/src/views/home/components/table.vue | 66 ++++++++++++++++++- frontend/src/views/home/components/test.vue | 2 +- .../plan/planList/components/planPopup.vue | 4 +- 8 files changed, 78 insertions(+), 36 deletions(-) diff --git a/frontend/src/api/device/monitor/index.ts b/frontend/src/api/device/monitor/index.ts index 2b96bf7..ade2c81 100644 --- a/frontend/src/api/device/monitor/index.ts +++ b/frontend/src/api/device/monitor/index.ts @@ -1,4 +1,3 @@ -import type { Monitor } from '@/api/device/interface/monitor' import http from '@/api' /** @@ -6,23 +5,9 @@ import http from '@/api' */ //获取监测点 -export const getPqMonList = (params: Monitor.ReqPqMonParams) => { - //return http.post(`/pqMon/list`, params) -} - -//添加监测点 -export const addPqMon = (params: Monitor.ResPqMon) => { - //return http.post(`/pqMon/add`, params) -} - -//编辑监测点 -export const updatePqMon = (params: Monitor.ResPqMon) => { - //return http.post(`/pqMon/update`, params) -} - -//删除监测点 -export const deletePqMon = (params: string[]) => { - //return http.post(`/pqMon/delete`, params) +export const getPqMonList = (param:any) => { + return http.post(`/pqMonitor/list`, param) } + diff --git a/frontend/src/views/home/components/comparePreTest.vue b/frontend/src/views/home/components/comparePreTest.vue index 5dbd5fe..c6ed0fd 100644 --- a/frontend/src/views/home/components/comparePreTest.vue +++ b/frontend/src/views/home/components/comparePreTest.vue @@ -207,6 +207,10 @@ watch(webMsgSend, function (newValue, oldValue) { ElMessage.error('接收数据超时!') ts.value = 'error' step5.value = 'error' + }else if(newValue.code == 10550){ + ElMessage.error('设备连接异常!') + ts.value = 'error' + step5.value = 'error' } switch (newValue.requestId) { case 'yjc_sbtxjy': @@ -224,15 +228,7 @@ watch(webMsgSend, function (newValue, oldValue) { type: 'wait', log: '正在进行设备通讯校验.....', }]; - } else if (newValue.code == 10550) { - step1InitLog.value.push({ - type: 'error', - log: newValue.data + '设备连接异常!', - }) - step1.value = 'error' - ts.value = 'error' - step5.value = 'error' - } else if (newValue.code == 10551) { + } else if (newValue.code == 10551) { step1InitLog.value.push({ type: 'error', log: newValue.data + '设备触发报告异常!', @@ -372,7 +368,7 @@ watch(webMsgSend, function (newValue, oldValue) { break; case 'error_flow_end': - ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', { + ElMessageBox.alert(`当前流程存在异常结束!`, '检测失败', { confirmButtonText: '确定', type: 'error', }) diff --git a/frontend/src/views/home/components/compareTest.vue b/frontend/src/views/home/components/compareTest.vue index 0abe557..f5164df 100644 --- a/frontend/src/views/home/components/compareTest.vue +++ b/frontend/src/views/home/components/compareTest.vue @@ -276,7 +276,7 @@ watch(webMsgSend, function (newValue, oldValue) { } break; case 'error_flow_end': - ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '初始化失败', { + ElMessageBox.alert(`当前流程存在异常结束!`, '初始化失败', { confirmButtonText: '确定', type: 'error', }) diff --git a/frontend/src/views/home/components/deviceConnectionPopup.vue b/frontend/src/views/home/components/deviceConnectionPopup.vue index 94f3dfe..383ce62 100644 --- a/frontend/src/views/home/components/deviceConnectionPopup.vue +++ b/frontend/src/views/home/components/deviceConnectionPopup.vue @@ -195,6 +195,7 @@ const devIds = ref() const standardDevIds = ref() const open = async (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[],fatherPlanId: string) => { + console.log('device:', device); edges.value = [] devIds.value = device.map(d => d.id) standardDevIds.value = standardDev.map(d => d.id) diff --git a/frontend/src/views/home/components/preTest.vue b/frontend/src/views/home/components/preTest.vue index 707cc74..08c3e12 100644 --- a/frontend/src/views/home/components/preTest.vue +++ b/frontend/src/views/home/components/preTest.vue @@ -408,7 +408,7 @@ watch(webMsgSend, function (newValue, oldValue) { case 'unknown_operate': break; case 'error_flow_end': - ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '检测失败', { + ElMessageBox.alert(`当前流程存在异常结束!`, '检测失败', { confirmButtonText: '确定', type: 'error', }) diff --git a/frontend/src/views/home/components/table.vue b/frontend/src/views/home/components/table.vue index bd10434..8226d25 100644 --- a/frontend/src/views/home/components/table.vue +++ b/frontend/src/views/home/components/table.vue @@ -192,7 +192,7 @@ import { useAuthStore } from '@/stores/modules/auth' import { useDownload } from '@/hooks/useDownload' import { documentedPqDev } from '@/api/device/report' import { ResultEnum } from '@/enums/httpEnum' - +import {getPqMonList} from '@/api/device/monitor/index.ts' const checkStore = useCheckStore() let devNum = 0//当前选取的被检设备数量 @@ -665,7 +665,7 @@ function refreshStatusList() { * 通道配对功能处理函数(比对模式专用) * 校验选中设备的一致性,然后打开通道配对弹窗 */ -const handleTest2 = () => { +const handleTest2 = async () => { // 检查是否选择了设备 if (devNum == 0) { ElMessageBox.confirm( @@ -729,7 +729,67 @@ const handleTest2 = () => { return } - deviceConnectionPopupRef.value?.open(channelsSelection.value, pqStandardDevList.value,props.id) + const devBindMonList = await getPqMonList({devIds: channelsSelection.value.map(d => d.id)}) + + // 创建一个映射来存储每个设备的监测点信息(支持多个监测点) + const deviceMonitoringMap = new Map() + devBindMonList.data.forEach((item: any) => { + if (deviceMonitoringMap.has(item.devId)) { + // 如果设备已存在,添加新的监测点信息 + deviceMonitoringMap.get(item.devId)?.push(item) + } else { + // 如果设备不存在,创建新的数组存储监测点信息 + deviceMonitoringMap.set(item.devId, [item]) + } + }) + + + // 过滤出至少有一个监测点的设备 + const filteredChannelsSelection = channelsSelection.value.filter(device => { + return deviceMonitoringMap.has(device.id) + }) + + // 如果没有设备有监测点,则提示并返回 + if (filteredChannelsSelection.length === 0) { + ElMessageBox.confirm( + '所选设备均无监测点,请检查设备配置', + '提示', + { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }, + ) + return + } + + // 检查是否有设备被过滤掉 + const devicesWithoutMonitoring = channelsSelection.value.filter(device => { + return !deviceMonitoringMap.has(device.id) + }) + + // 提示完全没有监测点的设备 + if (devicesWithoutMonitoring.length > 0) { + const deviceNames = devicesWithoutMonitoring.map(d => d.name).join(', ') + ElMessage.warning(`以下设备没有监测点: ${deviceNames}`) + } + +// 检查监测点数量与通道数是否一致,并指出具体哪些通道未绑定 +const inconsistentPointDevices = filteredChannelsSelection.filter(device => { + const monitoringInfoArray = deviceMonitoringMap.get(device.id) + const pointCount = monitoringInfoArray ? monitoringInfoArray.length : 0 + // 只有当监测点数量与通道数不一致时才需要提示 + return pointCount !== device.devChns +}) + +if (inconsistentPointDevices.length > 0) { + const deviceNames = inconsistentPointDevices.map(d => d.name).join(', ') + ElMessage.warning(`以下设备存在通道未绑定监测点: ${deviceNames}`) +} + + +// 只传递有监测点的设备 +deviceConnectionPopupRef.value?.open(filteredChannelsSelection, pqStandardDevList.value, props.id) } /** diff --git a/frontend/src/views/home/components/test.vue b/frontend/src/views/home/components/test.vue index d3037bc..2b219b9 100644 --- a/frontend/src/views/home/components/test.vue +++ b/frontend/src/views/home/components/test.vue @@ -441,7 +441,7 @@ watch(webMsgSend, function(newValue, oldValue) { } break case 'error_flow_end': - ElMessageBox.alert(`设备连接异常,请检查设备连接情况!`, '初始化失败', { + ElMessageBox.alert(`当前流程存在异常结束!`, '初始化失败', { confirmButtonText: '确定', type: 'error', }) diff --git a/frontend/src/views/plan/planList/components/planPopup.vue b/frontend/src/views/plan/planList/components/planPopup.vue index 7f58bc1..c81099e 100644 --- a/frontend/src/views/plan/planList/components/planPopup.vue +++ b/frontend/src/views/plan/planList/components/planPopup.vue @@ -20,7 +20,7 @@ show-word-limit /> - +