解决多台被检设备同时检测,通道混乱问题
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user