This commit is contained in:
caozehui
2025-03-17 13:24:35 +08:00
parent 630eb48d28
commit eda7b516f6
2 changed files with 116 additions and 66 deletions

View File

@@ -9,67 +9,67 @@
<span>检测用时{{ timeView }}</span> <span>检测用时{{ timeView }}</span>
</div> </div>
<el-progress <el-progress
style="width: 60%; margin-right: 4%;" style="width: 82%; margin-right: 3%;"
:percentage="percentage" :percentage="percentage"
:color="customColors"/> :color="customColors"/>
<div style="width: 15%"> <!-- <div style="width: 15%">-->
<el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()"> <!-- <el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()">-->
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;"> <!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
<component :is="Refresh"/> <!-- <component :is="Refresh"/>-->
</el-icon> <!-- </el-icon>-->
初始化中 <!-- 初始化中-->
</el-button> <!-- </el-button>-->
<el-button <!-- <el-button-->
type="primary" <!-- type="primary"-->
v-if="testStatus=='process' && percentage < 100" <!-- v-if="testStatus=='process' && percentage < 100"-->
:icon="VideoPause" <!-- :icon="VideoPause"-->
@click="handlePause()">停止检测 <!-- @click="handlePause()">停止检测-->
</el-button> <!-- </el-button>-->
<el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled> <!-- <el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled>-->
<el-icon class="loading-box" style="margin-right: 8px;"> <!-- <el-icon class="loading-box" style="margin-right: 8px;">-->
<component :is="Refresh"/> <!-- <component :is="Refresh"/>-->
</el-icon> <!-- </el-icon>-->
暂停中 <!-- 暂停中-->
</el-button> <!-- </el-button>-->
<!-- <el-button--> <!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- type="primary"--> <!-- &lt;!&ndash; type="primary"&ndash;&gt;-->
<!-- v-if="testStatus=='test_init'"--> <!-- &lt;!&ndash; v-if="testStatus=='test_init'"&ndash;&gt;-->
<!-- :icon="VideoPause"--> <!-- &lt;!&ndash; :icon="VideoPause"&ndash;&gt;-->
<!-- disabled>初始化中--> <!-- &lt;!&ndash; disabled>初始化中&ndash;&gt;-->
<!-- </el-button>--> <!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- <el-button--> <!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- type="danger"--> <!-- &lt;!&ndash; type="danger"&ndash;&gt;-->
<!-- v-if="testStatus=='test_init_fail'"--> <!-- &lt;!&ndash; v-if="testStatus=='test_init_fail'"&ndash;&gt;-->
<!-- :icon="Failed"--> <!-- &lt;!&ndash; :icon="Failed"&ndash;&gt;-->
<!-- disabled>初始化失败--> <!-- &lt;!&ndash; disabled>初始化失败&ndash;&gt;-->
<!-- </el-button>--> <!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- <el-button--> <!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- type="danger"--> <!-- &lt;!&ndash; type="danger"&ndash;&gt;-->
<!-- v-if="testStatus=='connect_timeout'"--> <!-- &lt;!&ndash; v-if="testStatus=='connect_timeout'"&ndash;&gt;-->
<!-- :icon="Failed"--> <!-- &lt;!&ndash; :icon="Failed"&ndash;&gt;-->
<!-- disabled>连接超时--> <!-- &lt;!&ndash; disabled>连接超时&ndash;&gt;-->
<!-- </el-button>--> <!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- <el-button--> <!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- type="primary"--> <!-- &lt;!&ndash; type="primary"&ndash;&gt;-->
<!-- :icon="RefreshLeft"--> <!-- &lt;!&ndash; :icon="RefreshLeft"&ndash;&gt;-->
<!-- v-if="testStatus === 'recheck'"--> <!-- &lt;!&ndash; v-if="testStatus === 'recheck'"&ndash;&gt;-->
<!-- @click="emit('sendReCheck')">重新检测--> <!-- &lt;!&ndash; @click="emit('sendReCheck')">重新检测&ndash;&gt;-->
<!-- </el-button>--> <!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<el-button type="success" v-if="percentage >= 100" :icon="Check" disabled>检测完成</el-button> <!-- <el-button type="success" v-if="percentage >= 100" :icon="Check" disabled>检测完成</el-button>-->
<el-button <!-- <el-button-->
type="warning" <!-- type="warning"-->
v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100" <!-- v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100"-->
:icon="VideoPlay" <!-- :icon="VideoPlay"-->
:disabled="testStatus === 'pause_timeout'" <!-- :disabled="testStatus === 'pause_timeout'"-->
@click="emit('sendResume')" <!-- @click="emit('sendResume')"-->
>继续检测 <!-- >继续检测-->
</el-button> <!-- </el-button>-->
</div> <!-- </div>-->
<el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button> <el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
</div> </div>
@@ -1428,6 +1428,10 @@ onBeforeUnmount(() => {
clearInterval(timer) clearInterval(timer)
} }
}) })
defineExpose({
handlePause
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -1480,7 +1484,8 @@ onBeforeUnmount(() => {
display: flex; display: flex;
align-items: center; align-items: center;
color: #67c23a;; //color: #67c23a;
color: #91cc75;
width: 28%; width: 28%;
margin-right: 0px; margin-right: 0px;
text-align: left; text-align: left;

View File

@@ -16,28 +16,30 @@
<timeTest v-if="showComponent&&timeTestSelected" v-show="timeTestSelected && stepsActiveView==2" v-model:testStatus="timeTestStatus"/> <timeTest v-if="showComponent&&timeTestSelected" v-show="timeTestSelected && stepsActiveView==2" v-model:testStatus="timeTestStatus"/>
<!-- <channelsTest v-if="stepsActiveIndex === 3" v-model:testStatus="channelsTestStatus"></channelsTest>--> <!-- <channelsTest v-if="stepsActiveIndex === 3" v-model:testStatus="channelsTestStatus"></channelsTest>-->
<factorTest v-if="showComponent&&channelsTestSelected" v-show="channelsTestSelected && stepsActiveView==3" v-model:testStatus="channelsTestStatus" :webMsgSend="webMsgSend"/> <factorTest v-if="showComponent&&channelsTestSelected" v-show="channelsTestSelected && stepsActiveView==3" v-model:testStatus="channelsTestStatus" :webMsgSend="webMsgSend"/>
<test v-if="showComponent&&testSelected" v-show="testSelected && stepsActiveView==4" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" <test v-if="showComponent&&testSelected" ref="testRef" v-show="testSelected && stepsActiveView==4" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend"
@update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck" :stepsActive="stepsActive"/> @update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck" :stepsActive="stepsActive"/>
<template #footer> <template #footer>
<div> <div>
<!-- <el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < stepsTotalNum && ActiveStatue != 'success'" @click="nextStep">跳过</el-button>--> <!-- <el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < stepsTotalNum && ActiveStatue != 'success'" @click="nextStep">跳过</el-button>-->
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button> <el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
<el-button type="primary" <!-- <el-button type="primary"-->
v-if="(stepsActiveIndex <= stepsTotalNum - 1) && (ActiveStatue !== 'success' &&ActiveStatue !== 'test_init' && ActiveStatue !=='paused_ing' && ActiveStatue !=='paused' && ActiveStatue !== 'waiting' && ActiveStatue !== 'error' && ActiveStatue !== 'test_init_fail' && ActiveStatue !== 'connect_timeout' && ActiveStatue!=='pause_timeout')" <!-- v-if="(stepsActiveIndex <= stepsTotalNum - 1) && (ActiveStatue !== 'success' &&ActiveStatue !== 'test_init' && ActiveStatue !=='paused_ing' && ActiveStatue !=='paused' && ActiveStatue !== 'waiting' && ActiveStatue !== 'error' && ActiveStatue !== 'test_init_fail' && ActiveStatue !== 'connect_timeout' && ActiveStatue!=='pause_timeout')"-->
disabled> <!-- disabled>-->
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;"> <!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
<component :is="Refresh"/> <!-- <component :is="Refresh"/>-->
</el-icon> <!-- </el-icon>-->
检测中 <!-- 检测中-->
</el-button> <!-- </el-button>-->
<!-- <el-button type="primary" v-if="ActiveStatue === 'process'" disabled>--> <!-- <el-button type="primary" v-if="ActiveStatue === 'process'" disabled>-->
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">--> <!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
<!-- <component :is="Refresh"/>--> <!-- <component :is="Refresh"/>-->
<!-- </el-icon>--> <!-- </el-icon>-->
<!-- 检测中--> <!-- 检测中-->
<!-- </el-button>--> <!-- </el-button>-->
<el-button type="warning" :icon="VideoPlay" v-if="TestStatus === 'paused'" @click="handleSubmit">继续检测</el-button> <!-- <el-button type="warning" :icon="VideoPlay" v-if="TestStatus === 'paused'" @click="handleSubmit">继续检测</el-button>-->
<!-- <el-button type="primary" :icon="RefreshLeft" v-if="ActiveStatue === 'recheck' || ActiveStatue ==='error' || ActiveStatue ==='test_init_fail' || ActiveStatue === 'pause_timeout' || ActiveStatue === 'connect_timeout'" @click="handleSubmit">重新检测</el-button>--> <!-- <el-button type="primary" :icon="RefreshLeft" v-if="ActiveStatue === 'recheck' || ActiveStatue ==='error' || ActiveStatue ==='test_init_fail' || ActiveStatue === 'pause_timeout' || ActiveStatue === 'connect_timeout'" @click="handleSubmit">重新检测</el-button>-->
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled> <el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;"> <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
@@ -45,17 +47,34 @@
</el-icon> </el-icon>
初始化中 初始化中
</el-button> </el-button>
<el-button
type="primary"
v-if="TestStatus=='process'"
:icon="VideoPause"
@click="handlePause()">停止检测
</el-button>
<el-button type="warning" v-if="TestStatus === 'paused_ing'" disabled> <el-button type="warning" v-if="TestStatus === 'paused_ing'" disabled>
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;"> <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
<component :is="Refresh"/> <component :is="Refresh"/>
</el-icon> </el-icon>
暂停中 暂停中
</el-button> </el-button>
<el-button
type="warning"
v-if="(TestStatus =='paused')"
:icon="VideoPlay"
@click="sendResume"
>继续检测
</el-button>
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right" <el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
v-if="nextStepText !== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')" v-if="nextStepText !== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')"
@click="nextStep"> @click="nextStep">
{{ nextStepText }} {{ nextStepText }}
</el-button> </el-button>
<el-button type="primary" @click="handleQuit" v-else>
退出检测
</el-button>
</div> </div>
</template> </template>
</el-dialog> </el-dialog>
@@ -66,7 +85,7 @@
<script lang="tsx" setup name="testPopup"> <script lang="tsx" setup name="testPopup">
import {reactive, ref, watch} from 'vue'; import {reactive, ref, watch} from 'vue';
import {ElMessage, ElMessageBox} from 'element-plus' import {ElMessage, ElMessageBox} from 'element-plus'
import {Coin, DArrowRight, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPlay} from '@element-plus/icons-vue' import {Coin, DArrowRight, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPlay,VideoPause} from '@element-plus/icons-vue'
import preTest from './preTest.vue' import preTest from './preTest.vue'
import timeTest from './timeTest.vue' import timeTest from './timeTest.vue'
import factorTest from './factorTest.vue' import factorTest from './factorTest.vue'
@@ -93,6 +112,7 @@ const webMsgSend = ref();//webSocket推送的数据
const dialogTitle = ref('') const dialogTitle = ref('')
const showComponent = ref(true) const showComponent = ref(true)
const preTestRef = ref(null) const preTestRef = ref(null)
const testRef = ref(null)
const dataSocket = reactive({ const dataSocket = reactive({
socketServe: socketClient.Instance, socketServe: socketClient.Instance,
@@ -302,6 +322,20 @@ watch(ActiveStatue, function (newValue, oldValue) {
}) })
const handleQuit = () => {
console.log('handleQuit',ActiveStatue.value)
if (ActiveStatue.value !== 'success' && ActiveStatue.value !== 'waiting' && ActiveStatue.value !== 'paused' && ActiveStatue.value !== 'test_init_fail' && ActiveStatue.value !== 'connect_timeout' && ActiveStatue.value !== 'pause_timeout') {
beforeClose(() => {})
} else {
handleClose()
}
}
const handlePause=()=>{
sendPause()
testRef.value?.handlePause()
}
const sendPause = () => { const sendPause = () => {
console.log('发起暂停请求') console.log('发起暂停请求')
@@ -440,6 +474,17 @@ defineExpose({open})
<style scoped lang="scss"> <style scoped lang="scss">
.test-head-steps {
::v-deep .el-step {
.el-step__head.is-success {
color: #91cc75;
}
.el-step__title.is-success{
color: #91cc75;
}
}
}
:deep(.dialog-big .el-dialog__body) { :deep(.dialog-big .el-dialog__body) {
max-height: 840px !important; max-height: 840px !important;
} }