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; //设备电压 devVolt: number; //设备电压
devCurr: number; //设备电流 devCurr: number; //设备电流
factorFlag: number; //是否支持系数校准 factorFlag: number; //是否支持系数校准
checkResult:number; //检测结果
} }
// 用来描述检测脚本类型 // 用来描述检测脚本类型

View File

@@ -597,6 +597,14 @@ watch(webMsgSend, function (newValue, oldValue) {
ts.value = 'error' ts.value = 'error'
step5.value = 'error' step5.value = 'error'
break; 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 = () => { 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 = () => { const handleStart = () => {

View File

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

View File

@@ -13,63 +13,63 @@
: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>-->
<!-- &lt;!&ndash; <el-button&ndash;&gt;--> <!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- &lt;!&ndash; type="primary"&ndash;&gt;--> <!-- &lt;!&ndash; type="primary"&ndash;&gt;-->
<!-- &lt;!&ndash; v-if="testStatus=='test_init'"&ndash;&gt;--> <!-- &lt;!&ndash; v-if="testStatus=='test_init'"&ndash;&gt;-->
<!-- &lt;!&ndash; :icon="VideoPause"&ndash;&gt;--> <!-- &lt;!&ndash; :icon="VideoPause"&ndash;&gt;-->
<!-- &lt;!&ndash; disabled>初始化中&ndash;&gt;--> <!-- &lt;!&ndash; disabled>初始化中&ndash;&gt;-->
<!-- &lt;!&ndash; </el-button>&ndash;&gt;--> <!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button&ndash;&gt;--> <!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- &lt;!&ndash; type="danger"&ndash;&gt;--> <!-- &lt;!&ndash; type="danger"&ndash;&gt;-->
<!-- &lt;!&ndash; v-if="testStatus=='test_init_fail'"&ndash;&gt;--> <!-- &lt;!&ndash; v-if="testStatus=='test_init_fail'"&ndash;&gt;-->
<!-- &lt;!&ndash; :icon="Failed"&ndash;&gt;--> <!-- &lt;!&ndash; :icon="Failed"&ndash;&gt;-->
<!-- &lt;!&ndash; disabled>初始化失败&ndash;&gt;--> <!-- &lt;!&ndash; disabled>初始化失败&ndash;&gt;-->
<!-- &lt;!&ndash; </el-button>&ndash;&gt;--> <!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button&ndash;&gt;--> <!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- &lt;!&ndash; type="danger"&ndash;&gt;--> <!-- &lt;!&ndash; type="danger"&ndash;&gt;-->
<!-- &lt;!&ndash; v-if="testStatus=='connect_timeout'"&ndash;&gt;--> <!-- &lt;!&ndash; v-if="testStatus=='connect_timeout'"&ndash;&gt;-->
<!-- &lt;!&ndash; :icon="Failed"&ndash;&gt;--> <!-- &lt;!&ndash; :icon="Failed"&ndash;&gt;-->
<!-- &lt;!&ndash; disabled>连接超时&ndash;&gt;--> <!-- &lt;!&ndash; disabled>连接超时&ndash;&gt;-->
<!-- &lt;!&ndash; </el-button>&ndash;&gt;--> <!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button&ndash;&gt;--> <!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- &lt;!&ndash; type="primary"&ndash;&gt;--> <!-- &lt;!&ndash; type="primary"&ndash;&gt;-->
<!-- &lt;!&ndash; :icon="RefreshLeft"&ndash;&gt;--> <!-- &lt;!&ndash; :icon="RefreshLeft"&ndash;&gt;-->
<!-- &lt;!&ndash; v-if="testStatus === 'recheck'"&ndash;&gt;--> <!-- &lt;!&ndash; v-if="testStatus === 'recheck'"&ndash;&gt;-->
<!-- &lt;!&ndash; @click="emit('sendReCheck')">重新检测&ndash;&gt;--> <!-- &lt;!&ndash; @click="emit('sendReCheck')">重新检测&ndash;&gt;-->
<!-- &lt;!&ndash; </el-button>&ndash;&gt;--> <!-- &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>
@@ -145,7 +145,7 @@
</div> </div>
<div class="drawer-container"> <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;"> <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"
@@ -156,15 +156,15 @@
</el-drawer> </el-drawer>
</div> </div>
<!-- <resultPopup--> <!-- <resultPopup-->
<!-- :visible="resultDialogVisible"--> <!-- :visible="resultDialogVisible"-->
<!-- @update:visible="resultDialogVisible = $event"--> <!-- @update:visible="resultDialogVisible = $event"-->
<!-- ></resultPopup>--> <!-- ></resultPopup>-->
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/> <dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
</div> </div>
</template> </template>
<script lang="tsx" setup name="test"> <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 dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
import {computed, reactive, ref, toRef, watch} from "vue"; import {computed, reactive, ref, toRef, watch} from "vue";
import {dialogBig} from "@/utils/elementBind"; 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) const drawer = ref(false)
@@ -456,7 +456,18 @@ watch(webMsgSend, function (newValue, oldValue) {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', 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') emit('update:testStatus', 'test_init_fail')
count++ count++
} }
@@ -563,7 +574,7 @@ watch(webMsgSend, function (newValue, oldValue) {
log: `${new Date().toLocaleString()}脚本与icd校验失败icd名称${data['icdType']} -> 校验项:${data['dataType']}` log: `${new Date().toLocaleString()}脚本与icd校验失败icd名称${data['icdType']} -> 校验项:${data['dataType']}`
}) })
emit('update:testStatus', 'test_init_fail') emit('update:testStatus', 'test_init_fail')
}else if(newValue.code == 10500) { } else if (newValue.code == 10500) {
ElMessageBox.alert(`装置中未找到该icd`, '初始化失败', { ElMessageBox.alert(`装置中未找到该icd`, '初始化失败', {
confirmButtonText: '确定', confirmButtonText: '确定',
type: 'error', type: 'error',
@@ -682,9 +693,9 @@ const handleStartItem = (code: string, desc: string | undefined) => {
updateCheckResultView(code, true) updateCheckResultView(code, true)
updateLog(true) updateLog(true)
} else { } else {
if (desc.length > 150) { // if (desc.length > 150) {
desc = desc.substring(0, 150) + '...' // desc = desc.substring(0, 150) + '...'
} // }
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}准确度检测:开始`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}准确度检测:开始`})
} }
} }
@@ -700,9 +711,9 @@ const handleEndItem = (code: string, desc: string | undefined, devices: CheckDat
} }
} else { } else {
let result = getResult(devices) let result = getResult(devices)
if (desc.length > 150) { // if (desc.length > 150) {
desc = desc.substring(0, 150) + '...' // desc = desc.substring(0, 150) + '...'
} // }
if (result === 1) { if (result === 1) {
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}检测结束:符合`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}${desc}检测结束:符合`})
} }
@@ -726,20 +737,22 @@ const updatePercentage = async () => {
let {data: autoGenerate} = await getAutoGenerate() let {data: autoGenerate} = await getAutoGenerate()
if (autoGenerate == 1) { if (autoGenerate == 1) {
//调用自动生成报告接口 //调用自动生成报告接口
let devIdList=checkStore.devices.map(item => { let devIdList = checkStore.devices.map(item => {
return item.deviceId return item.deviceId
}) })
await generateDevReport({ await generateDevReport({
'planId': checkStore.plan.id, 'planId': checkStore.plan.id,
'devIdList':devIdList, 'devIdList': devIdList,
'scriptId':checkStore.plan.scriptId, 'scriptId': checkStore.plan.scriptId,
'planCode':checkStore.plan.code+'' 'planCode': checkStore.plan.code + ''
}) })
} }
ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', { ElMessageBox.alert('检测全部结束,你可以停留在此页面查看检测结果,或返回首页进行复检、报告生成和归档等操作', '检测完成', {
confirmButtonText: '确定', confirmButtonText: '确定',
}) })
// 关闭WebSocket连接
emit('closeWebSocket')
//clear(); //clear();
} }
} }
@@ -773,7 +786,7 @@ const showTestLog = () => {
// 初始化检测脚本数据 // 初始化检测脚本数据
const initScriptData = async () => { const initScriptData = async () => {
let response: any = await getBigTestItem({reCheckType:checkStore.reCheckType, planId:checkStore.plan.id,devIds:checkStore.devices.map(item => item.deviceId)}) let response: any = await getBigTestItem({reCheckType: checkStore.reCheckType, planId: checkStore.plan.id, devIds: checkStore.devices.map(item => item.deviceId)})
let temp = response.data.map(item => { let temp = response.data.map(item => {
return { return {
@@ -1566,6 +1579,7 @@ defineExpose({
: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

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