预见测代码
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key" />
|
||||
</el-steps>
|
||||
</div>
|
||||
<preTest v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus"></preTest>
|
||||
<preTest v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"></preTest>
|
||||
<timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest>
|
||||
<!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
|
||||
<test v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus"></test>
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
<script lang="tsx" setup name="testPopup">
|
||||
import { h } from 'vue';
|
||||
import{ElMessage, ElMessageBox, ElSelectV2, FormInstance,FormItemRule}from'element-plus'
|
||||
import {ElLoading, ElMessage, ElMessageBox, ElSelectV2, FormInstance, FormItemRule} from 'element-plus'
|
||||
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
|
||||
import { dialogBig,dialogMiddle} from '@/utils/elementBind'
|
||||
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
|
||||
@@ -44,6 +44,8 @@
|
||||
import { useDictStore } from '@/stores/modules/dict'
|
||||
import preTest from './preTest.vue'
|
||||
import timeTest from './timeTest.vue'
|
||||
import socketClient from '@/utils/webSocketClient';
|
||||
import {startTest} from '@/api/socket/socket'
|
||||
import channelsTest from './channelsTest.vue'
|
||||
//import SvgIcon from '@/components/SvgIcon.vue';
|
||||
|
||||
@@ -125,16 +127,106 @@ const detectionOptions = ref([
|
||||
const timeTestStatus = ref('waiting');//守时校验执行状态
|
||||
const channelsTestStatus = ref('waiting');//通道系数校准执行状态
|
||||
const TestStatus = ref('waiting');//正式检测执行状态
|
||||
const webMsgSend = ref();//webSocket推送的数据
|
||||
|
||||
const dialogTitle = ref('');
|
||||
const isTimeCheck = ref(false)
|
||||
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = (title: string,time:boolean) => {
|
||||
|
||||
dialogTitle.value = title;
|
||||
dialogVisible.value = true;
|
||||
isTimeCheck.value = time
|
||||
preTestStatus.value = 'waiting';//预检测执行状态
|
||||
//开始创建webSocket客户端
|
||||
const data = reactive({
|
||||
socketServe: socketClient.Instance,
|
||||
});
|
||||
const url = 'ws://localhost:7777/hello?name=cdf';
|
||||
socketClient.Instance.connect(url);
|
||||
data.socketServe = socketClient.Instance;
|
||||
data.socketServe.registerCallBack('aaa', (res) => {
|
||||
// 处理来自服务器的消息
|
||||
console.log('Received message:', res);
|
||||
// 根据需要在这里添加更多的处理逻辑
|
||||
|
||||
if(res.code === 20000){
|
||||
ElMessage.error(message.message)
|
||||
loading.close()
|
||||
}else {
|
||||
webMsgSend.value = res
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* else if(res.code === 10200){
|
||||
switch (res.operateCode){
|
||||
case 'INIT_GATHER':
|
||||
|
||||
break
|
||||
|
||||
}
|
||||
|
||||
}else if(res.code === 10201){
|
||||
switch (res.operateCode){
|
||||
case 'INIT_GATHER':
|
||||
//开始进入源初始化检测
|
||||
|
||||
|
||||
break
|
||||
|
||||
}
|
||||
|
||||
}*/
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
let loading;
|
||||
const handleSubmit = () => {
|
||||
skipDisabled.value = true
|
||||
console.log('=============',stepsActiveIndex.value)
|
||||
switch (stepsActiveIndex.value) {
|
||||
case 0:
|
||||
preTestStatus.value = 'start'
|
||||
|
||||
|
||||
/* loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: '',
|
||||
background: 'rgb(255, 255, 255, 0)',
|
||||
})*/
|
||||
startTest({
|
||||
userPageId: "cdf",
|
||||
devIds:["5eaba83670ff4d9daf892a62a5e13ea3","80b4b4f52a4c4064a18319525f8ac13c"],
|
||||
//planId:"31cc203f3fa94fa39323ae7cc411cd66"
|
||||
}).then(res=>{
|
||||
|
||||
|
||||
|
||||
})
|
||||
break;
|
||||
case 1:
|
||||
timeTestStatus.value = 'start'
|
||||
break;
|
||||
// case 2:
|
||||
// channelsTestStatus.value = 'start'
|
||||
// break;
|
||||
case 2:
|
||||
TestStatus.value = 'start'
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
watch(preTestStatus,function(newValue,oldValue){
|
||||
console.log(newValue,oldValue);
|
||||
|
||||
@@ -247,27 +339,7 @@ const getIcon = (index: number) => {
|
||||
|
||||
};
|
||||
|
||||
const handleSubmit = () => {
|
||||
skipDisabled.value = true
|
||||
switch (stepsActiveIndex.value) {
|
||||
case 0:
|
||||
preTestStatus.value = 'start'
|
||||
break;
|
||||
case 1:
|
||||
timeTestStatus.value = 'start'
|
||||
break;
|
||||
// case 2:
|
||||
// channelsTestStatus.value = 'start'
|
||||
// break;
|
||||
case 2:
|
||||
TestStatus.value = 'start'
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
// // 当 props.visible 改变时,更新 formData
|
||||
// watch(() => props.visible, (newVal) => {
|
||||
|
||||
Reference in New Issue
Block a user