2024-11-18 22:04:59 +08:00
|
|
|
|
<template>
|
2025-02-25 14:52:06 +08:00
|
|
|
|
<el-dialog :title="dialogTitle" width="1550px" :model-value="dialogVisible" :before-close="beforeClose" @close="handleClose" height="1000px" draggable>
|
2025-01-07 19:47:38 +08:00
|
|
|
|
|
|
|
|
|
|
<div class="steps-container">
|
2025-02-25 10:17:33 +08:00
|
|
|
|
<el-steps class="test-head-steps" simple :active="stepsActiveIndex-1" process-status="finish" finish-status="success">
|
|
|
|
|
|
<el-step v-if="preTestSelected" title="预检测" :icon="stepsActive === 1? SuccessFilled :Edit" @click="handleStepClick(1)"/>
|
|
|
|
|
|
<el-step v-if="timeTestSelected" title="守时检测" :icon="stepsActive === 2? SuccessFilled :UploadFilled" @click="handleStepClick(2)"/>
|
|
|
|
|
|
<el-step v-if="channelsTestSelected" title="系数校准" :icon="stepsActive === 3? SuccessFilled :Odometer" @click="handleStepClick(3)"/>
|
|
|
|
|
|
<el-step v-if="testSelected" title="正式检测" :icon="stepsActive === 4? SuccessFilled :Coin" @click="handleStepClick(4)"/>
|
|
|
|
|
|
<el-step title="检测完成" :icon="stepsActiveIndex > stepsTotalNum ? SuccessFilled :Key"/>
|
2025-01-07 19:47:38 +08:00
|
|
|
|
</el-steps>
|
|
|
|
|
|
</div>
|
2025-02-25 10:17:33 +08:00
|
|
|
|
|
|
|
|
|
|
<preTest v-if="showComponent" v-show="preTestSelected && stepsActiveView==1" ref="preTestRef" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"/>
|
|
|
|
|
|
<timeTest v-if="showComponent" v-show="timeTestSelected && stepsActiveView==2" v-model:testStatus="timeTestStatus"/>
|
|
|
|
|
|
<!-- <channelsTest v-if="stepsActiveIndex === 3" v-model:testStatus="channelsTestStatus"></channelsTest>-->
|
|
|
|
|
|
<factorTest v-if="showComponent" v-show="channelsTestSelected && stepsActiveView==3" v-model:testStatus="channelsTestStatus"/>
|
|
|
|
|
|
<test v-if="showComponent" v-show="testSelected && stepsActiveView==4" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend"
|
|
|
|
|
|
@update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck"/>
|
2025-01-07 19:47:38 +08:00
|
|
|
|
|
|
|
|
|
|
<template #footer>
|
|
|
|
|
|
<div>
|
2025-02-25 15:03:45 +08:00
|
|
|
|
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < stepsTotalNum && ActiveStatue != 'success'" @click="nextStep">跳过</el-button>
|
2025-02-25 13:46:01 +08:00
|
|
|
|
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
|
|
|
|
|
|
<el-button type="primary"
|
2025-02-26 10:54:43 +08:00
|
|
|
|
v-if="(stepsActive != stepsTotalNum-1) && (ActiveStatue !== 'test_init' && ActiveStatue !=='paused_ing' && ActiveStatue !=='paused' && ActiveStatue !== 'waiting' && ActiveStatue !== 'error' && ActiveStatue !== 'test_init_fail' && ActiveStatue !== 'connect_timeout' && ActiveStatue!=='pause_timeout')"
|
2025-02-25 13:46:01 +08:00
|
|
|
|
disabled>
|
2025-01-07 19:47:38 +08:00
|
|
|
|
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
|
|
|
|
|
<component :is="Refresh"/>
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
检测中
|
|
|
|
|
|
</el-button>
|
2025-02-25 13:46:01 +08:00
|
|
|
|
<!-- <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>-->
|
2025-01-14 21:07:52 +08:00
|
|
|
|
<el-button type="warning" :icon="VideoPlay" v-if="TestStatus === 'paused'" @click="handleSubmit">继续检测</el-button>
|
2025-02-26 10:42:01 +08:00
|
|
|
|
<!-- <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>-->
|
2025-01-14 21:07:52 +08:00
|
|
|
|
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
|
2025-01-07 19:47:38 +08:00
|
|
|
|
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
|
|
|
|
|
<component :is="Refresh"/>
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
初始化中
|
|
|
|
|
|
</el-button>
|
2025-01-14 21:07:52 +08:00
|
|
|
|
<el-button type="warning" v-if="TestStatus === 'paused_ing'" disabled>
|
2025-01-14 18:58:13 +08:00
|
|
|
|
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
|
|
|
|
|
<component :is="Refresh"/>
|
|
|
|
|
|
</el-icon>
|
|
|
|
|
|
暂停中
|
|
|
|
|
|
</el-button>
|
2025-01-07 19:47:38 +08:00
|
|
|
|
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
|
2025-02-25 13:46:01 +08:00
|
|
|
|
v-if="nextStepText!== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')"
|
2025-01-09 14:45:43 +08:00
|
|
|
|
@click="nextStep">
|
2025-01-07 19:47:38 +08:00
|
|
|
|
{{ nextStepText }}
|
|
|
|
|
|
</el-button>
|
2024-11-21 23:02:43 +08:00
|
|
|
|
</div>
|
2025-01-07 19:47:38 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</el-dialog>
|
2024-11-18 22:04:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</template>
|
2025-01-07 19:47:38 +08:00
|
|
|
|
|
|
|
|
|
|
<script lang="tsx" setup name="testPopup">
|
2025-02-25 10:17:33 +08:00
|
|
|
|
import {reactive, ref, watch} from 'vue';
|
2025-01-07 19:47:38 +08:00
|
|
|
|
import {ElMessage, ElMessageBox} from 'element-plus'
|
2025-02-26 10:42:01 +08:00
|
|
|
|
import {Coin, DArrowRight, Edit, Key, Odometer, Refresh, Right, SuccessFilled, UploadFilled, VideoPlay} from '@element-plus/icons-vue'
|
2025-01-07 19:47:38 +08:00
|
|
|
|
import preTest from './preTest.vue'
|
|
|
|
|
|
import timeTest from './timeTest.vue'
|
2025-02-25 10:17:33 +08:00
|
|
|
|
import factorTest from './factorTest.vue'
|
|
|
|
|
|
import test from './test.vue'
|
2025-01-07 19:47:38 +08:00
|
|
|
|
import socketClient from '@/utils/webSocketClient';
|
|
|
|
|
|
import {useCheckStore} from "@/stores/modules/check";
|
2025-02-25 13:47:33 +08:00
|
|
|
|
import {pauseTest, resumeTest, startPreTest} from '@/api/socket/socket'
|
2025-02-25 10:17:33 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
const checkStore = useCheckStore();
|
|
|
|
|
|
const nextStepText = ref('下一步');
|
|
|
|
|
|
const dialogVisible = ref(false)
|
2025-02-25 10:17:33 +08:00
|
|
|
|
|
|
|
|
|
|
const stepsTotalNum = ref(-1);//步骤总数
|
|
|
|
|
|
const stepsActiveIndex = ref(1); //当前正在执行的步骤索引
|
|
|
|
|
|
const stepsActiveView = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,仅用于页面显示
|
2025-02-25 13:46:01 +08:00
|
|
|
|
const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态,用于切换步骤
|
2025-01-07 19:47:38 +08:00
|
|
|
|
const ActiveStatue = ref('waiting');//当前步骤状态
|
|
|
|
|
|
const preTestStatus = ref('waiting');//预检测执行状态
|
|
|
|
|
|
const timeTestStatus = ref('waiting');//守时校验执行状态
|
|
|
|
|
|
const channelsTestStatus = ref('waiting');//通道系数校准执行状态
|
|
|
|
|
|
const TestStatus = ref('waiting');//正式检测执行状态
|
|
|
|
|
|
const webMsgSend = ref();//webSocket推送的数据
|
2024-12-20 16:32:03 +08:00
|
|
|
|
|
2025-02-25 10:17:33 +08:00
|
|
|
|
const dialogTitle = ref('')
|
|
|
|
|
|
const showComponent = ref(true)
|
|
|
|
|
|
const preTestRef = ref(null)
|
2024-12-27 14:29:21 +08:00
|
|
|
|
|
2025-01-16 15:57:29 +08:00
|
|
|
|
const dataSocket = reactive({
|
|
|
|
|
|
socketServe: socketClient.Instance,
|
|
|
|
|
|
});
|
2024-12-23 15:08:14 +08:00
|
|
|
|
|
2025-02-25 10:17:33 +08:00
|
|
|
|
// 勾选的检测内容
|
|
|
|
|
|
const preTestSelected = ref(false)
|
|
|
|
|
|
const timeTestSelected = ref(false)
|
|
|
|
|
|
const channelsTestSelected = ref(false)
|
|
|
|
|
|
const testSelected = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
const initOperate = () => {
|
2025-02-25 13:46:01 +08:00
|
|
|
|
ActiveStatue.value = 'waiting'
|
|
|
|
|
|
preTestStatus.value = 'waiting'
|
|
|
|
|
|
timeTestStatus.value = 'waiting'
|
|
|
|
|
|
channelsTestStatus.value = 'waiting'
|
|
|
|
|
|
TestStatus.value = 'waiting'
|
|
|
|
|
|
|
2025-02-25 10:17:33 +08:00
|
|
|
|
showComponent.value = true
|
|
|
|
|
|
// 初始化勾选的检测内容
|
|
|
|
|
|
preTestSelected.value = checkStore.selectTestItems.preTest
|
|
|
|
|
|
timeTestSelected.value = checkStore.selectTestItems.timeTest
|
|
|
|
|
|
channelsTestSelected.value = checkStore.selectTestItems.channelsTest
|
|
|
|
|
|
testSelected.value = checkStore.selectTestItems.test
|
|
|
|
|
|
|
|
|
|
|
|
let count = 0
|
|
|
|
|
|
for (let key in checkStore.selectTestItems) {
|
|
|
|
|
|
if (checkStore.selectTestItems[key]) {
|
|
|
|
|
|
count++
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
stepsTotalNum.value = count + 1
|
2024-12-23 14:05:53 +08:00
|
|
|
|
|
2025-02-25 10:17:33 +08:00
|
|
|
|
if (preTestSelected.value) {
|
|
|
|
|
|
stepsActiveView.value = 1
|
|
|
|
|
|
stepsActive.value = 1
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
if (timeTestSelected.value) {
|
|
|
|
|
|
stepsActiveView.value = 2
|
|
|
|
|
|
stepsActive.value = 2
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
if (channelsTestSelected.value) {
|
|
|
|
|
|
stepsActiveView.value = 3
|
|
|
|
|
|
stepsActive.value = 3
|
2025-01-07 19:47:38 +08:00
|
|
|
|
return
|
|
|
|
|
|
}
|
2025-02-25 10:17:33 +08:00
|
|
|
|
if (testSelected.value) {
|
|
|
|
|
|
stepsActiveView.value = 4
|
|
|
|
|
|
stepsActive.value = 4
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-25 13:46:01 +08:00
|
|
|
|
const open = (title: string) => {
|
2025-02-25 10:17:33 +08:00
|
|
|
|
initOperate()
|
2025-01-07 19:47:38 +08:00
|
|
|
|
dialogTitle.value = title;
|
|
|
|
|
|
dialogVisible.value = true;
|
2024-12-23 21:02:00 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
if (preTestRef.value) {
|
|
|
|
|
|
preTestRef.value.initializeParameters();
|
|
|
|
|
|
}
|
2024-12-23 21:02:00 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
//开始创建webSocket客户端
|
2025-01-17 09:14:19 +08:00
|
|
|
|
socketClient.Instance.connect();
|
2025-01-16 15:57:29 +08:00
|
|
|
|
dataSocket.socketServe = socketClient.Instance;
|
|
|
|
|
|
dataSocket.socketServe.registerCallBack('aaa', (res) => {
|
2025-01-07 19:47:38 +08:00
|
|
|
|
// 处理来自服务器的消息
|
|
|
|
|
|
// console.log('Received message:', res);
|
|
|
|
|
|
// 根据需要在这里添加更多的处理逻辑
|
|
|
|
|
|
if (res.code === 20000) {
|
2025-02-25 10:17:33 +08:00
|
|
|
|
//ElMessage.error(message.message)
|
|
|
|
|
|
// loading.close()
|
2025-01-07 19:47:38 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
webMsgSend.value = res
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2024-12-30 14:41:34 +08:00
|
|
|
|
|
2025-02-25 10:17:33 +08:00
|
|
|
|
// let loading;
|
2025-01-07 19:47:38 +08:00
|
|
|
|
const handleSubmit = () => {
|
|
|
|
|
|
let deviceIds = checkStore.devices.map((item) => item.deviceId)
|
2025-02-25 10:17:33 +08:00
|
|
|
|
let planId = checkStore.plan.id
|
2024-11-18 22:04:59 +08:00
|
|
|
|
|
2025-02-25 10:17:33 +08:00
|
|
|
|
if (!dataSocket.socketServe.connected) {
|
2025-01-17 09:14:19 +08:00
|
|
|
|
ElMessage.error('webSocket连接中断!')
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
2025-02-25 10:17:33 +08:00
|
|
|
|
switch (stepsActive.value) {
|
|
|
|
|
|
case 1:
|
2025-01-07 19:47:38 +08:00
|
|
|
|
startPreTest({
|
|
|
|
|
|
userPageId: "cdf",
|
|
|
|
|
|
devIds: deviceIds,
|
|
|
|
|
|
planId: planId,
|
2025-01-08 15:15:25 +08:00
|
|
|
|
operateType: '1' // '1'为预检测、‘2‘为正式检测
|
2025-01-07 19:47:38 +08:00
|
|
|
|
}).then(res => {
|
2025-01-10 11:03:29 +08:00
|
|
|
|
if (res.code === 'A001014') {
|
|
|
|
|
|
ElMessageBox.alert('装置配置异常', '检测失败', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
})
|
2025-02-25 10:29:29 +08:00
|
|
|
|
preTestStatus.value = 'error'
|
2025-01-10 11:03:29 +08:00
|
|
|
|
}
|
2025-01-07 19:47:38 +08:00
|
|
|
|
})
|
2025-01-10 13:49:09 +08:00
|
|
|
|
preTestStatus.value = 'start'
|
2025-01-07 19:47:38 +08:00
|
|
|
|
break;
|
2025-02-25 10:17:33 +08:00
|
|
|
|
case 2:
|
2025-01-07 19:47:38 +08:00
|
|
|
|
timeTestStatus.value = 'start'
|
|
|
|
|
|
break;
|
2025-02-25 10:17:33 +08:00
|
|
|
|
case 3:
|
2025-02-25 14:52:06 +08:00
|
|
|
|
// 调用系数校准组件的handleSubmit方法
|
2025-02-25 10:17:33 +08:00
|
|
|
|
channelsTestStatus.value = 'start'
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 4:
|
2025-01-07 19:47:38 +08:00
|
|
|
|
if (TestStatus.value == "waiting") {
|
2025-02-25 14:13:59 +08:00
|
|
|
|
startPreTest({
|
|
|
|
|
|
userPageId: "cdf",
|
|
|
|
|
|
devIds: deviceIds,
|
|
|
|
|
|
planId: planId,
|
|
|
|
|
|
operateType: '2' // '1'为预检测、‘2‘为正式检测
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
if (res.code === 'A001014') {
|
|
|
|
|
|
ElMessageBox.alert('装置配置异常', '初始化失败', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
})
|
|
|
|
|
|
TestStatus.value = 'test_init_fail'
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2025-01-10 13:49:09 +08:00
|
|
|
|
TestStatus.value = 'start'
|
|
|
|
|
|
} else if (TestStatus.value == 'paused') {
|
2025-01-07 19:47:38 +08:00
|
|
|
|
// 发送继续指令
|
|
|
|
|
|
sendResume()
|
|
|
|
|
|
}
|
2025-02-26 10:42:01 +08:00
|
|
|
|
// else if (TestStatus.value == 'recheck') {
|
2025-02-26 10:00:44 +08:00
|
|
|
|
// // 发送重新检测指令
|
|
|
|
|
|
// sendReCheck()
|
|
|
|
|
|
// }
|
2025-02-25 14:13:59 +08:00
|
|
|
|
// else if (TestStatus.value == 'success') {
|
2025-02-25 13:46:01 +08:00
|
|
|
|
// handleClose()
|
|
|
|
|
|
// }
|
2025-01-07 19:47:38 +08:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2024-12-20 16:32:03 +08:00
|
|
|
|
|
2025-02-26 10:52:39 +08:00
|
|
|
|
|
2025-01-13 21:06:24 +08:00
|
|
|
|
const emit = defineEmits<{
|
|
|
|
|
|
(e: 'quitClicked'): void;
|
|
|
|
|
|
}>();
|
|
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
watch(preTestStatus, function (newValue, oldValue) {
|
|
|
|
|
|
console.log(newValue, oldValue);
|
2024-12-20 16:32:03 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
ActiveStatue.value = newValue
|
|
|
|
|
|
})
|
|
|
|
|
|
watch(timeTestStatus, function (newValue, oldValue) {
|
|
|
|
|
|
console.log(newValue, oldValue);
|
2024-11-18 22:04:59 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
ActiveStatue.value = newValue
|
|
|
|
|
|
})
|
|
|
|
|
|
watch(channelsTestStatus, function (newValue, oldValue) {
|
|
|
|
|
|
console.log(newValue, oldValue);
|
2024-11-18 22:04:59 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
ActiveStatue.value = newValue
|
|
|
|
|
|
})
|
|
|
|
|
|
watch(TestStatus, function (newValue, oldValue) {
|
|
|
|
|
|
console.log(newValue, oldValue);
|
2024-11-18 22:04:59 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
ActiveStatue.value = newValue
|
|
|
|
|
|
})
|
2024-11-18 22:04:59 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
watch(ActiveStatue, function (newValue, oldValue) {
|
2025-02-26 10:52:39 +08:00
|
|
|
|
if (newValue === 'error') {
|
2025-02-25 13:46:01 +08:00
|
|
|
|
// stepsActiveIndex.value = stepsTotalNum.value + 2
|
2025-02-25 10:17:33 +08:00
|
|
|
|
nextStepText.value = '检测失败'
|
2025-01-07 19:47:38 +08:00
|
|
|
|
}
|
2025-02-26 10:42:01 +08:00
|
|
|
|
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 1) {
|
2025-02-25 10:17:33 +08:00
|
|
|
|
stepsActiveIndex.value += 2
|
2025-01-07 19:47:38 +08:00
|
|
|
|
nextStepText.value = '检测完成'
|
|
|
|
|
|
}
|
2025-02-26 10:52:39 +08:00
|
|
|
|
if (newValue === 'test_init_fail' ) {
|
2025-02-25 10:17:33 +08:00
|
|
|
|
stepsActiveIndex.value += 2
|
2025-01-07 19:47:38 +08:00
|
|
|
|
nextStepText.value = '初始化失败'
|
|
|
|
|
|
}
|
2025-02-26 10:52:39 +08:00
|
|
|
|
if (newValue === 'connect_timeout' ) {
|
2025-02-25 10:17:33 +08:00
|
|
|
|
stepsActiveIndex.value += 2
|
2025-01-07 19:47:38 +08:00
|
|
|
|
nextStepText.value = '连接超时'
|
|
|
|
|
|
}
|
2025-02-26 10:52:39 +08:00
|
|
|
|
if (newValue === 'pause_timeout' ) {
|
2025-02-25 10:17:33 +08:00
|
|
|
|
stepsActiveIndex.value += 2
|
2025-02-26 10:00:44 +08:00
|
|
|
|
// nextStepText.value = '结束测试'
|
|
|
|
|
|
nextStepText.value = '暂停超时'
|
2025-01-16 08:51:47 +08:00
|
|
|
|
}
|
2025-02-26 11:13:28 +08:00
|
|
|
|
if (newValue === 'success' && stepsActiveIndex.value < stepsTotalNum.value - 1) {
|
2025-02-25 14:13:59 +08:00
|
|
|
|
nextStep() // 实现自动点击,进入下一个测试内容
|
2025-02-25 13:46:01 +08:00
|
|
|
|
handleSubmit()
|
|
|
|
|
|
}
|
2025-01-07 19:47:38 +08:00
|
|
|
|
})
|
2024-11-21 23:02:43 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
const sendPause = () => {
|
2025-01-09 16:27:05 +08:00
|
|
|
|
console.log('发起暂停请求')
|
2024-12-30 14:41:34 +08:00
|
|
|
|
|
2025-01-14 21:07:52 +08:00
|
|
|
|
TestStatus.value = 'paused_ing'
|
2025-02-25 14:13:59 +08:00
|
|
|
|
pauseTest().then(res => {
|
2025-02-25 10:17:33 +08:00
|
|
|
|
Object.assign(webMsgSend.value, {
|
|
|
|
|
|
requestId: 'preStopTest',
|
|
|
|
|
|
operateCode: 'stop'
|
|
|
|
|
|
})
|
2025-02-25 14:13:59 +08:00
|
|
|
|
})
|
|
|
|
|
|
// setTimeout(() => {
|
|
|
|
|
|
// Object.assign(webMsgSend.value, {
|
|
|
|
|
|
// requestId: 'preStopTest',
|
|
|
|
|
|
// operateCode: 'stop'
|
|
|
|
|
|
// })
|
|
|
|
|
|
// }, 5000)
|
2025-01-07 19:47:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
const sendResume = () => {
|
2025-01-09 16:27:05 +08:00
|
|
|
|
console.log('发起继续检测请求')
|
|
|
|
|
|
|
2025-02-25 13:47:33 +08:00
|
|
|
|
resumeTest({
|
|
|
|
|
|
userPageId: "cdf",
|
|
|
|
|
|
devIds: checkStore.devices.map((item) => item.deviceId),
|
|
|
|
|
|
planId: checkStore.plan.id,
|
2025-02-25 15:11:23 +08:00
|
|
|
|
operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测
|
2025-02-25 14:52:06 +08:00
|
|
|
|
})
|
|
|
|
|
|
Object.assign(webMsgSend.value, {
|
|
|
|
|
|
requestId: 'Resume_Success'
|
2025-02-25 13:47:33 +08:00
|
|
|
|
})
|
2025-01-07 19:47:38 +08:00
|
|
|
|
}
|
2024-12-30 14:41:34 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
const sendReCheck = () => {
|
|
|
|
|
|
console.log('发送重新检测指令')
|
2025-02-25 13:48:44 +08:00
|
|
|
|
startPreTest({
|
|
|
|
|
|
userPageId: "cdf",
|
|
|
|
|
|
devIds: checkStore.devices.map((item) => item.deviceId),
|
|
|
|
|
|
planId: checkStore.plan.id,
|
|
|
|
|
|
operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
console.log(res)
|
|
|
|
|
|
if (res.code === 'A001014') {
|
|
|
|
|
|
ElMessageBox.alert('装置配置异常', '初始化失败', {
|
|
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
})
|
|
|
|
|
|
TestStatus.value = 'test_init_fail'
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
2025-01-10 13:49:09 +08:00
|
|
|
|
TestStatus.value = 'start'
|
2025-01-07 19:47:38 +08:00
|
|
|
|
}
|
2025-01-04 10:49:05 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
const nextStep = () => {
|
2025-02-26 10:42:01 +08:00
|
|
|
|
if (stepsActiveIndex.value == stepsTotalNum.value + 1 || ActiveStatue.value === 'error' || ActiveStatue.value === 'test_init_fail' || ActiveStatue.value === 'connect_timeout' || ActiveStatue.value === 'pause_timeout') {
|
2025-02-25 10:17:33 +08:00
|
|
|
|
handleClose()
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
if (ActiveStatue.value != 'error') {
|
|
|
|
|
|
ActiveStatue.value = 'waiting'
|
|
|
|
|
|
let tempStep = stepsActiveIndex.value
|
|
|
|
|
|
let idx = 1
|
2025-01-07 19:47:38 +08:00
|
|
|
|
stepsActiveIndex.value++
|
2025-02-25 10:17:33 +08:00
|
|
|
|
for (let selectTestItemsKey in checkStore.selectTestItems) {
|
|
|
|
|
|
if (tempStep == 0 && checkStore.selectTestItems[selectTestItemsKey]) {
|
|
|
|
|
|
stepsActiveView.value = idx
|
|
|
|
|
|
stepsActive.value = idx
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
if (checkStore.selectTestItems[selectTestItemsKey] && tempStep != 0) {
|
|
|
|
|
|
tempStep--
|
|
|
|
|
|
}
|
|
|
|
|
|
idx++
|
2024-11-18 22:04:59 +08:00
|
|
|
|
}
|
2025-02-25 10:17:33 +08:00
|
|
|
|
}
|
2025-01-07 19:47:38 +08:00
|
|
|
|
|
2025-02-25 10:17:33 +08:00
|
|
|
|
// if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
|
|
|
|
|
// stepsActiveIndex.value++
|
|
|
|
|
|
// if (!checkStore.selectTestItems.timeTest) { // 不具备守时检测
|
|
|
|
|
|
// stepsActiveIndex.value++
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// ActiveStatue.value = 'waiting'
|
|
|
|
|
|
// } else if (stepsActiveIndex.value === stepsTotalNum.value || ActiveStatue.value === 'error') {
|
|
|
|
|
|
// //emit('update:visible', false); // 关闭对话框
|
|
|
|
|
|
// clearData()
|
|
|
|
|
|
// dialogVisible.value = false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const handleStepClick = (step: number) => {
|
|
|
|
|
|
if (step > stepsActive.value) {
|
|
|
|
|
|
return
|
|
|
|
|
|
} else {
|
|
|
|
|
|
stepsActiveView.value = step
|
2024-11-18 22:04:59 +08:00
|
|
|
|
}
|
2025-02-25 10:17:33 +08:00
|
|
|
|
}
|
2025-01-07 19:47:38 +08:00
|
|
|
|
|
|
|
|
|
|
function clearData() {
|
2025-02-25 10:17:33 +08:00
|
|
|
|
stepsTotalNum.value = -1
|
|
|
|
|
|
stepsActiveIndex.value = 1
|
|
|
|
|
|
stepsActiveView.value = -1
|
2025-01-07 19:47:38 +08:00
|
|
|
|
preTestStatus.value = "waiting"
|
|
|
|
|
|
timeTestStatus.value = "waiting"
|
|
|
|
|
|
channelsTestStatus.value = "waiting"
|
|
|
|
|
|
TestStatus.value = "waiting"
|
|
|
|
|
|
ActiveStatue.value = "waiting"
|
|
|
|
|
|
nextStepText.value = "下一步"
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const beforeClose = (done: () => void) => {
|
2025-02-25 13:46:01 +08:00
|
|
|
|
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
2025-02-25 10:17:33 +08:00
|
|
|
|
ElMessageBox.confirm('检测未完成,是否退出当前检测流程?', '提示', {
|
2025-01-07 19:47:38 +08:00
|
|
|
|
confirmButtonText: '确定',
|
|
|
|
|
|
cancelButtonText: '取消',
|
|
|
|
|
|
type: 'warning',
|
|
|
|
|
|
}
|
2025-02-25 10:17:33 +08:00
|
|
|
|
).then(() => {
|
|
|
|
|
|
handleClose()
|
|
|
|
|
|
})
|
2025-01-07 19:47:38 +08:00
|
|
|
|
} else {
|
2025-02-25 10:17:33 +08:00
|
|
|
|
handleClose()
|
2025-01-07 19:47:38 +08:00
|
|
|
|
}
|
2024-11-29 13:45:48 +08:00
|
|
|
|
}
|
2025-02-25 10:17:33 +08:00
|
|
|
|
|
|
|
|
|
|
const handleClose = () => {
|
2025-01-16 15:57:29 +08:00
|
|
|
|
dataSocket.socketServe.closeWs()
|
2025-02-25 10:17:33 +08:00
|
|
|
|
dialogVisible.value = false;
|
|
|
|
|
|
clearData()
|
|
|
|
|
|
showComponent.value = false;
|
2025-01-16 15:57:29 +08:00
|
|
|
|
|
2025-01-13 21:06:24 +08:00
|
|
|
|
emit('quitClicked'); // 触发事件
|
2025-02-25 10:17:33 +08:00
|
|
|
|
}
|
2025-01-07 19:47:38 +08:00
|
|
|
|
|
|
|
|
|
|
// 对外映射
|
|
|
|
|
|
defineExpose({open})
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.dialog-big .el-dialog__body) {
|
|
|
|
|
|
max-height: 840px !important;
|
2024-11-22 10:46:10 +08:00
|
|
|
|
}
|
2025-01-07 19:47:38 +08:00
|
|
|
|
|
|
|
|
|
|
.steps-container :deep(.test-head-steps) {
|
|
|
|
|
|
height: 80px;
|
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
|
}
|
2024-11-20 11:22:05 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
.steps-container :deep(.el-step__title) {
|
2024-11-21 23:02:43 +08:00
|
|
|
|
font-size: 20px !important; /* 设置标题字体大小 */
|
2025-01-07 19:47:38 +08:00
|
|
|
|
vertical-align: baseline !important;
|
2024-11-25 21:11:10 +08:00
|
|
|
|
display: inline-block; /* 确保文字和图标在同一行 */
|
|
|
|
|
|
line-height: 1; /* 调整行高以确保底部对齐 */
|
2024-11-18 22:04:59 +08:00
|
|
|
|
}
|
2025-01-07 19:47:38 +08:00
|
|
|
|
|
|
|
|
|
|
.steps-container :deep(.el-step__icon-inner) {
|
|
|
|
|
|
font-size: 18px !important;
|
|
|
|
|
|
vertical-align: baseline !important;
|
|
|
|
|
|
display: inline-block; /* 确保文字和图标在同一行 */
|
2024-11-25 21:11:10 +08:00
|
|
|
|
line-height: 1; /* 调整行高以确保底部对齐 */
|
2025-01-07 19:47:38 +08:00
|
|
|
|
}
|
2024-11-18 22:04:59 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
.steps-container :deep(.el-step__icon) {
|
|
|
|
|
|
font-size: 18px !important;
|
|
|
|
|
|
vertical-align: baseline !important;
|
|
|
|
|
|
display: inline-block; /* 确保文字和图标在同一行 */
|
2024-11-25 21:11:10 +08:00
|
|
|
|
line-height: 1; /* 调整行高以确保底部对齐 */
|
|
|
|
|
|
}
|
2024-11-18 22:04:59 +08:00
|
|
|
|
|
2025-01-07 19:47:38 +08:00
|
|
|
|
.loading-box {
|
|
|
|
|
|
animation: loading 1.5s linear infinite;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes loading {
|
|
|
|
|
|
from {
|
|
|
|
|
|
transform: rotate(0deg);
|
|
|
|
|
|
}
|
|
|
|
|
|
to {
|
|
|
|
|
|
transform: rotate(360deg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-21 23:02:43 +08:00
|
|
|
|
// :deep(.test-head-steps){
|
|
|
|
|
|
// height: 100px;
|
|
|
|
|
|
// margin-bottom: 20px;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// .el-step__icon.is-text {
|
|
|
|
|
|
// border-radius: 50%;
|
|
|
|
|
|
// border: 4px solid;
|
|
|
|
|
|
// width: 50px;
|
|
|
|
|
|
// height: 50px;
|
|
|
|
|
|
// border-color: inherit;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// .el-step__icon.is-icon {
|
|
|
|
|
|
// border-radius: 50%;
|
|
|
|
|
|
// border: 4px solid;
|
|
|
|
|
|
// width: 50px;
|
|
|
|
|
|
// height: 50px;
|
|
|
|
|
|
// border-color: inherit;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// .test-head-steps .el-step__line{
|
|
|
|
|
|
// height:50px !important;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// .test-head-steps .el-step__icon-inner{
|
|
|
|
|
|
// width: 40px !important;
|
|
|
|
|
|
// height:40px !important;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// .test-head-steps .el-step__icon{
|
|
|
|
|
|
// width: 48px !important;
|
|
|
|
|
|
// height:48px !important;
|
|
|
|
|
|
// font-size: 48px !important; /* 调整图标大小 */
|
|
|
|
|
|
// line-height: 80px !important; /* 使图标居中 */
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// :deep(.el-step__title) {
|
|
|
|
|
|
// font-size: 24px !important; /* 设置标题字体大小 */
|
|
|
|
|
|
// margin-top: 10px !important; /* 调整标题与图标的间距 */
|
|
|
|
|
|
// }
|
2025-01-07 19:47:38 +08:00
|
|
|
|
|
2024-11-21 23:02:43 +08:00
|
|
|
|
// :deep(.el-step__icon-inner) {
|
|
|
|
|
|
// font-size: 24px !important;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// .test-head-steps .el-step__description {
|
|
|
|
|
|
// font-size: 20px !important; /* 设置描述字体大小 */
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
2024-11-18 22:04:59 +08:00
|
|
|
|
</style>
|