通道配对
This commit is contained in:
@@ -44,6 +44,9 @@ import {dialogBig} from "@/utils/elementBind";
|
||||
import {Platform,Promotion,Flag} from '@element-plus/icons-vue'
|
||||
import { c } from 'vite/dist/node/types.d-aGj9QkWt';
|
||||
import { de, el } from 'element-plus/es/locale';
|
||||
import { Device } from '@/api/device/interface/device';
|
||||
import { Plan } from '@/api/plan/interface';
|
||||
import { StandardDevice } from '@/api/device/interface/standardDevice';
|
||||
const dialogVisible = ref(false)
|
||||
// 初始化 VueFlow
|
||||
const { edges} = useVueFlow()
|
||||
@@ -331,30 +334,69 @@ function logConnections() {
|
||||
}
|
||||
|
||||
const nodes = ref([])
|
||||
const open = async () => {
|
||||
nodes.value = createNodes()
|
||||
const open = async (device:Device.ResPqDev[],standardDev:StandardDevice.ResPqStandardDevice[]) => {
|
||||
nodes.value = createNodes(device,standardDev)
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
// 每台设备的通道数量
|
||||
const channelCounts = {
|
||||
'1': 1, // 被检设备1 → 4个通道
|
||||
'3': 3, // 被检设备2 → 2个通道
|
||||
'5': 2, // 被检设备3 → 2个通道
|
||||
'7': 4 // 被检设备4 → 4个通道
|
||||
}
|
||||
// // 每台设备的通道数量
|
||||
// const channelCounts = {
|
||||
// '1': 1, // 被检设备1 → 4个通道
|
||||
// '3': 3, // 被检设备2 → 2个通道
|
||||
// '5': 2, // 被检设备3 → 2个通道
|
||||
// '7': 4 // 被检设备4 → 4个通道
|
||||
// }
|
||||
|
||||
// 每台设备的通道数量
|
||||
const channelCounts2 = {
|
||||
'2': 2, // 标准设备1 → 2个通道
|
||||
'4': 1, // 标准设备2 → 1个通道
|
||||
}
|
||||
// const channelCounts2 = {
|
||||
// '2': 2, // 标准设备1 → 2个通道
|
||||
// '4': 1, // 标准设备2 → 1个通道
|
||||
// }
|
||||
|
||||
// const inspectionDevices = [
|
||||
// { id: '1', name: '被检设备1', type: 'normal', deviceType: 'PQS-882B4' },
|
||||
// { id: '3', name: '被检设备2', type: 'normal', deviceType: 'PQS-883A2' },
|
||||
// { id: '5', name: '被检设备3', type: 'normal', deviceType: 'PQS-882B2' },
|
||||
// { id: '7', name: '被检设备4', type: 'normal', deviceType: 'PQS_883B' }
|
||||
// ]
|
||||
|
||||
// const standardDevices = [
|
||||
// { id: '2', name: '标准设备1', type: 'normal', deviceType: 'PQS-882A' },
|
||||
// { id: '4', name: '标准设备2', type: 'normal', deviceType: 'PQS-882B2' },
|
||||
// ]
|
||||
|
||||
const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[]) => {
|
||||
|
||||
const channelCounts: Record<string, number> = {}
|
||||
// 每台被检设备的通道数量
|
||||
device.forEach(device => {
|
||||
channelCounts[device.id] = device.devChns || 0
|
||||
})
|
||||
// 每台被检设备的信息
|
||||
const inspectionDevices = device.map(d => ({
|
||||
id: d.id,
|
||||
name: d.name,
|
||||
type: 'normal',
|
||||
deviceType: d.devType
|
||||
}))
|
||||
|
||||
const channelCounts2: Record<string, number> = {}
|
||||
// 每台标准设备的通道数量
|
||||
standardDev.forEach(dev => {
|
||||
const channelList = dev.inspectChannel ? dev.inspectChannel.split(',') : []
|
||||
channelCounts2[dev.id] = channelList.length
|
||||
})
|
||||
console.log(standardDev)
|
||||
// 每台标准设备的信息
|
||||
const standardDevices = standardDev.map(d => ({
|
||||
id: d.id,
|
||||
name: d.name,
|
||||
type: 'normal',
|
||||
deviceType: d.devType
|
||||
}))
|
||||
|
||||
|
||||
|
||||
const createNodes = () => {
|
||||
const newNodes: any[] = []
|
||||
|
||||
|
||||
// 存储每组被检/标准通道的垂直范围
|
||||
const deviceChannelGroups: { deviceId: string; centerY: number; }[] = []
|
||||
const standardChannelGroups: any[] = []
|
||||
@@ -472,17 +514,6 @@ const createNodes = () => {
|
||||
return newNodes
|
||||
}
|
||||
|
||||
const inspectionDevices = [
|
||||
{ id: '1', name: '被检设备1', type: 'normal', deviceType: 'PQS-882B4' },
|
||||
{ id: '3', name: '被检设备2', type: 'normal', deviceType: 'PQS-883A2' },
|
||||
{ id: '5', name: '被检设备3', type: 'normal', deviceType: 'PQS-882B2' },
|
||||
{ id: '7', name: '被检设备4', type: 'normal', deviceType: 'PQS_883B' }
|
||||
]
|
||||
|
||||
const standardDevices = [
|
||||
{ id: '2', name: '标准设备1', type: 'normal', deviceType: 'PQS-882A' },
|
||||
{ id: '4', name: '标准设备2', type: 'normal', deviceType: 'PQS-882B2' },
|
||||
]
|
||||
|
||||
|
||||
defineExpose({open})
|
||||
|
||||
Reference in New Issue
Block a user