通道配对

This commit is contained in:
sjl
2025-08-07 15:17:04 +08:00
parent fdc1fd6fbd
commit 88f1876ef0
2 changed files with 30 additions and 2 deletions

View File

@@ -201,8 +201,15 @@ function logConnections() {
const nodes = ref([])
const sourceIdArray = ref<string[]>()
const open = async (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[],sourceIds: string[]) => {
const planId = ref('')
const devIds = ref<string[]>()
const standardDevIds = ref<string[]>()
const open = async (device: Device.ResPqDev[], standardDev: StandardDevice.ResPqStandardDevice[],sourceIds: string[],fatherPlanId: string) => {
edges.value = []
devIds.value = device.map(d => d.id)
standardDevIds.value = standardDev.map(d => d.id)
planId.value = fatherPlanId
sourceIdArray.value = sourceIds
nodes.value = createNodes(device, standardDev)
dialogVisible.value = true
@@ -219,6 +226,27 @@ const handleNext = () => {
}
const openTestDialog = async () => {
// 转换连接信息只保留设备ID和通道号
const connections = edges.value.reduce((map, edge) => {
// 从source中提取设备ID和通道号: 被检通道-{deviceId}-{channelNum} => {deviceId}-{channelNum}
const sourceKey = edge.source.replace('被检通道-', '');
// 从target中提取设备ID和通道号: 标准通道-{deviceId}-{channelNum} => {deviceId}-{channelNum}
const targetValue = edge.target.replace('标准通道-', '');
map[sourceKey] = targetValue;
return map;
}, {} as Record<string, string>);
console.log('通道配对信息:', connections);
await contrastTest({
planId: planId.value,
loginName: jwtUtil.getLoginName(),
devIds: devIds.value,
standardDevIds: standardDevIds.value,
pairs:connections
})
testPopup.value?.open(dialogTitle.value,sourceIdArray.value)
}

View File

@@ -742,7 +742,7 @@ const handleTest2 = () => {
if (matchedItem) {
dataSources.value = matchedItem.datasourceIds
}
deviceConnectionPopupRef.value?.open(channelsSelection.value, pqStandardDevList.value, dataSources.value)
deviceConnectionPopupRef.value?.open(channelsSelection.value, pqStandardDevList.value, dataSources.value,props.id)
}
/**