预检测出错

This commit is contained in:
sjl
2025-10-16 09:36:43 +08:00
parent 321b6c5465
commit 7d6dc55a76
5 changed files with 133 additions and 91 deletions

View File

@@ -24,7 +24,7 @@
</template>
<script lang="ts" setup>
import { h, ref, onMounted, PropType } from 'vue'
import { h, ref, onMounted, PropType, computed } from 'vue'
import { VueFlow, useVueFlow } from '@vue-flow/core'
import { dialogBig } from '@/utils/elementBind'
import { Platform, Flag } from '@element-plus/icons-vue'
@@ -57,6 +57,10 @@ const prop = defineProps({
deviceMonitor: {
type: Map as PropType<Map<string, any[]>>,
default: () => new Map()
},
dialogWidth: {
type: Number,
default: 0
}
})
// 计算对话框高度
@@ -336,6 +340,24 @@ const generateChannelMapping = () => {
channelMapping.value = mapping
}
// 计算基于 dialogWidth 的位置参数 - 确保最小距离
const deviceWidthVal = computed(() => {
return Math.max(0, 50)
})
const inputChannelXVal = computed(() => {
return Math.max(300, deviceWidthVal.value + 300)
})
const outputChannelXVal = computed(() => {
return Math.max(650, prop.dialogWidth - 470)
})
const standardWidthVal = computed(() => {
return Math.max(800, prop.dialogWidth - 350)
})
const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[], deviceMonitor: Map<string, any[]>) => {
const channelCounts: Record<string, number> = {}
device.forEach(device => {
@@ -366,12 +388,15 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
const deviceChannelGroups: { deviceId: string; centerY: number }[] = []
const standardChannelGroups: any[] = []
const deviceWidth = 50
const inputChannelX = 350
const outputChannelX = 1050
const standardWidth = 1170
// const deviceWidth = 50
// const inputChannelX = 350
// const outputChannelX = 1050
// const standardWidth = 1170
const deviceWidth = deviceWidthVal.value
const inputChannelX = inputChannelXVal.value
const outputChannelX = outputChannelXVal.value
const standardWidth = standardWidthVal.value
// 添加被检通道
// let currentYPosition = 50; // 初始Y位置
let actualChannelsTotalLength = 0;
@@ -385,7 +410,6 @@ const createNodes = (device: Device.ResPqDev[], standardDev: StandardDevice.ResP
let currentYPosition = (vueFlowElement.value - 60 * actualChannelsTotalLength) / 2; // 初始Y位置
const deviceSpacing = 30; // 设备间的垂直间距
console.log('currentYPosition', currentYPosition)
Object.entries(channelCounts).forEach(([deviceId, count]) => {
// 从deviceMonitor中获取实际通道信息
let actualChannels = []; // 存储实际的通道号