预见测代码
This commit is contained in:
@@ -62,6 +62,8 @@
|
||||
|
||||
</template>
|
||||
<script lang="tsx" setup name="preTest">
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
const step1InitLog = ref([
|
||||
{
|
||||
type: 'info',
|
||||
@@ -206,28 +208,133 @@ const props = defineProps({
|
||||
testStatus: {
|
||||
type: String,
|
||||
default: 'wait'
|
||||
},
|
||||
webMsgSend: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const testStatus = toRef(props, 'testStatus');
|
||||
const webMsgSend = toRef(props, 'webMsgSend');
|
||||
const ts = ref('');
|
||||
|
||||
watch(webMsgSend,function (newValue,oldValue){
|
||||
console.log(newValue)
|
||||
|
||||
switch (newValue.requestId){
|
||||
case 'yjc_ytxjy':
|
||||
switch (newValue.operateCode){
|
||||
case 'INIT_GATHER':
|
||||
if(newValue.code == 10200) {
|
||||
step1InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '源校验成功!',
|
||||
})
|
||||
activeIndex.value++
|
||||
}else if(newValue.code == 10201){
|
||||
step1InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行源校验!',
|
||||
}];
|
||||
}else if(newValue.code == 10552){
|
||||
ElMessage.error(newValue.code)
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case 'yjc_sbtxjy':
|
||||
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER$01':
|
||||
if (newValue.code == 10200) {
|
||||
step2InitLog.value.push({
|
||||
type: 'info',
|
||||
log: newValue.data+'设备通讯校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step2InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行设备通讯校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error(newValue.code)
|
||||
} else if (newValue.code == 25001) {
|
||||
activeIndex.value++
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'yjc_xyjy':
|
||||
switch (newValue.operateCode) {
|
||||
case 'INIT_GATHER$02':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '实时数据协议校验:'+newValue.data+'通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
step3InitLog.value = [{
|
||||
type: 'wait',
|
||||
log: '正在进行通讯协议校验.....',
|
||||
}];
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error(newValue.code)
|
||||
}
|
||||
break;
|
||||
case 'INIT_GATHER$03':
|
||||
if (newValue.code == 10200) {
|
||||
step3InitLog.value.push({
|
||||
type: 'info',
|
||||
log: '暂态数据协议校验:'+newValue.data+'通讯协议校验成功!',
|
||||
})
|
||||
|
||||
} else if (newValue.code == 10201) {
|
||||
|
||||
} else if (newValue.code == 10552) {
|
||||
ElMessage.error(newValue.code)
|
||||
} else if (newValue.code == 25001) {
|
||||
activeIndex.value++
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case 'YJC_xujy':
|
||||
break;
|
||||
case 'quit':
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
})
|
||||
|
||||
watch(activeIndex, function (newValue, oldValue) {
|
||||
|
||||
console.log(activeIndex.value)
|
||||
if (activeIndex.value === 1) {
|
||||
step1InitLog.value.length = 0;
|
||||
step1InitLog.value = step1Log.value;
|
||||
|
||||
}
|
||||
if (activeIndex.value === 2) {
|
||||
step2InitLog.value.length = 0;
|
||||
step2InitLog.value = step2Log.value;
|
||||
|
||||
}
|
||||
if (activeIndex.value === 3) {
|
||||
step3InitLog.value.length = 0;
|
||||
step3InitLog.value = step3Log.value;
|
||||
|
||||
}
|
||||
if (activeIndex.value > 3) {
|
||||
step4InitLog.value.length = 0;
|
||||
step4InitLog.value = step4Log.value;
|
||||
|
||||
}
|
||||
if (activeIndex.value < activeTotalNum.value - 2)
|
||||
collapseActiveName.value = (newValue + 1).toString()
|
||||
@@ -241,7 +348,7 @@ watch(testStatus, function (newValue, oldValue) {
|
||||
if (ts.value === 'start') {
|
||||
ts.value = 'process'
|
||||
|
||||
let timer = setInterval(() => {
|
||||
/*let timer = setInterval(() => {
|
||||
if (activeIndex.value < activeTotalNum.value - 2)
|
||||
activeIndex.value++
|
||||
else if (activeIndex.value === activeTotalNum.value - 2) {
|
||||
@@ -253,7 +360,15 @@ watch(testStatus, function (newValue, oldValue) {
|
||||
ts.value = 'success'
|
||||
}
|
||||
|
||||
}, 1500);
|
||||
}, 1500);*/
|
||||
}else if(ts.value === 'waiting'){
|
||||
activeIndex.value = 0
|
||||
step1InitLog.value = [
|
||||
{
|
||||
type: 'info',
|
||||
log: '暂无数据,等待检测开始',
|
||||
},
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -791,7 +791,7 @@ const handleTest = async (val:string) => {
|
||||
}
|
||||
else
|
||||
{
|
||||
ElMessage.success(val);
|
||||
// ElMessage.success(val);
|
||||
dialogTitle.value = val;
|
||||
testPopup.value?.open(dialogTitle.value,props.isTimeCheck)
|
||||
}
|
||||
|
||||
@@ -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