This commit is contained in:
caozehui
2025-01-03 11:27:36 +08:00
parent 8a5bcca901
commit 938b9054d3
7 changed files with 356 additions and 250 deletions

View File

@@ -11,7 +11,7 @@
v-if="testStatus=='process' && activeIndex < checkTotal"
:disabled="activeIndex===0"
:icon="VideoPause"
@click="handlePauseTest">停止检测
@click="emit('sendPause')">停止检测
</el-button>
<el-button
type="primary"
@@ -33,7 +33,7 @@
type="warning"
v-if="testStatus=='paused' && activeIndex < checkTotal"
:icon="Refresh"
@click="handleResumeTest"
@click="emit('sendResume')"
>继续检测
</el-button>
<el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
@@ -298,13 +298,13 @@ watch(testStatus, function (newValue, oldValue) {
startTimer() // todo 可移除
//emit('update:testStatus', 'process') // todo 可移除
}
if (newValue == 'paused' && oldValue == 'process') {
handlePauseOrContinue()
}
if (newValue === 'process' && oldValue == 'paused') {
activeIndex++
handlePauseOrContinue()
}
// if (newValue == 'paused' && oldValue == 'process') {
// handlePauseTest()
// }
// if (newValue === 'process' && oldValue == 'paused') {
//activeIndex++
//handleResumeTest()
// }
})
watch(webMsgSend, function (newValue, oldValue) {
@@ -388,6 +388,7 @@ watch(webMsgSend, function (newValue, oldValue) {
case 'Pause_Success':
ElMessage.success('暂停成功')
emit('update:testStatus', 'paused')
handlePauseTest()
break;
case 'Pause_Fail':
ElMessage.error('暂停失败')
@@ -395,6 +396,7 @@ watch(webMsgSend, function (newValue, oldValue) {
case 'Resume_Success':
ElMessage.success('开始继续检测')
emit('update:testStatus', 'process')
handleResumeTest()
break;
case 'Resume_Fail':
ElMessage.error('无法继续检测')
@@ -573,8 +575,6 @@ const updatePercentage = () => {
emit('update:testStatus', 'success')
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
// if you want to disable its autofocus
// autofocus: false,
confirmButtonText: '确定',
})
clear();
@@ -767,7 +767,6 @@ const updateLog = (isStart: boolean) => {
// }
const updateCheckResultView = (scriptCode: string, isStart: boolean) => {
// debugger
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
let temp = null
if (isStart) {
@@ -804,7 +803,6 @@ const getLoadingResult = (scriptType: string) => {
return tempScriptChnItem
}
// 模拟检测 todo 可移除
const getCheckResult = (scriptType: string) => {
// debugger
@@ -866,32 +864,6 @@ const getCheckResult = (scriptType: string) => {
return tempScriptChnItem
}
// 处理暂停、继续按钮点击事件
const handlePauseOrContinue = () => {
const currentTime = ref(new Date().toLocaleString());
if (testStatus.value == "paused") {
endData.value = new Date();
const Pausetime = endData.value.getTime() - startData.value.getTime();
timeDifference.value += Pausetime
testLogList.push({
type: 'info',
log: currentTime.value + ':暂停检测',
})
console.log('暂停中')
}
if (testStatus.value == "process") {
startData.value = new Date();
testLogList.push({
type: 'info',
log: currentTime.value + ':继续检测',
})
startTimer()
console.log('开始继续检测')
}
};
// 点击查看设备通道检测详情。参数1设备信息参数2通道号-1代表查看全部通道
const handleClick = (item: any, chnNum: string, scriptType: string) => {
let checkResultItem = checkResult.find(obj => obj.scriptType === scriptType)
@@ -935,17 +907,18 @@ const startTimer = () => {
switch (activeIndex) {
case 1:
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'yjc_ytxjy',
operateCode: "INIT_GATHER",
code: "2222"
})},2000)
emit('update:webMsgSend', {
requestId: 'yjc_ytxjy',
operateCode: "INIT_GATHER",
code: "2222"
})
}, 2000)
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'yjc_sbtxjy',
operateCode: "INIT_GATHER$01",
code: "2222",
data:'240003'
data: '240003'
})
}, 4000);
setTimeout(() => {
@@ -953,13 +926,13 @@ const startTimer = () => {
requestId: 'YJC_xujy',
operateCode: "DATA_REQUEST$02"
})
},6000)
setTimeout(()=>{
}, 6000)
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'FREQ_Start',
params: {}
})
},9000)
}, 9000)
setTimeout(() => {
emit('update:webMsgSend', {
requestId: 'FREQ_End',
@@ -1109,13 +1082,26 @@ const startTimer = () => {
};
const handlePauseTest = () => {
// 发送暂停指令
emit('sendPause')
endData.value = new Date();
let diffTime = endData.value.getTime() - startData.value.getTime();
timeDifference.value += diffTime
testLogList.push({
type: 'info',
log: `${new Date().toLocaleString()}:暂停检测`,
})
console.log('暂停中')
};
const handleResumeTest = () => {
// 发送继续检测指令
emit('sendResume')
activeIndex++
startData.value = new Date();
testLogList.push({
type: 'info',
log: `${new Date().toLocaleString()}:继续检测`,
})
startTimer()
console.log('开始继续检测')
};
//完成检测