正式检测-时间显示调整

This commit is contained in:
caozehui
2025-02-19 13:17:19 +08:00
parent 700884d01a
commit d28669e6b0

View File

@@ -1,68 +1,70 @@
<template> <template>
<div class="dialog" v-bind="dialogBig"> <div class="dialog" v-bind="dialogBig">
<div class="dialog-title"> <div class="dialog-title">
<div class="timeView">检测用时{{ timeView }}</div>
<el-progress <el-progress
style="width: 65%" style="width: 55%; margin-right: 15px;"
:percentage="percentage" :percentage="percentage"
:color="customColors"/> :color="customColors"/>
<el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()"> <div style="width: 12%">
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;"> <el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()">
<component :is="Refresh"/> <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
</el-icon> <component :is="Refresh"/>
初始化中 </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--> <!-- <el-button-->
<!-- type="primary"--> <!-- type="primary"-->
<!-- v-if="testStatus=='test_init'"--> <!-- v-if="testStatus=='test_init'"-->
<!-- :icon="VideoPause"--> <!-- :icon="VideoPause"-->
<!-- disabled>初始化中--> <!-- disabled>初始化中-->
<!-- </el-button>--> <!-- </el-button>-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="danger"--> <!-- type="danger"-->
<!-- v-if="testStatus=='test_init_fail'"--> <!-- v-if="testStatus=='test_init_fail'"-->
<!-- :icon="Failed"--> <!-- :icon="Failed"-->
<!-- disabled>初始化失败--> <!-- disabled>初始化失败-->
<!-- </el-button>--> <!-- </el-button>-->
<!-- <el-button--> <!-- <el-button-->
<!-- type="danger"--> <!-- type="danger"-->
<!-- v-if="testStatus=='connect_timeout'"--> <!-- v-if="testStatus=='connect_timeout'"-->
<!-- :icon="Failed"--> <!-- :icon="Failed"-->
<!-- disabled>连接超时--> <!-- disabled>连接超时-->
<!-- </el-button>--> <!-- </el-button>-->
<el-button <el-button
type="primary" type="primary"
:icon="RefreshLeft" :icon="RefreshLeft"
v-if="testStatus === 'test_recheck'" v-if="testStatus === 'test_recheck'"
@click="emit('sendReCheck')">重新检测 @click="emit('sendReCheck')">重新检测
</el-button> </el-button>
<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 type="text" :icon="Timer" disabled>检测用时{{ timeView }}</div> </div>
<el-button type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button> <el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
</div> </div>
<div class="dialog-content"> <div class="dialog-content">
@@ -133,7 +135,7 @@
</div> </div>
<div class="drawer-container"> <div class="drawer-container">
<el-drawer v-model="drawer" title="检测项进度"> <el-drawer v-model="drawer" title="检测项进度" direction="btt">
<div ref="scrollContainerRef" style="height: 100%; overflow-y: auto;"> <div ref="scrollContainerRef" style="height: 100%; overflow-y: auto;">
<p v-for="(item, index) in testLogList" <p v-for="(item, index) in testLogList"
:key="index" :key="index"
@@ -151,7 +153,7 @@
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/> <dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
</template> </template>
<script lang="tsx" setup name="test"> <script lang="tsx" setup name="test">
import {Check, Failed, InfoFilled, Loading, Timer,Refresh, RefreshLeft, VideoPause, VideoPlay} from '@element-plus/icons-vue' import {Check, Failed, InfoFilled, Loading, Timer, Refresh, RefreshLeft, VideoPause, VideoPlay} from '@element-plus/icons-vue'
import resultPopup from './resultPopup.vue' import resultPopup from './resultPopup.vue'
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue' import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
import {computed, reactive, ref, toRef, watch} from "vue"; import {computed, reactive, ref, toRef, watch} from "vue";
@@ -185,7 +187,7 @@ const emit = defineEmits(['update:testStatus', 'update:webMsgSend', 'sendPause',
// 用来保存测试项进度抽屉是否打开 // 用来保存测试项进度抽屉是否打开
const drawer = ref(false) const drawer = ref(false)
// 进度条颜色 // 进度条颜色
const customColors = [{color: "#5cb87a", percentage: 100}] const customColors = [{color: "#67c23a", percentage: 100}]
// 检测脚本数据 // 检测脚本数据
let scriptData: CheckData.ScriptItem[] = [] let scriptData: CheckData.ScriptItem[] = []
// 用来保存被检设备 // 用来保存被检设备
@@ -633,8 +635,8 @@ const handleStartItem = (code: string, desc: string | undefined) => {
updateCheckResultView(code, true) updateCheckResultView(code, true)
updateLog(true) updateLog(true)
} else { } else {
if (desc.length > 60) { if (desc.length > 100) {
desc = desc.substring(0, 60) + '...' desc = desc.substring(0, 100) + '...'
} }
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}准确度检测:开始`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}准确度检测:开始`})
} }
@@ -651,8 +653,8 @@ const handleEndItem = (code: string, desc: string | undefined, devices: CheckDat
} }
} else { } else {
let result = getResult(devices) let result = getResult(devices)
if (desc.length > 60) { if (desc.length > 100) {
desc = desc.substring(0, 60) + '...' desc = desc.substring(0, 100) + '...'
} }
if (result === 1) { if (result === 1) {
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}检测结束:符合`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}检测结束:符合`})
@@ -776,7 +778,7 @@ const updateCheckResult = (data: CheckData.ScriptChnItem) => {
const scrollToBottom = () => { const scrollToBottom = () => {
if (scrollContainerRef.value) { if (scrollContainerRef.value) {
scrollContainerRef.value.scrollTop = scrollContainerRef.value.scrollHeight; scrollContainerRef.value.scrollTop = scrollContainerRef.value.scrollHeight-50;
} }
}; };
@@ -859,7 +861,7 @@ const updateLog = (isStart: boolean) => {
break break
} }
timeView.value = secondToTime(timeDifference.value/1000) timeView.value = secondToTime(timeDifference.value / 1000)
if (activeIndex === checkTotal) { if (activeIndex === checkTotal) {
testLogList.push({ testLogList.push({
type: 'info', type: 'info',
@@ -1445,11 +1447,22 @@ onBeforeUnmount(() => {
} }
.dialog-title { .dialog-title {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-right: 10px; margin-right: 10px;
margin-bottom: 10px; margin-bottom: 10px;
.timeView {
color: #67c23a;;
width: 25%;
margin-left: 5px;
margin-right: 0px;
text-align: left;
font-size: 26px;
font-weight: bold;
}
} }
.dialog-content { .dialog-content {