调整开始检测接口
This commit is contained in:
@@ -72,7 +72,7 @@ import ComparePreTest from './comparePreTest.vue'
|
||||
import CompareTest from './compareTest.vue'
|
||||
import socketClient from '@/utils/webSocketClient';
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {pauseTest, resumeTest, startPreTest,contrastTest} from '@/api/socket/socket'
|
||||
import {pauseTest, resumeTest, startPreTest,contrastTest,getContrastTestNumInfo} from '@/api/socket/socket'
|
||||
import {useUserStore} from "@/stores/modules/user";
|
||||
import {JwtUtil} from "@/utils/jwtUtil";
|
||||
|
||||
@@ -145,6 +145,7 @@ const devIds = ref<[]>()
|
||||
const standardDevIds = ref<[]>()
|
||||
const pairs = ref<any>()
|
||||
const testAgain = ref(false)//重新检测按钮是否显示
|
||||
const checkNumber = ref(0)//检测次数
|
||||
const open = async (title: string,mapping:any,plan: string,login: string,devIdsArray: [],standardDevIdsArray: [],pair:any) => {
|
||||
if(checkStore.selectTestItems.preTest && !checkStore.selectTestItems.test){
|
||||
testAgain.value = true
|
||||
@@ -203,6 +204,7 @@ const handleSubmitAgain = async () => {
|
||||
ActiveStatue.value = 'waiting'
|
||||
preTestStatus.value = 'waiting'
|
||||
|
||||
const checkNum = await mapValue()
|
||||
|
||||
await contrastTest({
|
||||
planId: planId.value,
|
||||
@@ -210,7 +212,8 @@ const handleSubmitAgain = async () => {
|
||||
devIds: devIds.value,
|
||||
standardDevIds: standardDevIds.value,
|
||||
pairs:pairs.value,
|
||||
testItemList:[checkStore.selectTestItems.preTest,false,checkStore.selectTestItems.test]
|
||||
testItemList:[checkStore.selectTestItems.preTest,false,checkStore.selectTestItems.test],
|
||||
num: checkNum
|
||||
})
|
||||
|
||||
preTestStatus.value = 'start'
|
||||
@@ -222,7 +225,10 @@ const handleSubmitFast = async () => {
|
||||
ElMessage.error('webSocket连接中断!')
|
||||
return
|
||||
}
|
||||
console.log("handleSubmit", TestStatus.value)
|
||||
|
||||
const checkNum = await mapValue()
|
||||
|
||||
|
||||
switch (stepsActive.value) {
|
||||
case 1:
|
||||
if (preTestStatus.value == 'waiting') {
|
||||
@@ -233,7 +239,8 @@ const handleSubmitFast = async () => {
|
||||
devIds: devIds.value,
|
||||
standardDevIds: standardDevIds.value,
|
||||
pairs:pairs.value,
|
||||
testItemList:[checkStore.selectTestItems.preTest,false,checkStore.selectTestItems.test]
|
||||
testItemList:[checkStore.selectTestItems.preTest,false,checkStore.selectTestItems.test],
|
||||
num: checkNum
|
||||
})
|
||||
|
||||
preTestStatus.value = 'start'
|
||||
@@ -254,6 +261,18 @@ const handleSubmitFast = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const mapValue = (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]
|
||||
|
||||
return value
|
||||
})
|
||||
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'quitClicked'): void;
|
||||
|
||||
Reference in New Issue
Block a user