This commit is contained in:
caozehui
2025-06-25 09:21:58 +08:00
parent 5363625a2f
commit 310a769092
3 changed files with 127 additions and 197 deletions

View File

@@ -97,10 +97,10 @@
<!-- <el-button type="primary" :icon="CirclePlus" @click="addDevice('设备新增')" v-if="form.activeTabs === 0"
>设备新增</el-button> -->
<el-button type='primary' v-auth.role="'channelsTest'" :icon='Odometer' @click="handleTest('系数校准')"
v-if='form.activeTabs === 0 && appSceneStore.currentScene === "1" '
>系数校准
</el-button>
<!-- <el-button type='primary' v-auth.role="'channelsTest'" :icon='Odometer' @click="handleTest('系数校准')"-->
<!-- v-if='form.activeTabs === 0 && appSceneStore.currentScene === "1" '-->
<!-- >系数校准-->
<!-- </el-button>-->
</el-form-item>
</el-form>
</template>

View File

@@ -12,64 +12,6 @@
style="width: 82%; margin-right: 3%;"
:percentage="percentage"
:color="customColors"/>
<!-- <div style="width: 15%">-->
<!-- <el-button type="primary" v-if="testStatus=='test_init'" disabled @click="handlePause()">-->
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
<!-- <component :is="Refresh"/>-->
<!-- </el-icon>-->
<!-- 初始化中-->
<!-- </el-button>-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- v-if="testStatus=='process' && percentage < 100"-->
<!-- :icon="VideoPause"-->
<!-- @click="handlePause()">停止检测-->
<!-- </el-button>-->
<!-- <el-button type="warning" v-if="testStatus === 'paused_ing' && percentage < 100" disabled>-->
<!-- <el-icon class="loading-box" style="margin-right: 8px;">-->
<!-- <component :is="Refresh"/>-->
<!-- </el-icon>-->
<!-- 暂停中-->
<!-- </el-button>-->
<!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- &lt;!&ndash; type="primary"&ndash;&gt;-->
<!-- &lt;!&ndash; v-if="testStatus=='test_init'"&ndash;&gt;-->
<!-- &lt;!&ndash; :icon="VideoPause"&ndash;&gt;-->
<!-- &lt;!&ndash; disabled>初始化中&ndash;&gt;-->
<!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- &lt;!&ndash; type="danger"&ndash;&gt;-->
<!-- &lt;!&ndash; v-if="testStatus=='test_init_fail'"&ndash;&gt;-->
<!-- &lt;!&ndash; :icon="Failed"&ndash;&gt;-->
<!-- &lt;!&ndash; disabled>初始化失败&ndash;&gt;-->
<!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- &lt;!&ndash; type="danger"&ndash;&gt;-->
<!-- &lt;!&ndash; v-if="testStatus=='connect_timeout'"&ndash;&gt;-->
<!-- &lt;!&ndash; :icon="Failed"&ndash;&gt;-->
<!-- &lt;!&ndash; disabled>连接超时&ndash;&gt;-->
<!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button&ndash;&gt;-->
<!-- &lt;!&ndash; type="primary"&ndash;&gt;-->
<!-- &lt;!&ndash; :icon="RefreshLeft"&ndash;&gt;-->
<!-- &lt;!&ndash; v-if="testStatus === 'recheck'"&ndash;&gt;-->
<!-- &lt;!&ndash; @click="emit('sendReCheck')">重新检测&ndash;&gt;-->
<!-- &lt;!&ndash; </el-button>&ndash;&gt;-->
<!-- <el-button type="success" v-if="percentage >= 100" :icon="Check" disabled>检测完成</el-button>-->
<!-- <el-button-->
<!-- type="warning"-->
<!-- v-if="(testStatus=='paused' || testStatus === 'pause_timeout') && percentage < 100"-->
<!-- :icon="VideoPlay"-->
<!-- :disabled="testStatus === 'pause_timeout'"-->
<!-- @click="emit('sendResume')"-->
<!-- >继续检测-->
<!-- </el-button>-->
<!-- </div>-->
<el-button style="width: 10%" type="text" :icon="InfoFilled" @click="showTestLog">检测项进度</el-button>
</div>
@@ -335,7 +277,7 @@ const checkResultView: ComputedRef<CheckData.ScriptChnViewItem[]> = computed(()
watch(testStatus, function (newValue, oldValue) {
if (newValue == 'start') {
if(!checkStore.selectTestItems.preTest && !checkStore.selectTestItems.channelsTest){
if (!checkStore.selectTestItems.preTest && !checkStore.selectTestItems.channelsTest) {
ElMessage.success('初始化开始!')
emit('update:testStatus', 'test_init')
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`})

View File

@@ -4,8 +4,10 @@
<div class="steps-container">
<el-steps class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success">
<el-step v-if="preTestSelected" title="预检测" :icon="stepsActive > 1 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Edit" @click="handleStepClick(1)"/>
<el-step v-if="timeTestSelected" title="守时检测" :icon="stepsActive > 2 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :UploadFilled" @click="handleStepClick(2)"/>
<el-step v-if="channelsTestSelected" title="系数校准" :icon="stepsActive > 3 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Odometer" @click="handleStepClick(3)"/>
<el-step v-if="timeTestSelected" title="守时检测" :icon="stepsActive > 2 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :UploadFilled"
@click="handleStepClick(2)"/>
<el-step v-if="channelsTestSelected" title="系数校准" :icon="stepsActive > 3 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Odometer"
@click="handleStepClick(3)"/>
<el-step v-if="testSelected" title="正式检测" :icon="stepsActive > 4 || stepsActiveIndex > stepsTotalNum-1? SuccessFilled :Coin" @click="handleStepClick(4)"/>
<el-step title="检测完成" :icon="stepsActiveIndex > stepsTotalNum-1 ? SuccessFilled :Key"/>
</el-steps>
@@ -15,33 +17,16 @@
:webMsgSend="webMsgSend"/>
<timeTest v-if="showComponent&&timeTestSelected" v-show="timeTestSelected && stepsActiveView==2" v-model:testStatus="timeTestStatus"/>
<!-- <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"
@update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck" @closeWebSocket="closeWebSocket" :stepsActive="stepsActive"/>
@update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck" @closeWebSocket="closeWebSocket"
:stepsActive="stepsActive"/>
<template #footer>
<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="handleSubmitFast">一键检测开始</el-button>
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
<!-- <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')"-->
<!-- disabled>-->
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
<!-- <component :is="Refresh"/>-->
<!-- </el-icon>-->
<!-- 检测中-->
<!-- </el-button>-->
<!-- <el-button type="primary" v-if="ActiveStatue === 'process'" disabled>-->
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
<!-- <component :is="Refresh"/>-->
<!-- </el-icon>-->
<!-- 检测中-->
<!-- </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" v-if="TestStatus === 'test_init'" disabled>
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
<component :is="Refresh"/>
@@ -95,7 +80,6 @@ import socketClient from '@/utils/webSocketClient';
import {useCheckStore} from "@/stores/modules/check";
import {pauseTest, resumeTest, startPreTest} from '@/api/socket/socket'
import {useUserStore} from "@/stores/modules/user";
import { Device } from '@/api/device/interface/device';
const userStore = useUserStore()
const checkStore = useCheckStore();
@@ -207,7 +191,7 @@ const handleSubmitFast = () => {
ElMessage.error('webSocket连接中断')
return
}
console.log("handleSubmit",stepsActive.value,TestStatus.value)
console.log("handleSubmit", stepsActive.value, TestStatus.value)
switch (stepsActive.value) {
case 1:
startPreTest({
@@ -215,9 +199,9 @@ const handleSubmitFast = () => {
devIds: deviceIds,
planId: planId,
operateType: '10', // '1'为预检测、2为正式检测、'8'为不合格项复检
userId:userStore.userInfo.id,
temperature:checkStore.temperature,
humidity:checkStore.humidity
userId: userStore.userInfo.id,
temperature: checkStore.temperature,
humidity: checkStore.humidity
}).then(res => {
if (res.code === 'A001014') {
ElMessageBox.alert('装置配置异常', '检测失败', {
@@ -241,24 +225,26 @@ const handleSubmitFast = () => {
break;
case 4:
if (TestStatus.value == "waiting") {
/* startPreTest({
userPageId: "cdf",
devIds: deviceIds,
planId: planId,
operateType: checkStore.reCheckType ==1 ?'2':'8', // '1'为预检测、2为正式检测、'8'为不合格项复检
userId:userStore.userInfo.id,
temperature:checkStore.temperature,
humidity:checkStore.humidity
}).then(res => {
console.log(res)
if (res.code === 'A001014') {
ElMessageBox.alert('装置配置异常', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
TestStatus.value = 'test_init_fail'
}
})*/
if (!checkStore.selectTestItems.preTest && !checkStore.selectTestItems.timeTest && !checkStore.selectTestItems.channelsTest && checkStore.selectTestItems.test) {
startPreTest({
userPageId: "cdf",
devIds: deviceIds,
planId: planId,
operateType: checkStore.reCheckType == 1 ? '2' : '8', // '1'为预检测、2为正式检测、'8'为不合格项复检
userId: userStore.userInfo.id,
temperature: checkStore.temperature,
humidity: checkStore.humidity
}).then(res => {
console.log(res)
if (res.code === 'A001014') {
ElMessageBox.alert('装置配置异常', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
TestStatus.value = 'test_init_fail'
}
})
}
TestStatus.value = 'start'
} else if (TestStatus.value == 'paused') {
// 发送继续指令
@@ -279,83 +265,83 @@ const handleSubmitFast = () => {
// let loading;
const handleSubmit = () => {
let deviceIds = checkStore.devices.map((item) => item.deviceId)
let planId = checkStore.plan.id
if (!dataSocket.socketServe.connected) {
ElMessage.error('webSocket连接中断')
return
}
console.log("handleSubmit",stepsActive.value,TestStatus.value)
switch (stepsActive.value) {
case 1:
startPreTest({
userPageId: "cdf",
devIds: deviceIds,
planId: planId,
operateType: '1', // '1'为预检测、2为正式检测、'8'为不合格项复检
userId:userStore.userInfo.id,
temperature:checkStore.temperature,
humidity:checkStore.humidity
}).then(res => {
if (res.code === 'A001014') {
ElMessageBox.alert('装置配置异常', '检测失败', {
confirmButtonText: '确定',
type: 'error',
})
preTestStatus.value = 'error'
}
})
preTestStatus.value = 'start'
// setTimeout(() => {
// preTestStatus.value = 'success'
// }, 5000)
break;
case 2:
timeTestStatus.value = 'start'
break;
case 3:
// 调用系数校准组件的handleSubmit方法
channelsTestStatus.value = 'start'
break;
case 4:
if (TestStatus.value == "waiting") {
startPreTest({
userPageId: "cdf",
devIds: deviceIds,
planId: planId,
operateType: checkStore.reCheckType ==1 ?'2':'8', // '1'为预检测、2为正式检测、'8'为不合格项复检
userId:userStore.userInfo.id,
temperature:checkStore.temperature,
humidity:checkStore.humidity
}).then(res => {
console.log(res)
if (res.code === 'A001014') {
ElMessageBox.alert('装置配置异常', '初始化失败', {
confirmButtonText: '确定',
type: 'error',
})
TestStatus.value = 'test_init_fail'
}
})
TestStatus.value = 'start'
} else if (TestStatus.value == 'paused') {
// 发送继续指令
sendResume()
}
// else if (TestStatus.value == 'recheck') {
// // 发送重新检测指令
// sendReCheck()
// }
// else if (TestStatus.value == 'success') {
// handleClose()
// }
break;
default:
break;
}
};
// const handleSubmit = () => {
// let deviceIds = checkStore.devices.map((item) => item.deviceId)
// let planId = checkStore.plan.id
//
// if (!dataSocket.socketServe.connected) {
// ElMessage.error('webSocket连接中断')
// return
// }
// console.log("handleSubmit", stepsActive.value, TestStatus.value)
// switch (stepsActive.value) {
// case 1:
// startPreTest({
// userPageId: "cdf",
// devIds: deviceIds,
// planId: planId,
// operateType: '1', // '1'为预检测、2为正式检测、'8'为不合格项复检
// userId: userStore.userInfo.id,
// temperature: checkStore.temperature,
// humidity: checkStore.humidity
// }).then(res => {
// if (res.code === 'A001014') {
// ElMessageBox.alert('装置配置异常', '检测失败', {
// confirmButtonText: '确定',
// type: 'error',
// })
// preTestStatus.value = 'error'
// }
// })
// preTestStatus.value = 'start'
// // setTimeout(() => {
// // preTestStatus.value = 'success'
// // }, 5000)
// break;
// case 2:
// timeTestStatus.value = 'start'
// break;
// case 3:
// // 调用系数校准组件的handleSubmit方法
// channelsTestStatus.value = 'start'
// break;
// case 4:
// if (TestStatus.value == "waiting") {
// startPreTest({
// userPageId: "cdf",
// devIds: deviceIds,
// planId: planId,
// operateType: checkStore.reCheckType == 1 ? '2' : '8', // '1'为预检测、2为正式检测、'8'为不合格项复检
// userId: userStore.userInfo.id,
// temperature: checkStore.temperature,
// humidity: checkStore.humidity
// }).then(res => {
// console.log(res)
// if (res.code === 'A001014') {
// ElMessageBox.alert('装置配置异常', '初始化失败', {
// confirmButtonText: '确定',
// type: 'error',
// })
// TestStatus.value = 'test_init_fail'
// }
// })
// TestStatus.value = 'start'
// } else if (TestStatus.value == 'paused') {
// // 发送继续指令
// sendResume()
// }
// // else if (TestStatus.value == 'recheck') {
// // // 发送重新检测指令
// // sendReCheck()
// // }
// // else if (TestStatus.value == 'success') {
// // handleClose()
// // }
// break;
// default:
// break;
// }
// };
const emit = defineEmits<{
@@ -414,16 +400,17 @@ watch(ActiveStatue, function (newValue, oldValue) {
})
const handleQuit = () => {
console.log('handleQuit',ActiveStatue.value)
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(() => {})
beforeClose(() => {
})
} else {
handleClose()
}
}
const handlePause=()=>{
const handlePause = () => {
sendPause()
testRef.value?.handlePause()
}
@@ -447,9 +434,9 @@ const sendResume = () => {
devIds: checkStore.devices.map((item) => item.deviceId),
planId: checkStore.plan.id,
operateType: '2', // 0:'系数校验''1'为预检测、2为正式检测、'8'为不合格项复检
userId:userStore.userInfo.id,
temperature:checkStore.temperature,
humidity:checkStore.humidity
userId: userStore.userInfo.id,
temperature: checkStore.temperature,
humidity: checkStore.humidity
})
Object.assign(webMsgSend.value, {
requestId: 'Resume_Success'
@@ -463,9 +450,9 @@ const sendReCheck = () => {
devIds: checkStore.devices.map((item) => item.deviceId),
planId: checkStore.plan.id,
operateType: '2', // 0:'系数校验''1'为预检测、2为正式检测、'8'为不合格项复检
userId:userStore.userInfo.id,
temperature:checkStore.temperature,
humidity:checkStore.humidity
userId: userStore.userInfo.id,
temperature: checkStore.temperature,
humidity: checkStore.humidity
}).then(res => {
console.log(res)
if (res.code === 'A001014') {
@@ -575,7 +562,8 @@ defineExpose({open})
.el-step__head.is-success {
color: #91cc75;
}
.el-step__title.is-success{
.el-step__title.is-success {
color: #91cc75;
}
}