This commit is contained in:
caozehui
2025-05-26 14:41:06 +08:00
parent e192158deb
commit 9989cc98cb
6 changed files with 119 additions and 90 deletions

View File

@@ -102,6 +102,7 @@ export namespace CheckData {
devVolt: number; //设备电压
devCurr: number; //设备电流
factorFlag: number; //是否支持系数校准
checkResult:number; //检测结果
}
// 用来描述检测脚本类型

View File

@@ -597,6 +597,14 @@ watch(webMsgSend, function (newValue, oldValue) {
ts.value = 'error'
step5.value = 'error'
break;
case 'device_error':
ElMessageBox.alert('设备主动关闭连接!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
ts.value = 'error'
step5.value = 'error'
break;
}
}
})

View File

@@ -51,7 +51,8 @@ const open = async () => {
// 清空表单内容
const resetFormContent = () => {
Object.assign(formContent, {preTest: true, channelsTest: false, timeTest: false, test: false})
let hasResult = checkStore.devices.some((device) => device.checkResult === 0)
Object.assign(formContent, {preTest: !hasResult, channelsTest: false, timeTest: false, test: hasResult})
}
const handleStart = () => {

View File

@@ -651,6 +651,7 @@ const handleSelectionChange = (selection: any[]) => {
devVolt: item.devVolt,
devCurr: item.devCurr,
factorFlag: item.factorFlag,
checkResult: item.checkResult,
}
})
@@ -1022,23 +1023,25 @@ const handleTest = async (val: string) => {
if(appSceneStore.currentScene === '0'){
writeTHPopupRef.value?.open()
}else{
openTestDialog(false)
openTestDialog()
}
})
.catch((action: Action) => {
if (action === 'cancel') {
ElMessage.success('全部复检')
checkStore.setReCheckType(1)
//openTestDialog(false)
if (appSceneStore.currentScene === '0') {
writeTHPopupRef.value?.open()
} else {
openTestDialog(false)
openTestDialog()
}
}
})
checkStore.setSelectTestItems({preTest: false, timeTest: false, channelsTest: false, test: true})
} else {
openTestDialog()
}
}
}
if (val === '批量下载') {
@@ -1081,14 +1084,12 @@ const handleTest = async (val: string) => {
}
}
const openTestDialog = (test:boolean) => {
console.log('openTestDialog',test)
if(dialogTitle.value === '手动检测' && appSceneStore.currentScene === '0' && test == true){
const openTestDialog = () => {
if (appSceneStore.currentScene === '0') {
writeTHPopupRef.value?.open()
} else {
testPopup.value?.open(dialogTitle.value)
}
}

View File

@@ -145,7 +145,7 @@
</div>
<div class="drawer-container">
<el-drawer v-model="drawer" title="检测项进度" direction="btt">
<el-drawer v-model="drawer" title="检测项进度" direction="btt" :size="'38%'">
<div ref="scrollContainerRef" style="height: 100%; overflow-y: auto;">
<p v-for="(item, index) in testLogList"
:key="index"
@@ -164,7 +164,7 @@
</div>
</template>
<script lang="tsx" setup name="test">
import {Check, InfoFilled, Loading, Refresh, VideoPause, VideoPlay} from '@element-plus/icons-vue'
import {InfoFilled, Loading} from '@element-plus/icons-vue'
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
import {computed, reactive, ref, toRef, watch} from "vue";
import {dialogBig} from "@/utils/elementBind";
@@ -198,7 +198,7 @@ const props = defineProps({
}
})
const emit = defineEmits(['update:testStatus', 'update:webMsgSend', 'sendPause', 'sendResume', 'sendReCheck']);
const emit = defineEmits(['update:testStatus', 'update:webMsgSend', 'sendPause', 'sendResume', 'sendReCheck', 'closeWebSocket']);
// 用来保存测试项进度抽屉是否打开
const drawer = ref(false)
@@ -456,7 +456,18 @@ watch(webMsgSend, function (newValue, oldValue) {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}源连接失败`})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}服务端主动关闭连接`})
emit('update:testStatus', 'test_init_fail')
count++
}
break;
case 'device_error':
if (newValue.operateCode === 'device_error' && count === 0) {
ElMessageBox.alert('设备端主动关闭连接!', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备端主动关闭连接!`})
emit('update:testStatus', 'test_init_fail')
count++
}
@@ -682,9 +693,9 @@ const handleStartItem = (code: string, desc: string | undefined) => {
updateCheckResultView(code, true)
updateLog(true)
} else {
if (desc.length > 150) {
desc = desc.substring(0, 150) + '...'
}
// if (desc.length > 150) {
// desc = desc.substring(0, 150) + '...'
// }
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}准确度检测:开始`})
}
}
@@ -700,9 +711,9 @@ const handleEndItem = (code: string, desc: string | undefined, devices: CheckDat
}
} else {
let result = getResult(devices)
if (desc.length > 150) {
desc = desc.substring(0, 150) + '...'
}
// if (desc.length > 150) {
// desc = desc.substring(0, 150) + '...'
// }
if (result === 1) {
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}检测结束:符合`})
}
@@ -740,6 +751,8 @@ const updatePercentage = async () => {
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
confirmButtonText: '确定',
})
// 关闭WebSocket连接
emit('closeWebSocket')
//clear();
}
}
@@ -1566,6 +1579,7 @@ defineExpose({
:deep(header.el-drawer__header) {
color: #fff !important;
background-color: var(--el-color-primary) !important;
.el-drawer__close-btn svg:hover {
color: #ccc !important;
}

View File

@@ -17,7 +17,7 @@
<!-- <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"/>
<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" @closeWebSocket="closeWebSocket" :stepsActive="stepsActive"/>
<template #footer>
<div>
@@ -398,6 +398,10 @@ const sendReCheck = () => {
TestStatus.value = 'start'
}
const closeWebSocket = () => {
dataSocket.socketServe.closeWs()
}
const nextStep = () => {
if (stepsActiveIndex.value == stepsTotalNum.value + 1 || ActiveStatue.value === 'error' || ActiveStatue.value === 'test_init_fail' || ActiveStatue.value === 'connect_timeout' || ActiveStatue.value === 'pause_timeout') {
handleClose()