系数校准动态通道数

This commit is contained in:
sjl
2024-12-23 15:08:14 +08:00
15 changed files with 824 additions and 1708 deletions

View File

@@ -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>
@@ -25,6 +25,7 @@
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled" @click="nextStep">跳过</el-button>
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'process'" @click="handleSubmit">停止检测</el-button>
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'paused'" @click="handleSubmit">继续检测</el-button>
<el-button type="primary" :icon="Refresh" v-if="ActiveStatue === 'error'" @click="handleSubmit">重新检测</el-button>
<el-button type="primary" :icon="Right" v-if="ActiveStatue === 'success'" @click="nextStep">{{nextStepText}}</el-button>
</div>
@@ -35,17 +36,29 @@
</template>
<script lang="tsx" setup name="testPopup">
import { h } from 'vue';
import{ElMessage, ElMessageBox, ElSelectV2, FormInstance,FormItemRule}from'element-plus'
import { defineProps, defineEmits, reactive,watch,ref, Ref } from 'vue';
import { dialogBig,dialogMiddle} from '@/utils/elementBind'
import {h, reactive, ref, watch} from 'vue';
import {ElMessage, ElMessageBox} from 'element-plus'
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
import {CirclePlus, Delete, EditPen,FolderOpened,CopyDocument,Edit, Picture, UploadFilled, SuccessFilled,VideoPlay,Right,Refresh,Close, Odometer,Coin,Key, DArrowRight} from '@element-plus/icons-vue'
import { useDictStore } from '@/stores/modules/dict'
import {
Close,
Coin,
DArrowRight,
Edit,
Key,
Odometer,
Refresh,
Right,
SuccessFilled,
UploadFilled,
VideoPlay
} from '@element-plus/icons-vue'
import preTest from './preTest.vue'
import timeTest from './timeTest.vue'
import channelsTest from './channelsTest.vue'
import { Device } from '@/api/device/interface/device';
import { Device } from '@/api/device/interface/device';
import socketClient from '@/utils/webSocketClient';
import {startTest} from '@/api/socket/socket'
//import SvgIcon from '@/components/SvgIcon.vue';
// import preTestIcon from '@/assets/icons/preTest.svg'
@@ -126,12 +139,16 @@ 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 = (selection: Device.ResPqDev[],title: string,time:boolean) => {
const checkStates = selection.map(item => item.checkState);
const checkStates = selection.map(item => item.checkState);
const allCheckStatesEqual = new Set(checkStates).size <= 1;
if (!allCheckStatesEqual) {
@@ -150,8 +167,101 @@ const detectionOptions = ref([
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:
if (TestStatus.value == "waiting") {
TestStatus.value = 'start'
} else if (TestStatus.value == 'process') {
TestStatus.value = 'paused'
} else if (TestStatus.value == 'paused') {
TestStatus.value = 'process'
}
break;
default:
break;
}
};
watch(preTestStatus,function(newValue,oldValue){
console.log(newValue,oldValue);
@@ -264,27 +374,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) => {