解决多台被检设备同时检测,通道混乱问题

This commit is contained in:
sjl
2025-11-26 15:06:50 +08:00
parent 4a309feac5
commit 64c05b629c
2 changed files with 29 additions and 5 deletions

View File

@@ -37,6 +37,7 @@ import { jwtUtil } from '@/utils/jwtUtil'
import { useCheckStore } from '@/stores/modules/check'
import { ipc } from '@/utils/ipcRenderer'
import { fa, tr } from 'element-plus/es/locale'
import { CheckData } from '@/api/check/interface'
const vueFlowElement = ref(442)
const checkStore = useCheckStore()
const dialogVisible = ref(false)
@@ -427,7 +428,7 @@ const standardDevIds = ref<string[]>()
const open = async () => {
edges.value = []
devIds.value = prop.devIdList.map(d => d.id)
//devIds.value = prop.devIdList.map(d => d.id)
standardDevIds.value = prop.pqStandardDevList.map(d => d.id)
planId.value = prop.planIdKey
nodes.value = createNodes(prop.devIdList, prop.pqStandardDevList, prop.deviceMonitor)
@@ -447,11 +448,33 @@ const handleNext = async () => {
let chnNumList: string[] = []
await edges.value.forEach(edge => {
const match = edge.source.split('-')
if (match) {
chnNumList.push(match[2])
chnNumList.push(match[1] + '-'+ match[2])
}
})
const connectedDeviceIds = [...new Set(chnNumList.map(item => item.split('-')[0]))]
devIds.value = connectedDeviceIds
//可能存在勾选的被检设备未连线的情况,需要过滤掉
let devices: CheckData.Device[] = prop.devIdList
.filter((item: any) => connectedDeviceIds.includes(item.id))
.map((item: any) => {
return {
deviceId: item.id,
deviceName: item.name,
chnNum: item.devChns,
planId: item.planId,
deviceType: item.devType,
devVolt: item.devVolt,
devCurr: item.devCurr,
factorFlag: item.factorFlag,
checkResult: item.checkResult
}
})
checkStore.clearDevices()
checkStore.addDevices(devices)
const connections = edges.value.reduce(
(map, edge) => {
// 从source中提取设备ID和通道号: 被检通道-{deviceId}-{channelNum} => {deviceId}-{channelNum}

View File

@@ -37,9 +37,9 @@
align="center"
>
<el-table-column
v-for="(chnItem, index2) in checkStore.chnNumList"
v-for="(chnItem, index2) in checkStore.chnNumList.filter(c => c.startsWith(item.deviceId))"
:key="`${item.deviceId}${chnItem}`"
:label="'通道' + chnItem"
:label="'通道' + chnItem.split('-')[1]"
align="center"
>
<template #default="{ row }">
@@ -804,6 +804,7 @@ const initCheckResult = (defaultValue: CheckData.ChnCheckResultEnum) => {
})
Object.assign(checkResult, result)
}
const scrollToBottom = () => {