This commit is contained in:
caozehui
2024-12-30 14:41:34 +08:00
parent 45a5dcb068
commit c334c07b39
3 changed files with 76 additions and 37 deletions

View File

@@ -11,7 +11,7 @@
v-if="testStatus=='process' && activeIndex < checkTotal"
:disabled="activeIndex===0"
:icon="VideoPause"
@click="emit('update:testStatus','paused')">停止检测
@click="handlePauseTest">停止检测
</el-button>
<el-button type="success" v-if="activeIndex >= checkTotal" :icon="Check" disabled>检测完成</el-button>
@@ -20,7 +20,7 @@
type="warning"
v-if="testStatus=='paused' && activeIndex < checkTotal"
:icon="Refresh"
@click="emit('update:testStatus','process')"
@click="handleResumeTest"
>继续检测
</el-button>
<el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
@@ -145,6 +145,7 @@ import {reactive, ref, watch} from "vue";
import {dialogBig} from "@/utils/elementBind";
import {CheckData} from "@/api/check/interface"
import {useCheckStore} from "@/stores/modules/check";
import {ElMessage, ElMessageBox} from "element-plus";
const checkStore = useCheckStore()
@@ -165,7 +166,7 @@ const props = defineProps({
}
})
const emit = defineEmits(['update:testStatus', 'update:webMsgSend']);
const emit = defineEmits(['update:testStatus', 'update:webMsgSend','sendPause','sendResume']);
// 用来保存测试项进度抽屉是否打开
const drawer = ref(false)
@@ -187,7 +188,7 @@ const timeDifference = ref(0)
// 真正的检测结果(详细到通道)
const checkResult = reactive<CheckData.ScriptChnItem[]>([])
// 用来存放检测出现失败的测试项id。只要有一个通道检测不合格则该检测项的id会被加入该数组。
let errorCheckItem:Array<{ scriptId: string, type: 'info' | 'warning' | 'error' }> = []
let errorCheckItem: Array<{ scriptId: string, type: 'info' | 'warning' | 'error' }> = []
// 用来存放检测日志
const testLogList = reactive<CheckData.LogItem[]>([{type: 'info', log: '暂无数据,等待检测开始'}])
@@ -303,6 +304,28 @@ watch(testStatus, function (newValue, oldValue) {
watch(webMsgSend, function (newValue, oldValue) {
if (activeIndex <= checkTotal) {
switch (newValue.requestId) {
case 'Test_PreTest_Fail':
ElMessageBox.alert('预检测失败,请检查设备连接情况', '预检测失败', {
confirmButtonText: '确定',
type: 'error',
}).then(() => {
emit('update:testStatus', 'success')
})
break;
case 'Test_Pause_Success':
ElMessage.success('暂停成功')
emit('update:testStatus','paused')
break;
case 'Test_Pause_Fail':
ElMessage.error('暂停失败')
break;
case 'Test_Resume_Success':
ElMessage.success('开始继续检测')
emit('update:testStatus','process')
break;
case 'Test_Resume_Fail':
ElMessage.error('无法继续检测')
break;
case 'Test_VOL_Start':
updateCheckResultView("VOL", true)
updateLog(true)
@@ -312,7 +335,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false)
updatePercentage()
if (testStatus.value != 'paused') {
activeIndex++;
activeIndex++
startTimer()
}
break;
@@ -838,7 +861,6 @@ const handlePauseOrContinue = () => {
type: 'info',
log: currentTime.value + ':暂停检测',
})
//pauseTimer()
console.log('暂停中')
}
if (testStatus.value == "process") {
@@ -847,7 +869,6 @@ const handlePauseOrContinue = () => {
type: 'info',
log: currentTime.value + ':继续检测',
})
//resumeTimer()
startTimer()
console.log('开始继续检测')
}
@@ -1016,20 +1037,15 @@ const startTimer = () => {
}
};
// const pauseTimer = () => {
// if (timer.value) {
// clearInterval(timer.value);
// timer.value = null;
// }
// console.log('暂停中')
// };
const handlePauseTest = () => {
// 发送暂停指令
emit('sendPause')
};
// const resumeTimer = () => {
// if (!timer.value) {
// startTimer();
// }
// console.log('开始继续检测')
// };
const handleResumeTest = () => {
// 发送继续检测指令
emit('sendResume')
};
//完成检测
const handleFinishTest = () => {