联调正式检测

This commit is contained in:
guanj
2025-08-20 20:02:22 +08:00
parent 26647222e2
commit 2aee4b281d
7 changed files with 1461 additions and 1431 deletions

View File

@@ -103,6 +103,7 @@ export namespace CheckData {
devCurr: number; //设备电流 devCurr: number; //设备电流
factorFlag: number; //是否支持系数校准 factorFlag: number; //是否支持系数校准
checkResult:number; //检测结果 checkResult:number; //检测结果
chnNumList: object[]; //连线存储数据
} }
// 用来描述检测脚本类型 // 用来描述检测脚本类型

View File

@@ -14,6 +14,7 @@ export const useCheckStore = defineStore(CHECK_STORE_KEY, {
showDetailType: 0, // 0:数据查询 1:误差体系跟换 2正式检测 showDetailType: 0, // 0:数据查询 1:误差体系跟换 2正式检测
temperature: 0, temperature: 0,
humidity: 0, humidity: 0,
chnNumList: [],//连线数据
}), }),
getters: {}, getters: {},
actions: { actions: {
@@ -37,6 +38,7 @@ export const useCheckStore = defineStore(CHECK_STORE_KEY, {
this.selectTestItems.test = true this.selectTestItems.test = true
}, },
setSelectTestItems(selectTestItems: CheckData.SelectTestItem) { setSelectTestItems(selectTestItems: CheckData.SelectTestItem) {
console.log("🚀 ~ setSelectTestItems ~ selectTestItems:", selectTestItems)
this.selectTestItems = selectTestItems this.selectTestItems = selectTestItems
}, },
setCheckType(checkType: number) { setCheckType(checkType: number) {
@@ -54,6 +56,9 @@ export const useCheckStore = defineStore(CHECK_STORE_KEY, {
setHumidity(humidity: number) { setHumidity(humidity: number) {
this.humidity = humidity this.humidity = humidity
}, },
setChnNum(chnNumList: string[]) {
this.chnNumList = chnNumList
},
} }
}); });

View File

@@ -190,7 +190,8 @@ export default class SocketService {
* WebSocket连接配置 * WebSocket连接配置
*/ */
private config: SocketConfig = { private config: SocketConfig = {
url: 'ws://127.0.0.1:7777/hello', // url: 'ws://127.0.0.1:7777/hello',
url: 'ws://192.168.1.124:7777/hello',
heartbeatInterval: 9000, // 9秒心跳间隔 heartbeatInterval: 9000, // 9秒心跳间隔
reconnectDelay: 5000, // 5秒重连延迟 reconnectDelay: 5000, // 5秒重连延迟
maxReconnectAttempts: 5, // 最多重连5次 maxReconnectAttempts: 5, // 最多重连5次

View File

@@ -201,7 +201,6 @@ interface DeviceData {
const testDataStructure = ref<Record<string, DeviceData>>({}); const testDataStructure = ref<Record<string, DeviceData>>({});
watch(webMsgSend, function (newValue, oldValue) { watch(webMsgSend, function (newValue, oldValue) {
console.log('webMsgSend', newValue)
if (testStatus.value !== 'waiting') { if (testStatus.value !== 'waiting') {
if(newValue.code == 25004){ if(newValue.code == 25004){
ElMessage.error('接收数据超时!') ElMessage.error('接收数据超时!')

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,63 +1,63 @@
<template> <template>
<el-dialog title="设备通道配对" v-model='dialogVisible' v-bind="dialogBig" > <el-dialog title="设备通道配对" v-model="dialogVisible" v-bind="dialogBig">
<div class="flow-container" style="overflow: hidden; position: relative" :style="{ height: dialogHeight + 'px' }"> <div
<!-- <el-button @click="logConnections">打印当前配对</el-button> --> class="flow-container"
<VueFlow style="overflow: hidden; position: relative"
:nodes="nodes" :style="{ height: dialogHeight + 'px' }"
:edges="edges" >
:connection-radius="30" <!-- <el-button @click="logConnections">打印当前配对</el-button> -->
:nodes-draggable="false" <VueFlow
:dragging="false" :nodes="nodes"
:zoom-on-scroll="false" :edges="edges"
:pan-on-drag="false" :connection-radius="30"
:disable-zoom-pan-on-connect="true" :nodes-draggable="false"
:prevent-scrolling="true" :dragging="false"
:fit-view="true" :zoom-on-scroll="false"
:min-zoom="1" :pan-on-drag="false"
:max-zoom="1" :disable-zoom-pan-on-connect="true"
:elements-selectable="false" :prevent-scrolling="true"
auto-connect :fit-view="true"
@connect="handleConnect" :min-zoom="1"
@connect-start="handleConnectStart" :max-zoom="1"
@connect-end="handleConnectEnd" :elements-selectable="false"
@pane-ready="onPaneReady" auto-connect
v-on:pane-mouse-move="false" @connect="handleConnect"
> @connect-start="handleConnectStart"
</VueFlow> @connect-end="handleConnectEnd"
</div> @pane-ready="onPaneReady"
v-on:pane-mouse-move="false"
></VueFlow>
</div>
<!-- 底部操作按钮 --> <!-- 底部操作按钮 -->
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button> <el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="handleNext">下一步</el-button> <el-button type="primary" @click="handleNext">下一步</el-button>
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
<!-- 手动检测-勾选检测项弹窗 --> <!-- 手动检测-勾选检测项弹窗 -->
<SelectTestItemPopup ref="selectTestItemPopupRef" @openTestDialog="openTestDialog" ></SelectTestItemPopup> <SelectTestItemPopup ref="selectTestItemPopupRef" @openTestDialog="openTestDialog"></SelectTestItemPopup>
<CompareTestPopup ref='testPopup'></CompareTestPopup> <CompareTestPopup ref="testPopup"></CompareTestPopup>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { h, ref } from 'vue' import { h, ref } from 'vue'
import { VueFlow, useVueFlow } from '@vue-flow/core' import { VueFlow, useVueFlow } from '@vue-flow/core'
import { dialogBig } from "@/utils/elementBind"; import { dialogBig } from '@/utils/elementBind'
import { Platform, Flag } from '@element-plus/icons-vue' import { Platform, Flag } from '@element-plus/icons-vue'
import { Device } from '@/api/device/interface/device'; import { Device } from '@/api/device/interface/device'
import { StandardDevice } from '@/api/device/interface/standardDevice'; import { StandardDevice } from '@/api/device/interface/standardDevice'
import SelectTestItemPopup from "@/views/home/components/selectTestItemPopup.vue"; import SelectTestItemPopup from '@/views/home/components/selectTestItemPopup.vue'
import CompareTestPopup from './compareTestPopup.vue' import CompareTestPopup from './compareTestPopup.vue'
import { ElMessage } from 'element-plus'; import { ElMessage } from 'element-plus'
import CustomEdge from './RemoveableEdge.vue' // 导入自定义连接线组件 import CustomEdge from './RemoveableEdge.vue' // 导入自定义连接线组件
import { jwtUtil } from "@/utils/jwtUtil"; import { jwtUtil } from '@/utils/jwtUtil'
import {useCheckStore} from "@/stores/modules/check"; import { useCheckStore } from '@/stores/modules/check'
const checkStore = useCheckStore()
const checkStore = useCheckStore();
const dialogVisible = ref(false) const dialogVisible = ref(false)
const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>() const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>()
const testPopup = ref() const testPopup = ref()
@@ -67,169 +67,198 @@ const dialogHeight = ref(600)
// 初始化 VueFlow注册自定义连线类型 // 初始化 VueFlow注册自定义连线类型
const { edges, setViewport } = useVueFlow({ const { edges, setViewport } = useVueFlow({
edgeTypes: { edgeTypes: {
default: CustomEdge default: CustomEdge
} }
}) })
// 初始化时锁定画布位置 // 初始化时锁定画布位置
const onPaneReady = () => { const onPaneReady = () => {
setViewport({ x: 0, y: 0, zoom: 1 }) setViewport({ x: 0, y: 0, zoom: 1 })
} }
// 提取公共的label渲染函数 // 提取公共的label渲染函数
const createLabel = (text: string, type: string) => { const createLabel = (text: string, type: string) => {
return h('div', { return h(
style: { 'div',
display: 'flex', {
flexDirection: 'column', style: {
alignItems: 'center', display: 'flex',
fontSize: '15px', flexDirection: 'column',
textAlign: 'center', alignItems: 'center',
border: '1px solid #ccc', fontSize: '15px',
borderRadius: '8px', textAlign: 'center',
padding: '8px', border: '1px solid #ccc',
backgroundColor: '#f9f9f9' borderRadius: '8px',
} padding: '8px',
}, [ backgroundColor: '#f9f9f9'
h(Platform, { }
style: { },
width: '20px', [
marginBottom: '4px', h(Platform, {
color: '#526ade' style: {
} width: '20px',
}), marginBottom: '4px',
h('div', null, '设备名称:' + text), color: '#526ade'
h('div', null, '设备类型:' + type) }
]) as any }),
h('div', null, '设备名称:' + text),
h('div', null, '设备类型:' + type)
]
) as any
} }
const createLabel3 = (text: string) => { const createLabel3 = (text: string) => {
return h('div', { return h(
style: { 'div',
display: 'flex', {
alignItems: 'center', style: {
fontSize: '15px', display: 'flex',
textAlign: 'center', alignItems: 'center',
border: '1px solid #ccc', fontSize: '15px',
borderRadius: '8px', textAlign: 'center',
padding: '8px', border: '1px solid #ccc',
backgroundColor: '#f9f9f9' borderRadius: '8px',
} padding: '8px',
}, [ backgroundColor: '#f9f9f9'
h(Flag, { }
style: { },
width: '20px', [
marginRight: '4px', h(Flag, {
color: '#526ade' style: {
} width: '20px',
}), marginRight: '4px',
text color: '#526ade'
]) as any }
}),
text
]
) as any
} }
const handleConnectStart = (params: any) => { const handleConnectStart = (params: any) => {
onPaneReady() onPaneReady()
} }
const handleConnectEnd = (params: any) => { const handleConnectEnd = (params: any) => {
onPaneReady() onPaneReady()
} }
const handleConnect = (params: any) => { const handleConnect = (params: any) => {
console.log('连接信息:', params); console.log('连接信息:', params)
const sourceNode = nodes.value.find(node => node.id === params.source) const sourceNode = nodes.value.find(node => node.id === params.source)
const targetNode = nodes.value.find(node => node.id === params.target) const targetNode = nodes.value.find(node => node.id === params.target)
// 连接规则验证 // 连接规则验证
const isValidConnection = const isValidConnection = sourceNode?.type === 'input' && targetNode?.type === 'output'
sourceNode?.type === 'input' &&
targetNode?.type === 'output'
if (!isValidConnection) { if (!isValidConnection) {
removeEdge(params) removeEdge(params)
ElMessage.warning('只能从被检通道连接到标准通道') ElMessage.warning('只能从被检通道连接到标准通道')
return return
}
// 过滤掉当前连接,检查是否还有重复的
const existingEdges = edges.value.filter(edge =>
edge.source === params.source || edge.target === params.target
);
// 如果同源或同目标的连接超过1个说明有重复
if (existingEdges.length > 1) {
const duplicateSource = existingEdges.filter(edge => edge.source === params.source).length > 1;
const duplicateTarget = existingEdges.filter(edge => edge.target === params.target).length > 1;
if (duplicateSource) {
removeEdge(params);
ElMessage.warning('该被检通道已经连接,不能重复连接');
return;
} }
if (duplicateTarget) { // 过滤掉当前连接,检查是否还有重复的
removeEdge(params); const existingEdges = edges.value.filter(edge => edge.source === params.source || edge.target === params.target)
ElMessage.warning('该标准通道已经连接,不能重复连接');
return; // 如果同源或同目标的连接超过1个说明有重复
if (existingEdges.length > 1) {
const duplicateSource = existingEdges.filter(edge => edge.source === params.source).length > 1
const duplicateTarget = existingEdges.filter(edge => edge.target === params.target).length > 1
if (duplicateSource) {
removeEdge(params)
ElMessage.warning('该被检通道已经连接,不能重复连接')
return
}
if (duplicateTarget) {
removeEdge(params)
ElMessage.warning('该标准通道已经连接,不能重复连接')
return
}
} }
}
} }
// 删除不合法连接 // 删除不合法连接
const removeEdge = (params: any) => { const removeEdge = (params: any) => {
const edgeIndex = edges.value.findIndex(edge => const edgeIndex = edges.value.findIndex(edge => edge.source === params.source && edge.target === params.target)
edge.source === params.source && edge.target === params.target if (edgeIndex !== -1) {
) edges.value.splice(edgeIndex, 1)
if (edgeIndex !== -1) { }
edges.value.splice(edgeIndex, 1)
}
} }
const nodes = ref([]) const nodes = ref([])
const planId = ref('') const planId = ref('')
const devIds = ref<string[]>() const devIds = ref<string[]>()
const standardDevIds = ref<string[]>() const standardDevIds = ref<string[]>()
const open = async (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[],fatherPlanId: string) => { const open = async (
console.log('device:', device); device: Device.ResPqDev[],
edges.value = [] standardDev: StandardDevice.ResPqStandardDevice[],
devIds.value = device.map(d => d.id) fatherPlanId: string
standardDevIds.value = standardDev.map(d => d.id) ) => {
planId.value = fatherPlanId console.log('device:', device)
nodes.value = createNodes(device, standardDev) edges.value = []
dialogVisible.value = true devIds.value = device.map(d => d.id)
onPaneReady() standardDevIds.value = standardDev.map(d => d.id)
planId.value = fatherPlanId
nodes.value = createNodes(device, standardDev)
dialogVisible.value = true
onPaneReady()
} }
const handleNext = () => { const handleNext = async () => {
if (edges.value.length === 0) { if (edges.value.length === 0) {
ElMessage.warning('请先完成通道配对') ElMessage.warning('请先完成通道配对')
return return
} }
dialogVisible.value = false // const sourceKey = edge.source.replace('被检通道-', '').replace('-', '_');
selectTestItemPopupRef.value?.open() let chnNumList: object[] = []
await edges.value.forEach(edge => {
const match = edge.source.split('-')
if (match) {
chnNumList.push({
deviceId: match[1],
label: match[2]
})
}
})
console.log('🚀 ~ handleNext ~ edges.value:', edges.value)
await checkStore.setChnNum(chnNumList)
dialogVisible.value = false
selectTestItemPopupRef.value?.open()
} }
const openTestDialog = async () => { const openTestDialog = async () => {
// 转换连接信息只保留设备ID和通道号 // 转换连接信息只保留设备ID和通道号
const connections = edges.value.reduce((map, edge) => { const connections = edges.value.reduce(
// 从source中提取设备ID和通道号: 被检通道-{deviceId}-{channelNum} => {deviceId}-{channelNum} (map, edge) => {
const sourceKey = edge.source.replace('被检通道-', '').replace('-', '_'); // 从source中提取设备ID和通道号: 被检通道-{deviceId}-{channelNum} => {deviceId}-{channelNum}
const sourceKey = edge.source.replace('被检通道-', '').replace('-', '_')
// 从target中提取设备ID和通道号: 标准通道-{deviceId}-{channelNum} => {deviceId}-{channelNum} // 从target中提取设备ID和通道号: 标准通道-{deviceId}-{channelNum} => {deviceId}-{channelNum}
const targetValue = edge.target.replace('标准通道-', '').replace('-', '_'); const targetValue = edge.target.replace('标准通道-', '').replace('-', '_')
map[sourceKey] = targetValue; map[sourceKey] = targetValue
return map; return map
}, {} as Record<string, string>); },
{} as Record<string, string>
)
generateChannelMapping()
generateChannelMapping() testPopup.value?.open(
dialogTitle.value,
testPopup.value?.open(dialogTitle.value,channelMapping.value,planId.value,jwtUtil.getLoginName(),devIds.value,standardDevIds.value,connections) channelMapping.value,
planId.value,
jwtUtil.getLoginName(),
devIds.value,
standardDevIds.value,
connections
)
} }
// 转换 edges.value 为 channelMapping 格式 // 转换 edges.value 为 channelMapping 格式
@@ -237,197 +266,197 @@ const channelMapping = ref<Record<string, Record<string, string>>>({})
// 生成映射关系的方法 // 生成映射关系的方法
const generateChannelMapping = () => { const generateChannelMapping = () => {
const mapping: Record<string, Record<string, string>> = {} const mapping: Record<string, Record<string, string>> = {}
edges.value.forEach(edge => { edges.value.forEach(edge => {
// 解析 source 节点信息(被检通道) // 解析 source 节点信息(被检通道)
const sourceParts = edge.source.split('-') const sourceParts = edge.source.split('-')
const sourceDeviceId = sourceParts[1] const sourceDeviceId = sourceParts[1]
const sourceChannel = sourceParts[2] const sourceChannel = sourceParts[2]
// 解析 target 节点信息(标准通道) // 解析 target 节点信息(标准通道)
const targetParts = edge.target.split('-') const targetParts = edge.target.split('-')
const targetDeviceId = targetParts[1] const targetDeviceId = targetParts[1]
const targetChannel = targetParts[2] const targetChannel = targetParts[2]
// 查找对应的节点以获取显示名称 // 查找对应的节点以获取显示名称
const sourceDeviceNode = nodes.value.find(node => node.id === sourceDeviceId) const sourceDeviceNode = nodes.value.find(node => node.id === sourceDeviceId)
const targetDeviceNode = nodes.value.find(node => node.id === targetDeviceId) const targetDeviceNode = nodes.value.find(node => node.id === targetDeviceId)
if (sourceDeviceNode && targetDeviceNode) { if (sourceDeviceNode && targetDeviceNode) {
// 提取设备显示文本 // 提取设备显示文本
const sourceDeviceText = sourceDeviceNode.data.label.children[1].children const sourceDeviceText = sourceDeviceNode.data.label.children[1].children
const targetDeviceText = targetDeviceNode.data.label.children[1].children const targetDeviceText = targetDeviceNode.data.label.children[1].children
// 构造键名 - 现在以标准设备为键 // 构造键名 - 现在以标准设备为键
const targetKey = `${targetDeviceText}`.replace('设备名称:', '') const targetKey = `${targetDeviceText}`.replace('设备名称:', '')
const sourceValue = `${sourceDeviceText}通道${sourceChannel}`.replace('设备名称:', '') const sourceValue = `${sourceDeviceText}通道${sourceChannel}`.replace('设备名称:', '')
// 初始化对象 // 初始化对象
if (!mapping[targetKey]) { if (!mapping[targetKey]) {
mapping[targetKey] = {} mapping[targetKey] = {}
} }
// 添加映射关系 - 标准设备通道 -> 被检设备信息 // 添加映射关系 - 标准设备通道 -> 被检设备信息
mapping[targetKey][`通道${targetChannel}`] = sourceValue mapping[targetKey][`通道${targetChannel}`] = sourceValue
} }
}) })
channelMapping.value = mapping channelMapping.value = mapping
} }
const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[]) => { const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[]) => {
const channelCounts: Record<string, number> = {} const channelCounts: Record<string, number> = {}
device.forEach(device => { device.forEach(device => {
channelCounts[device.id] = device.devChns || 0 channelCounts[device.id] = device.devChns || 0
}) })
const inspectionDevices = device.map(d => ({ const inspectionDevices = device.map(d => ({
id: d.id, id: d.id,
name: d.name, name: d.name,
type: 'normal', type: 'normal',
deviceType: d.devType deviceType: d.devType
})) }))
const channelCounts2: Record<string, number> = {} const channelCounts2: Record<string, number> = {}
standardDev.forEach(dev => { standardDev.forEach(dev => {
const channelList = dev.inspectChannel ? dev.inspectChannel.split(',') : [] const channelList = dev.inspectChannel ? dev.inspectChannel.split(',') : []
channelCounts2[dev.id] = channelList.length channelCounts2[dev.id] = channelList.length
}) })
const standardDevices = standardDev.map(d => ({ const standardDevices = standardDev.map(d => ({
id: d.id, id: d.id,
name: d.name, name: d.name,
type: 'normal', type: 'normal',
deviceType: d.devType deviceType: d.devType
})) }))
const newNodes: any[] = [] const newNodes: any[] = []
const deviceChannelGroups: { deviceId: string; centerY: number; }[] = [] const deviceChannelGroups: { deviceId: string; centerY: number }[] = []
const standardChannelGroups: any[] = [] const standardChannelGroups: any[] = []
const deviceWidth = 0 const deviceWidth = 0
const inputChannelX = 200 const inputChannelX = 200
const outputChannelX = 800 const outputChannelX = 800
const standardWidth = 950 const standardWidth = 950
const yPosition = ref(25) const yPosition = ref(25)
const yPosition2 = ref(25) const yPosition2 = ref(25)
// 添加被检通道 // 添加被检通道
Object.entries(channelCounts).forEach(([deviceId, count]) => { Object.entries(channelCounts).forEach(([deviceId, count]) => {
for (let i = 1; i <= count; i++) { for (let i = 1; i <= count; i++) {
const channelId = `被检通道-${deviceId}-${i}` const channelId = `被检通道-${deviceId}-${i}`
newNodes.push({ newNodes.push({
id: channelId, id: channelId,
type: 'input', type: 'input',
data: { label: createLabel3(`被检通道${i}`) }, data: { label: createLabel3(`被检通道${i}`) },
position: { x: inputChannelX, y: yPosition.value }, position: { x: inputChannelX, y: yPosition.value },
sourcePosition: 'right', sourcePosition: 'right',
style: { width: '150px', border: 'none', boxShadow: 'none' } style: { width: '150px', border: 'none', boxShadow: 'none' }
}) })
// 计算设备节点Y坐标居中显示 // 计算设备节点Y坐标居中显示
if(i == 1 && count == 1){ if (i == 1 && count == 1) {
deviceChannelGroups.push({ deviceChannelGroups.push({
deviceId, deviceId,
centerY: yPosition.value - 25 centerY: yPosition.value - 25
}) })
}else if(i == 2 && count == 2){ } else if (i == 2 && count == 2) {
deviceChannelGroups.push({ deviceChannelGroups.push({
deviceId, deviceId,
centerY: yPosition.value - 50 centerY: yPosition.value - 50
}) })
}else if(i == 3 && count == 3){ } else if (i == 3 && count == 3) {
deviceChannelGroups.push({ deviceChannelGroups.push({
deviceId, deviceId,
centerY: yPosition.value - 75 centerY: yPosition.value - 75
}) })
}else if(i == 4 && count == 4){ } else if (i == 4 && count == 4) {
deviceChannelGroups.push({ deviceChannelGroups.push({
deviceId, deviceId,
centerY: yPosition.value - 100 centerY: yPosition.value - 100
}) })
} }
yPosition.value += 50 yPosition.value += 50
} }
yPosition.value += 50 yPosition.value += 50
}) })
// 添加标准通道 // 添加标准通道
Object.entries(channelCounts2).forEach(([deviceId, count]) => { Object.entries(channelCounts2).forEach(([deviceId, count]) => {
for (let i = 1; i <= count; i++) { for (let i = 1; i <= count; i++) {
const channelId = `标准通道-${deviceId}-${i}` const channelId = `标准通道-${deviceId}-${i}`
newNodes.push({ newNodes.push({
id: channelId, id: channelId,
type: 'output', type: 'output',
data: { label: createLabel3(`标准通道${i}`) }, data: { label: createLabel3(`标准通道${i}`) },
position: { x: outputChannelX, y: yPosition2.value }, position: { x: outputChannelX, y: yPosition2.value },
targetPosition: 'left', targetPosition: 'left',
style: { width: '150px', border: 'none', boxShadow: 'none' } style: { width: '150px', border: 'none', boxShadow: 'none' }
}) })
// 计算设备节点Y坐标居中显示 // 计算设备节点Y坐标居中显示
if(i == 1 && count == 1){ if (i == 1 && count == 1) {
standardChannelGroups.push({ standardChannelGroups.push({
deviceId, deviceId,
centerY: yPosition2.value - 25 centerY: yPosition2.value - 25
}) })
}else if(i == 2 && count == 2){ } else if (i == 2 && count == 2) {
standardChannelGroups.push({ standardChannelGroups.push({
deviceId, deviceId,
centerY: yPosition2.value - 50 centerY: yPosition2.value - 50
}) })
}else if(i == 3 && count == 3){ } else if (i == 3 && count == 3) {
standardChannelGroups.push({ standardChannelGroups.push({
deviceId, deviceId,
centerY: yPosition2.value - 100 centerY: yPosition2.value - 100
}) })
}else if(i == 4 && count == 4){ } else if (i == 4 && count == 4) {
standardChannelGroups.push({ standardChannelGroups.push({
deviceId, deviceId,
centerY: yPosition2.value - 100 centerY: yPosition2.value - 100
}) })
} }
yPosition2.value += 50 yPosition2.value += 50
} }
yPosition2.value += 50 yPosition2.value += 50
}) })
// 添加被检设备 // 添加被检设备
deviceChannelGroups.forEach(({ deviceId, centerY }) => { deviceChannelGroups.forEach(({ deviceId, centerY }) => {
const device = inspectionDevices.find(d => d.id === deviceId) const device = inspectionDevices.find(d => d.id === deviceId)
if (device) { if (device) {
newNodes.push({ newNodes.push({
id: device.id, id: device.id,
data: { label: createLabel(device.name, device.deviceType) }, data: { label: createLabel(device.name, device.deviceType) },
position: { x: deviceWidth, y: centerY }, position: { x: deviceWidth, y: centerY },
class: 'no-handle-node', class: 'no-handle-node',
style: { width: '200px', border: 'none', boxShadow: 'none' } style: { width: '200px', border: 'none', boxShadow: 'none' }
}) })
} }
}) })
// 添加标准设备 // 添加标准设备
standardChannelGroups.forEach(({ deviceId, centerY }) => { standardChannelGroups.forEach(({ deviceId, centerY }) => {
const device = standardDevices.find(d => d.id === deviceId) const device = standardDevices.find(d => d.id === deviceId)
if (device) { if (device) {
newNodes.push({ newNodes.push({
id: device.id, id: device.id,
data: { label: createLabel(device.name, device.deviceType) }, data: { label: createLabel(device.name, device.deviceType) },
position: { x: standardWidth, y: centerY }, position: { x: standardWidth, y: centerY },
class: 'no-handle-node', class: 'no-handle-node',
style: { width: '200px', border: 'none', boxShadow: 'none' } style: { width: '200px', border: 'none', boxShadow: 'none' }
}) })
} }
}) })
//页面高度取决于设备通道 //页面高度取决于设备通道
dialogHeight.value = Math.max(yPosition.value, yPosition2.value) dialogHeight.value = Math.max(yPosition.value, yPosition2.value)
return newNodes return newNodes
} }
defineExpose({ open }) defineExpose({ open })
@@ -435,11 +464,11 @@ defineExpose({ open })
<style> <style>
.flow-container { .flow-container {
width: 100%; width: 100%;
overflow: hidden; overflow: hidden;
} }
.vue-flow__node.no-handle-node .vue-flow__handle { .vue-flow__node.no-handle-node .vue-flow__handle {
display: none !important; display: none !important;
} }
</style> </style>