From 88f1876ef053f52a8e8f82dbde1a6ac9c4434dc4 Mon Sep 17 00:00:00 2001 From: sjl <1716605279@qq.com> Date: Thu, 7 Aug 2025 15:17:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E9=81=93=E9=85=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/components/deviceConnectionPopup.vue | 30 ++++++++++++++++++- frontend/src/views/home/components/table.vue | 2 +- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/home/components/deviceConnectionPopup.vue b/frontend/src/views/home/components/deviceConnectionPopup.vue index a398beb..6b6db98 100644 --- a/frontend/src/views/home/components/deviceConnectionPopup.vue +++ b/frontend/src/views/home/components/deviceConnectionPopup.vue @@ -201,8 +201,15 @@ function logConnections() { const nodes = ref([]) const sourceIdArray = ref() -const open = async (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[],sourceIds: string[]) => { +const planId = ref('') +const devIds = ref() +const standardDevIds = ref() + +const open = async (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[],sourceIds: string[],fatherPlanId: string) => { edges.value = [] + devIds.value = device.map(d => d.id) + standardDevIds.value = standardDev.map(d => d.id) + planId.value = fatherPlanId sourceIdArray.value = sourceIds nodes.value = createNodes(device, standardDev) dialogVisible.value = true @@ -219,6 +226,27 @@ const handleNext = () => { } const openTestDialog = async () => { + + // 转换连接信息,只保留设备ID和通道号 + const connections = edges.value.reduce((map, edge) => { + // 从source中提取设备ID和通道号: 被检通道-{deviceId}-{channelNum} => {deviceId}-{channelNum} + const sourceKey = edge.source.replace('被检通道-', ''); + + // 从target中提取设备ID和通道号: 标准通道-{deviceId}-{channelNum} => {deviceId}-{channelNum} + const targetValue = edge.target.replace('标准通道-', ''); + + map[sourceKey] = targetValue; + return map; + }, {} as Record); + + console.log('通道配对信息:', connections); + await contrastTest({ + planId: planId.value, + loginName: jwtUtil.getLoginName(), + devIds: devIds.value, + standardDevIds: standardDevIds.value, + pairs:connections + }) testPopup.value?.open(dialogTitle.value,sourceIdArray.value) } diff --git a/frontend/src/views/home/components/table.vue b/frontend/src/views/home/components/table.vue index 832d5e3..f61d09c 100644 --- a/frontend/src/views/home/components/table.vue +++ b/frontend/src/views/home/components/table.vue @@ -742,7 +742,7 @@ const handleTest2 = () => { if (matchedItem) { dataSources.value = matchedItem.datasourceIds } - deviceConnectionPopupRef.value?.open(channelsSelection.value, pqStandardDevList.value, dataSources.value) + deviceConnectionPopupRef.value?.open(channelsSelection.value, pqStandardDevList.value, dataSources.value,props.id) } /**