跳过
- 开始检测
-
+ 开始检测
+
检测中
+
+
+
+
+
+
继续检测
重新检测
@@ -43,7 +51,7 @@
暂停中
{{ nextStepText }}
@@ -67,7 +75,6 @@ import socketClient from '@/utils/webSocketClient';
import {useCheckStore} from "@/stores/modules/check";
import {pauseTest, startPreTest} from '@/api/socket/socket'
-const btnState = ref(false)
const checkStore = useCheckStore();
const nextStepText = ref('下一步');
const dialogVisible = ref(false)
@@ -75,7 +82,7 @@ const dialogVisible = ref(false)
const stepsTotalNum = ref(-1);//步骤总数
const stepsActiveIndex = ref(1); //当前正在执行的步骤索引
const stepsActiveView = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,仅用于页面显示
-const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态
+const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态,用于切换步骤
const ActiveStatue = ref('waiting');//当前步骤状态
const preTestStatus = ref('waiting');//预检测执行状态
const timeTestStatus = ref('waiting');//守时校验执行状态
@@ -98,6 +105,12 @@ const channelsTestSelected = ref(false)
const testSelected = ref(false)
const initOperate = () => {
+ ActiveStatue.value = 'waiting'
+ preTestStatus.value = 'waiting'
+ timeTestStatus.value = 'waiting'
+ channelsTestStatus.value = 'waiting'
+ TestStatus.value = 'waiting'
+
showComponent.value = true
// 初始化勾选的检测内容
preTestSelected.value = checkStore.selectTestItems.preTest
@@ -135,25 +148,9 @@ const initOperate = () => {
}
}
-const open = (selection: Device.ResPqDev[], title: string) => {
+const open = (title: string) => {
initOperate()
- // const checkStates = selection.map(item => item.checkState);
- //
- // const allCheckStatesEqual = new Set(checkStates).size <= 1;
- //
- // debugger
- // if (!allCheckStatesEqual) {
- // ElMessageBox.confirm('所勾选设备检测状态不一致,请重新选择', '提示',
- // {
- // confirmButtonText: '确定',
- // cancelButtonText: '取消',
- // type: 'warning',
- // }
- // )
- // return
- // }
-
dialogTitle.value = title;
dialogVisible.value = true;
@@ -161,14 +158,7 @@ const open = (selection: Device.ResPqDev[], title: string) => {
preTestRef.value.initializeParameters();
}
- ActiveStatue.value = 'waiting'
- preTestStatus.value = 'waiting'
- timeTestStatus.value = 'waiting'
- channelsTestStatus.value = 'waiting'
- TestStatus.value = 'waiting'
-
//开始创建webSocket客户端
-
socketClient.Instance.connect();
dataSocket.socketServe = socketClient.Instance;
dataSocket.socketServe.registerCallBack('aaa', (res) => {
@@ -181,8 +171,6 @@ const open = (selection: Device.ResPqDev[], title: string) => {
} else {
webMsgSend.value = res
}
-
-
});
}
@@ -223,21 +211,21 @@ const handleSubmit = () => {
break;
case 4:
if (TestStatus.value == "waiting") {
- // 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'
- // }
- // })
+ 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'
+ }
+ })
TestStatus.value = 'start'
} else if (TestStatus.value == 'paused') {
// 发送继续指令
@@ -245,9 +233,10 @@ const handleSubmit = () => {
} else if (TestStatus.value == 'test_recheck') {
// 发送重新检测指令
sendReCheck()
- } else if (TestStatus.value == 'success') {
- handleClose()
}
+ // else if (TestStatus.value == 'success') {
+ // handleClose()
+ // }
break;
default:
break;
@@ -281,7 +270,7 @@ watch(TestStatus, function (newValue, oldValue) {
watch(ActiveStatue, function (newValue, oldValue) {
if (newValue === 'error' && stepsActive.value === 1) {
- stepsActiveIndex.value = stepsTotalNum.value + 2
+ // stepsActiveIndex.value = stepsTotalNum.value + 2
nextStepText.value = '检测失败'
}
if (newValue === 'success' && stepsActive.value === 4) {
@@ -300,6 +289,10 @@ watch(ActiveStatue, function (newValue, oldValue) {
stepsActiveIndex.value += 2
nextStepText.value = '结束测试'
}
+ if (newValue === 'success' && nextStepText.value === '下一步') {
+ nextStep()
+ handleSubmit()
+ }
})
const sendPause = () => {
@@ -410,7 +403,7 @@ function clearData() {
}
const beforeClose = (done: () => void) => {
- if (stepsActiveIndex.value < stepsTotalNum.value) {
+ if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
ElMessageBox.confirm('检测未完成,是否退出当前检测流程?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',