调整开始检测接口
This commit is contained in:
@@ -51,10 +51,14 @@ import SelectTestItemPopup from "@/views/home/components/selectTestItemPopup.vue
|
||||
import CompareTestPopup from './compareTestPopup.vue'
|
||||
import { ElMessage } from 'element-plus';
|
||||
import CustomEdge from './RemoveableEdge.vue' // 导入自定义连接线组件
|
||||
|
||||
import {getContrastTestNumInfo} from '@/api/socket/socket'
|
||||
import { jwtUtil } from "@/utils/jwtUtil";
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
|
||||
|
||||
|
||||
|
||||
const checkStore = useCheckStore();
|
||||
const dialogVisible = ref(false)
|
||||
const selectTestItemPopupRef = ref<InstanceType<typeof SelectTestItemPopup>>()
|
||||
const testPopup = ref()
|
||||
@@ -185,20 +189,6 @@ const removeEdge = (params: any) => {
|
||||
}
|
||||
|
||||
|
||||
// 打印当前节点和连线信息
|
||||
function logConnections() {
|
||||
console.log('当前节点:', nodes.value);
|
||||
console.log('当前连线:', edges.value);
|
||||
|
||||
const connections = edges.value.map(edge => ({
|
||||
source: edge.source,
|
||||
target: edge.target,
|
||||
label: `${edge.source} → ${edge.target}`
|
||||
}));
|
||||
|
||||
console.table(connections);
|
||||
}
|
||||
|
||||
const nodes = ref([])
|
||||
const planId = ref('')
|
||||
const devIds = ref<string[]>()
|
||||
@@ -224,6 +214,25 @@ const handleNext = () => {
|
||||
}
|
||||
|
||||
const openTestDialog = async () => {
|
||||
const data = await getContrastTestNumInfo(checkStore.plan.id)
|
||||
|
||||
// 解析返回的数据,现在是 map 类型 {99: 1}
|
||||
const dataMap = data.data as Record<string, number>
|
||||
// 获取键值对
|
||||
const entries = Object.entries(dataMap)
|
||||
|
||||
// 获取第一对键值
|
||||
const [key, value] = entries[0]
|
||||
const former = Number(key)
|
||||
const latter = value
|
||||
|
||||
// 判断后者是否大于等于前者
|
||||
if (latter >= former) {
|
||||
ElMessage.warning(`检测次数不足`)
|
||||
return // 阻止继续执行
|
||||
}
|
||||
|
||||
|
||||
// 转换连接信息,只保留设备ID和通道号
|
||||
const connections = edges.value.reduce((map, edge) => {
|
||||
// 从source中提取设备ID和通道号: 被检通道-{deviceId}-{channelNum} => {deviceId}-{channelNum}
|
||||
@@ -238,6 +247,7 @@ const openTestDialog = async () => {
|
||||
|
||||
|
||||
generateChannelMapping()
|
||||
|
||||
testPopup.value?.open(dialogTitle.value,channelMapping.value,planId.value,jwtUtil.getLoginName(),devIds.value,standardDevIds.value,connections)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user