This commit is contained in:
sjl
2025-03-17 16:03:53 +08:00
3 changed files with 145 additions and 77 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>
@@ -1244,7 +1244,7 @@ const startTimer = () => {
} }
}; };
const handlePause = () => { const handlePause = () => {
emit('sendPause') //emit('sendPause')
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:当前测试小项正在执行中,将在该小项执行结束后暂停...`}) testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:当前测试小项正在执行中,将在该小项执行结束后暂停...`})
} }
@@ -1430,6 +1430,10 @@ onBeforeUnmount(() => {
clearInterval(timer) clearInterval(timer)
} }
}) })
defineExpose({
handlePause
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@@ -1481,7 +1485,6 @@ onBeforeUnmount(() => {
.timeView { .timeView {
display: flex; display: flex;
align-items: center; align-items: center;
color: #91cc75; color: #91cc75;
width: 28%; width: 28%;
margin-right: 0px; margin-right: 0px;
@@ -1517,7 +1520,6 @@ onBeforeUnmount(() => {
:deep(header.el-drawer__header) { :deep(header.el-drawer__header) {
color: #fff !important; color: #fff !important;
background-color: var(--el-color-primary) !important; background-color: var(--el-color-primary) !important;
.el-drawer__close-btn svg:hover { .el-drawer__close-btn svg:hover {
color: #ccc !important; color: #ccc !important;
} }

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;
} }

View File

@@ -13,17 +13,23 @@
<el-input v-model.trim="formContent.name" placeholder="请输入脚本名称" clearable /> <el-input v-model.trim="formContent.name" placeholder="请输入脚本名称" clearable />
</el-form-item> </el-form-item>
<el-form-item label="参照标准名称" prop="standardName"> <el-form-item label="参照标准名称" prop="standardName">
<el-input v-model.trim="formContent.standardName" placeholder="请输入参照标准名称" clearable /> <!-- <el-input v-model.trim="formContent.standardName" placeholder="请输入参照标准名称" clearable />-->
<el-select v-model="formContent.standardName" filterable placeholder="请选择参照标准名称" @change="setStandardTimeList">
<el-option v-for="item in standardNameList" :key="item.label" :label="item.label" :value="item.label" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="标准推行年份" prop="standardTime"> <el-form-item label="标准推行年份" prop="standardTime">
<el-date-picker <!-- <el-date-picker-->
v-model="formContent.standardTime" <!-- v-model="formContent.standardTime"-->
style="width: 100%" <!-- style="width: 100%"-->
type="year" <!-- type="year"-->
format="YYYY" <!-- format="YYYY"-->
value-format="YYYY" <!-- value-format="YYYY"-->
placeholder="请选择标准推行年份" <!-- placeholder="请选择标准推行年份"-->
/> <!-- />-->
<el-select v-model="formContent.standardTime" filterable placeholder="请选择标准推行年份">
<el-option v-for="item in standardTimeList" :key="item" :value="item" :label="item" />
</el-select>
</el-form-item> </el-form-item>
<el-form-item label="模版类型" prop="type"> <el-form-item label="模版类型" prop="type">
<el-select v-model="formContent.type" filterable clearable placeholder="请选择模版类型"> <el-select v-model="formContent.type" filterable clearable placeholder="请选择模版类型">
@@ -100,6 +106,8 @@ const modeId = ref()
const show = ref(false) const show = ref(false)
const height = ref('125px') const height = ref('125px')
const router = useRouter() const router = useRouter()
const standardNameList = reactive<{id:string,label: string, value: string}[]>([])
const standardTimeList = reactive<Array<string>>([])
const secondLevelOptions: any[] = [] const secondLevelOptions: any[] = []
// 定义弹出组件元信息 // 定义弹出组件元信息
@@ -166,6 +174,15 @@ const close = () => {
// 关闭信息弹框 // 关闭信息弹框
const closeInformation = () => {} const closeInformation = () => {}
const setStandardTimeList = ()=>{
let checkStandard = standardNameList.find(item => item.label === formContent.value.standardName)
if (checkStandard) {
standardTimeList.push(...checkStandard.value.split(','))
} else {
standardTimeList.push('2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024', '2025')
}
}
// 保存数据 // 保存数据
const save = () => { const save = () => {
// dialogFormRef // dialogFormRef
@@ -197,6 +214,10 @@ const save = () => {
// 打开弹窗,可能是新增,也可能是编辑 // 打开弹窗,可能是新增,也可能是编辑
const open = async (title: string, row: any) => { const open = async (title: string, row: any) => {
dictStore.getDictData("Script_Standard_Name").forEach(item => {
standardNameList.push({id: item.id, label: item.name, value: item.value})
})
titleType.value = title titleType.value = title
if (title == '新增检测脚本') { if (title == '新增检测脚本') {
show.value = false show.value = false