This commit is contained in:
caozehui
2025-01-07 19:47:38 +08:00
parent 5ac6bbf04b
commit edda224847
4 changed files with 471 additions and 447 deletions

View File

@@ -100,7 +100,7 @@
<template #default="scope"> <template #default="scope">
<el-tooltip effect="dark" placement="bottom"> <el-tooltip effect="dark" placement="bottom">
<template #content> <template #content>
最大误差{{ scope.row.maxError }} {{ unit }}<br/> 最大误差 {{ maxErrorView }}<br/>
误差值{{ scope.row.tError }} {{ unit }} 误差值{{ scope.row.tError }} {{ unit }}
</template> </template>
<el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag> <el-tag type="success" v-if="scope.row.isDataT === 1">符合</el-tag>

View File

@@ -90,7 +90,7 @@
</template> </template>
<script setup lang='ts'> <script setup lang='ts'>
import {dialogBig} from '@/utils/elementBind' import {dialogBig} from '@/utils/elementBind'
import {reactive, ref, watch} from 'vue' import {nextTick, reactive, ref, watch} from 'vue'
import DataCheckResultTable from './dataCheckResultTable.vue' import DataCheckResultTable from './dataCheckResultTable.vue'
import DataCheckRawDataTable from './dataCheckRawDataTable.vue' import DataCheckRawDataTable from './dataCheckRawDataTable.vue'
import {CheckData} from "@/api/check/interface"; import {CheckData} from "@/api/check/interface";
@@ -249,6 +249,9 @@ const defaultOperate = () => {
currentDesc.value = node.sourceDesc currentDesc.value = node.sourceDesc
checkIndex.value = node.index checkIndex.value = node.index
defaultExpandedKeys = [node.index] defaultExpandedKeys = [node.index]
// nextTick(() => {
// treeRef.value?.setCurrentKey(node.index);
// });
} else { } else {
currentScriptTypeName.value = '' currentScriptTypeName.value = ''
currentDesc.value = '' currentDesc.value = ''

View File

@@ -43,7 +43,7 @@
<el-button <el-button
type="warning" type="warning"
v-if="testStatus=='paused' && percentage < 100" v-if="testStatus=='paused' && percentage < 100"
:icon="Refresh" :icon="VideoPlay"
@click="emit('sendResume')" @click="emit('sendResume')"
>继续检测 >继续检测
</el-button> </el-button>
@@ -136,7 +136,7 @@
<dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/> <dataCheckSingleChannelSingleTestPopup ref="dataCheckSingleChannelSingleTestPopupRef"/>
</template> </template>
<script lang="tsx" setup name="test"> <script lang="tsx" setup name="test">
import {Check, Failed, InfoFilled, Loading, Refresh, RefreshLeft, VideoPause} from '@element-plus/icons-vue' import {Check, Failed, InfoFilled, Loading, Refresh, RefreshLeft, VideoPause, VideoPlay} from '@element-plus/icons-vue'
import resultPopup from './resultPopup.vue' import resultPopup from './resultPopup.vue'
import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue' import dataCheckSingleChannelSingleTestPopup from './dataCheckSingleChannelSingleTestPopup.vue'
import {computed, reactive, ref, toRef, watch} from "vue"; import {computed, reactive, ref, toRef, watch} from "vue";
@@ -297,7 +297,7 @@ watch(testStatus, function (newValue, oldValue) {
percentage.value = 0 percentage.value = 0
} }
emit('update:testStatus', 'test_init') emit('update:testStatus', 'test_init')
startTimer() // todo 可移除 //startTimer() // todo 可移除
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化开始!`})
} }
}) })
@@ -340,25 +340,25 @@ watch(webMsgSend, function (newValue, oldValue) {
break; break;
} }
break; break;
// case 'connect': case 'connect':
// switch (newValue.operateCode) { switch (newValue.operateCode) {
// case "Source": case "Source":
// ElMessageBox.alert('源通讯失败,请检查源连接情况!', '初始化失败', { ElMessageBox.alert('源通讯失败,请检查源连接情况!', '初始化失败', {
// confirmButtonText: '确定', confirmButtonText: '确定',
// type: 'error', type: 'error',
// }) })
// testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`}) testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:源通讯失败!`})
// break; break;
// case "Dev": case "Dev":
// ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '初始化失败', { ElMessageBox.alert('设备通讯失败,请检查设备连接情况!', '初始化失败', {
// confirmButtonText: '确定', confirmButtonText: '确定',
// type: 'error', type: 'error',
// }) })
// testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`}) testLogList.push({type: 'error', log: `${new Date().toLocaleString()}:设备通讯失败!`})
// break; break;
// } }
// emit('update:testStatus', 'test_init_fail') emit('update:testStatus', 'test_init_fail')
// break; break;
case 'yjc_ytxjy': case 'yjc_ytxjy':
switch (newValue.operateCode) { switch (newValue.operateCode) {
case 'INIT_GATHER': case 'INIT_GATHER':
@@ -386,7 +386,7 @@ watch(webMsgSend, function (newValue, oldValue) {
testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化成功!`}) testLogList.push({type: 'info', log: `${new Date().toLocaleString()}:初始化成功!`})
activeIndex = getNextActiveIndex() + 2 activeIndex = getNextActiveIndex() + 2
startTimer() //startTimer()
emit('update:testStatus', 'process') emit('update:testStatus', 'process')
} }
@@ -419,7 +419,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('FREQ') activeIndex = getNextActiveIndex('FREQ')
startTimer() //startTimer()
} }
break; break;
case 'V_Start': case 'V_Start':
@@ -432,7 +432,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('V') activeIndex = getNextActiveIndex('V')
startTimer() //startTimer()
} }
break; break;
case 'HV_Start': case 'HV_Start':
@@ -445,7 +445,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HV') activeIndex = getNextActiveIndex('HV')
startTimer() //startTimer()
} }
break; break;
case 'HI_Start': case 'HI_Start':
@@ -458,7 +458,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HI') activeIndex = getNextActiveIndex('HI')
startTimer() //startTimer()
} }
break; break;
case 'HP_Start': case 'HP_Start':
@@ -471,7 +471,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HP') activeIndex = getNextActiveIndex('HP')
startTimer() //startTimer()
} }
break; break;
case 'HSV_Start': case 'HSV_Start':
@@ -484,7 +484,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HSV') activeIndex = getNextActiveIndex('HSV')
startTimer() //startTimer()
} }
break; break;
case 'HSI_Start': case 'HSI_Start':
@@ -497,7 +497,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('HSI') activeIndex = getNextActiveIndex('HSI')
startTimer() //startTimer()
} }
break; break;
case 'VOLTAGE_Start': case 'VOLTAGE_Start':
@@ -510,7 +510,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('VOLTAGE') activeIndex = getNextActiveIndex('VOLTAGE')
startTimer() //startTimer()
} }
break; break;
case 'I_Start': case 'I_Start':
@@ -523,7 +523,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('I') activeIndex = getNextActiveIndex('I')
startTimer() //startTimer()
} }
break; break;
case 'IMBV_Start': case 'IMBV_Start':
@@ -536,7 +536,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('IMBV') activeIndex = getNextActiveIndex('IMBV')
startTimer() //startTimer()
} }
break; break;
case 'IMBA_Start': case 'IMBA_Start':
@@ -549,7 +549,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('IMBA') activeIndex = getNextActiveIndex('IMBA')
startTimer() //startTimer()
} }
break; break;
case 'F_Start': case 'F_Start':
@@ -562,7 +562,7 @@ watch(webMsgSend, function (newValue, oldValue) {
updateLog(false) updateLog(false)
if (testStatus.value != 'paused') { if (testStatus.value != 'paused') {
activeIndex = getNextActiveIndex('F') activeIndex = getNextActiveIndex('F')
startTimer() //startTimer()
} }
break; break;
case 'Quit': case 'Quit':
@@ -796,11 +796,11 @@ const setErrorCheckItem = (scriptType: string, devices: any) => {
const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: any = null) => { const updateCheckResultView = (scriptCode: string, isStart: boolean, devices: any = null) => {
let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id let scriptType = scriptData.filter(item => item.code === scriptCode)[0]?.id
devices = [{ // devices = [{
chnResult: [2, 2], // chnResult: [2, 2],
deviceId: "80b4b4f52a4c4064a18319525f8ac13c", // deviceId: "80b4b4f52a4c4064a18319525f8ac13c",
deviceName: "240002" // deviceName: "240002"
}] // }]
setErrorCheckItem(scriptType, devices) setErrorCheckItem(scriptType, devices)
let temp = null let temp = null
if (isStart) { if (isStart) {
@@ -1126,7 +1126,7 @@ const handleResumeTest = () => {
type: 'info', type: 'info',
log: `${new Date().toLocaleString()}:继续检测`, log: `${new Date().toLocaleString()}:继续检测`,
}) })
startTimer() //startTimer()
console.log('开始继续检测') console.log('开始继续检测')
}; };

View File

@@ -1,71 +1,85 @@
<template> <template>
<el-dialog :title="dialogTitle" :model-value="dialogVisible" :before-close="beforeClose" @close="handleCancel" width="1200px" height="1000px" draggable> <el-dialog :title="dialogTitle" :model-value="dialogVisible" :before-close="beforeClose" @close="handleCancel" width="1200px" height="1000px"
draggable>
<div class="steps-container"> <div class="steps-container">
<!-- simple --> <!-- simple -->
<!-- :style="{color:node.label=='未检'?'#F56C6C':node.label=='检测中'?'#E6A23C':'#67C23A'}" --> <!-- :style="{color:node.label=='未检'?'#F56C6C':node.label=='检测中'?'#E6A23C':'#67C23A'}" -->
<el-steps class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success" > <el-steps class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success">
<!-- style="height:100px" --> <!-- style="height:100px" -->
<!-- <el-step title="预检测" :icon="getIcon(0)" /> --> <!-- <el-step title="预检测" :icon="getIcon(0)" /> -->
<el-step title="预检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :Edit" /> <el-step title="预检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :Edit"/>
<el-step title="守时检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :UploadFilled" v-if="isTimeCheck"/> <el-step title="守时检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :UploadFilled" v-if="isTimeCheck"/>
<!-- <el-step title="系数校准" :icon="stepsActiveIndex > 2 ? SuccessFilled :Odometer" /> --> <!-- <el-step title="系数校准" :icon="stepsActiveIndex > 2 ? SuccessFilled :Odometer" /> -->
<el-step title="正式检测" :icon="stepsActiveIndex > 3 ? SuccessFilled :Coin" /> <el-step title="正式检测" :icon="stepsActiveIndex > 3 ? SuccessFilled :Coin"/>
<el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key" /> <el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key"/>
</el-steps> </el-steps>
</div> </div>
<preTest ref="preTestRef" v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"></preTest> <preTest ref="preTestRef" v-if="stepsActiveIndex === 0" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"></preTest>
<timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest> <timeTest v-if="stepsActiveIndex === 1 && isTimeCheck" v-model:testStatus="timeTestStatus"></timeTest>
<!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> --> <!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
<test ref="testRef" v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck"></test> <test ref="testRef" v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event"
@sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck"></test>
<template #footer> <template #footer>
<div> <div>
<!-- <el-button @click="handleCancel"> </el-button> --> <!-- <el-button @click="handleCancel"> </el-button> -->
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled" @click="nextStep">跳过</el-button> <el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled"
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button> @click="nextStep">跳过
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'process'" @click="handleSubmit" disabled>检测中</el-button> </el-button>
<el-button type="danger" :icon="Close" v-if="ActiveStatue === 'paused'" @click="handleSubmit">继续检测</el-button> <el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
<el-button type="primary" :icon="RefreshLeft" v-if="ActiveStatue === 'error'" @click="handleSubmit">重新检测</el-button> <el-button type="primary" v-if="ActiveStatue === 'process'" @click="handleSubmit" disabled>
<el-button type="primary" :icon="Refresh" v-if="ActiveStatue === 'test_init'" disabled>初始化中</el-button> <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right" <component :is="Refresh"/>
v-if="ActiveStatue === 'success'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'" @click="nextStep"> </el-icon>
{{ nextStepText }} 检测中
</el-button> </el-button>
</div> <el-button type="warning" :icon="VideoPlay" v-if="ActiveStatue === 'paused'" @click="handleSubmit">继续检测</el-button>
</template> <el-button type="primary" :icon="RefreshLeft" v-if="ActiveStatue === 'error'" @click="handleSubmit">重新检测</el-button>
</el-dialog> <el-button type="primary" v-if="ActiveStatue === 'test_init'" disabled>
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
<component :is="Refresh"/>
</el-icon>
初始化中
</el-button>
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
v-if="ActiveStatue === 'success'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'" @click="nextStep">
{{ nextStepText }}
</el-button>
</div>
</template>
</el-dialog>
</template> </template>
<script lang="tsx" setup name="testPopup"> <script lang="tsx" setup name="testPopup">
import {h, reactive, ref, watch} from 'vue'; import {h, reactive, ref, watch} from 'vue';
import {ElMessage, ElMessageBox} from 'element-plus' import {ElMessage, ElMessageBox} from 'element-plus'
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件 //import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
import { import {
Close, Close,
Coin, Coin,
DArrowRight, DArrowRight,
Edit, Edit,
Key, Key,
Odometer, Odometer,
Refresh, Refresh,
Right, Right,
SuccessFilled, SuccessFilled,
UploadFilled, UploadFilled,
VideoPlay, VideoPlay,
RefreshLeft RefreshLeft, Loading
} from '@element-plus/icons-vue' } from '@element-plus/icons-vue'
import preTest from './preTest.vue' import preTest from './preTest.vue'
import timeTest from './timeTest.vue' import timeTest from './timeTest.vue'
import { Device } from '@/api/device/interface/device'; import {Device} from '@/api/device/interface/device';
import socketClient from '@/utils/webSocketClient'; import socketClient from '@/utils/webSocketClient';
import {useCheckStore} from "@/stores/modules/check"; import {useCheckStore} from "@/stores/modules/check";
import {startPreTest,startTest,pauseTest,resumeTest} from '@/api/socket/socket' import {startPreTest, startTest, pauseTest, resumeTest} from '@/api/socket/socket'
//import SvgIcon from '@/components/SvgIcon.vue'; //import SvgIcon from '@/components/SvgIcon.vue';
// import preTestIcon from '@/assets/icons/preTest.svg' // import preTestIcon from '@/assets/icons/preTest.svg'
@@ -73,30 +87,30 @@
// <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6"> // <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6">
// </svg> // </svg>
// `; // `;
// const props = defineProps<{ // const props = defineProps<{
// visible: boolean; // visible: boolean;
// dialogTitle: string; // dialogTitle: string;
// formData: { // formData: {
// id: string;//误差体系表Id // id: string;//误差体系表Id
// name: string;//误差体系名称 // name: string;//误差体系名称
// standard_Name:string;//参照标准名称 // standard_Name:string;//参照标准名称
// standard_Time:string;//标准推行时间 // standard_Time:string;//标准推行时间
// dev_Level:string;//使用设备等级 // dev_Level:string;//使用设备等级
// enable:number;//状态0-不启用 1-启用 // enable:number;//状态0-不启用 1-启用
// state:number;//0-删除 1-正常 // state:number;//0-删除 1-正常
// }; // };
// }>(); // }>();
// const emit = defineEmits<{ // const emit = defineEmits<{
// (e: 'update:visible', value: boolean): void; // (e: 'update:visible', value: boolean): void;
// (e: 'submit', data: any): void; // (e: 'submit', data: any): void;
// }>(); // }>();
const checkStore = useCheckStore(); const checkStore = useCheckStore();
const skipDisabled = ref(false); const skipDisabled = ref(false);
const nextStepText = ref('下一步'); const nextStepText = ref('下一步');
const dialogVisible = ref(false) const dialogVisible = ref(false)
//定义与预检测配置数组 //定义与预检测配置数组
const detectionOptions = ref([ const detectionOptions = ref([
{ {
@@ -139,37 +153,37 @@ const detectionOptions = ref([
// }, // },
]); ]);
const stepsTotalNum = ref(4);//步骤总数 const stepsTotalNum = ref(4);//步骤总数
const stepsActiveIndex = ref(0); //当前正在执行的步骤索引 const stepsActiveIndex = ref(0); //当前正在执行的步骤索引
const ActiveStatue = ref('waiting');//当前步骤状态 const ActiveStatue = ref('waiting');//当前步骤状态
const preTestStatus = ref('waiting');//预检测执行状态 const preTestStatus = ref('waiting');//预检测执行状态
const timeTestStatus = ref('waiting');//守时校验执行状态 const timeTestStatus = ref('waiting');//守时校验执行状态
const channelsTestStatus = ref('waiting');//通道系数校准执行状态 const channelsTestStatus = ref('waiting');//通道系数校准执行状态
const TestStatus = ref('waiting');//正式检测执行状态 const TestStatus = ref('waiting');//正式检测执行状态
const webMsgSend = ref();//webSocket推送的数据 const webMsgSend = ref();//webSocket推送的数据
const dialogTitle = ref(''); const dialogTitle = ref('');
const isTimeCheck = ref(false) const isTimeCheck = ref(false)
const preTestRef = ref(null); const preTestRef = ref(null);
const testRef = ref(null); const testRef = ref(null);
// const devIdArr = ref([]) // const devIdArr = ref([])
// const planId = ref('') // const planId = ref('')
// 打开弹窗,可能是新增,也可能是编辑 // 打开弹窗,可能是新增,也可能是编辑
const open = (selection: Device.ResPqDev[],title: string,time:boolean) => { const open = (selection: Device.ResPqDev[], title: string, time: boolean) => {
const checkStates = selection.map(item => item.checkState); const checkStates = selection.map(item => item.checkState);
// devIdArr.value = selection.map(item => item.id); // devIdArr.value = selection.map(item => item.id);
// planId.value =selection[0].planId // planId.value =selection[0].planId
// console.log('wwwwwwwwwwwwwwwww',selection) // console.log('wwwwwwwwwwwwwwwww',selection)
const allCheckStatesEqual = new Set(checkStates).size <= 1; const allCheckStatesEqual = new Set(checkStates).size <= 1;
if (!allCheckStatesEqual) { if (!allCheckStatesEqual) {
ElMessageBox.confirm( ElMessageBox.confirm(
'所勾选设备检测状态不一致,请重新选择', '所勾选设备检测状态不一致,请重新选择',
'提示', '提示',
{ {
@@ -177,295 +191,289 @@ const detectionOptions = ref([
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
} }
) )
return return
}
dialogTitle.value = title;
dialogVisible.value = true;
isTimeCheck.value = time
if (preTestRef.value) {
preTestRef.value.initializeParameters();
}
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
}
});
} }
let loading; dialogTitle.value = title;
const handleSubmit = () => { dialogVisible.value = true;
skipDisabled.value = true isTimeCheck.value = time
console.log('=============',stepsActiveIndex.value)
let deviceIds = checkStore.devices.map((item) => item.deviceId) if (preTestRef.value) {
let planId = checkStore.planId preTestRef.value.initializeParameters();
}
switch (stepsActiveIndex.value) { preTestStatus.value = 'waiting';//预检测执行状态
case 0: //开始创建webSocket客户端
preTestStatus.value = 'start' 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
}
/* loading = ElLoading.service({ });
lock: true,
text: '',
background: 'rgb(255, 255, 255, 0)', }
})*/
let loading;
const handleSubmit = () => {
skipDisabled.value = true
console.log('=============', stepsActiveIndex.value)
let deviceIds = checkStore.devices.map((item) => item.deviceId)
let planId = checkStore.planId
switch (stepsActiveIndex.value) {
case 0:
preTestStatus.value = 'start'
/* loading = ElLoading.service({
lock: true,
text: '',
background: 'rgb(255, 255, 255, 0)',
})*/
startPreTest({
userPageId: "cdf",
devIds: deviceIds,
planId: planId,
errorSysId: 'cb407009f9894a8a8933b5d9b1e2f71d',
scriptId: "a303b2224845fcc6f60198b8ca23dca9",
operateType: '0' // '1'为预检测、2为正式检测
}).then(res => {
})
break;
case 1:
timeTestStatus.value = 'start'
break;
// case 2:
// channelsTestStatus.value = 'start'
// break;
case 2:
if (TestStatus.value == "waiting") {
startPreTest({ startPreTest({
userPageId: "cdf", userPageId: "cdf",
devIds:deviceIds, devIds: deviceIds,
planId:planId, planId: planId,
errorSysId:'cb407009f9894a8a8933b5d9b1e2f71d', errorSysId: 'cb407009f9894a8a8933b5d9b1e2f71d',
scriptId:"a303b2224845fcc6f60198b8ca23dca9", scriptId: "a303b2224845fcc6f60198b8ca23dca9",
operateType:'0' // '1'为预检测、2为正式检测 operateType: '2' // '1'为预检测、2为正式检测
}).then(res=>{ }).then(res => {
console.log(res)
/* if (res.code === 20000) {
TestStatus.value = 'start'
webMsgSend.value = ''
} else {
ElMessage.error(res.message)
}*/
}) })
break; TestStatus.value = 'start'
case 1: } else
timeTestStatus.value = 'start'
break;
// case 2:
// channelsTestStatus.value = 'start'
// break;
case 2:
if (TestStatus.value == "waiting") {
startPreTest({
userPageId: "cdf",
devIds:deviceIds,
planId:planId,
errorSysId:'cb407009f9894a8a8933b5d9b1e2f71d',
scriptId:"a303b2224845fcc6f60198b8ca23dca9",
operateType:'2' // '1'为预检测、2为正式检测
}).then(res => {
console.log(res)
/* if (res.code === 20000) {
TestStatus.value = 'start'
webMsgSend.value = ''
} else {
ElMessage.error(res.message)
}*/
})
TestStatus.value = 'start'
} else
// if (TestStatus.value == 'process') { // if (TestStatus.value == 'process') {
// // 发送暂停指令 // // 发送暂停指令
// sendPause() // sendPause()
// // pauseTest({deviceIds}).then(res => { // // pauseTest({deviceIds}).then(res => {
// // console.log(res) // // console.log(res)
// // if (res.code === 20000) { // // if (res.code === 20000) {
// // TestStatus.value = 'paused' // // TestStatus.value = 'paused'
// // webMsgSend.value = '' // // webMsgSend.value = ''
// // } else { // // } else {
// // ElMessage.error(res.message) // // ElMessage.error(res.message)
// // } // // }
// // }) // // })
// //
// } else // } else
if (TestStatus.value == 'paused') { if (TestStatus.value == 'paused') {
// 发送继续指令 // 发送继续指令
sendResume() sendResume()
// resumeTest({deviceIds}).then(res => { // resumeTest({deviceIds}).then(res => {
// console.log(res) // console.log(res)
// if (res.code === 20000) { // if (res.code === 20000) {
// TestStatus.value = 'process' // TestStatus.value = 'process'
// webMsgSend.value = '' // webMsgSend.value = ''
// } else { // } else {
// ElMessage.error(res.message) // ElMessage.error(res.message)
// } // }
// }) // })
}else if (TestStatus.value == 'error') { } else if (TestStatus.value == 'error') {
// 发送重新检测指令 // 发送重新检测指令
sendReCheck() sendReCheck()
} }
break; break;
default: default:
break; break;
}
};
watch(preTestStatus,function(newValue,oldValue){
console.log(newValue,oldValue);
ActiveStatue.value = newValue
})
watch(timeTestStatus,function(newValue,oldValue){
console.log(newValue,oldValue);
ActiveStatue.value = newValue
})
watch(channelsTestStatus,function(newValue,oldValue){
console.log(newValue,oldValue);
ActiveStatue.value = newValue
})
watch(TestStatus,function(newValue,oldValue){
console.log(newValue,oldValue);
ActiveStatue.value = newValue
})
watch(ActiveStatue,function(newValue,oldValue){
if(newValue === 'success' || newValue === 'error'){
skipDisabled.value = false
}
if(newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 2)
{
stepsActiveIndex.value++;
stepsActiveIndex.value++;
nextStepText.value = '检测完成'
}
if(newValue === 'test_init_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2)
{
stepsActiveIndex.value++;
stepsActiveIndex.value++;
nextStepText.value = '初始化失败'
}
if(newValue === 'connect_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2)
{
stepsActiveIndex.value++;
stepsActiveIndex.value++;
nextStepText.value = '连接超时'
}
})
const sendPause = () => {
console.log('发送暂停指令')
Object.assign(webMsgSend.value, {
requestId:'Pause_Success'
}) // todo 可移除
}
const sendResume = () => {
console.log('发送继续检测指令')
Object.assign(webMsgSend.value, {
requestId:'Resume_Success'
}) // todo 可移除
} }
const sendReCheck = () => {
console.log('发送重新检测指令') };
// startPreTest({
// userPageId: "cdf",
// devIds:deviceIds, watch(preTestStatus, function (newValue, oldValue) {
// planId:planId, console.log(newValue, oldValue);
// errorSysId:'cb407009f9894a8a8933b5d9b1e2f71d',
// scriptId:"a303b2224845fcc6f60198b8ca23dca9", ActiveStatue.value = newValue
// operateType:'1' // '0'为预检测、1为正式检测 })
// }).then(res => { watch(timeTestStatus, function (newValue, oldValue) {
// console.log(res) console.log(newValue, oldValue);
/* if (res.code === 20000) {
TestStatus.value = 'start' ActiveStatue.value = newValue
webMsgSend.value = '' })
} else { watch(channelsTestStatus, function (newValue, oldValue) {
ElMessage.error(res.message) console.log(newValue, oldValue);
}*/
// }) ActiveStatue.value = newValue
TestStatus.value = 'start' })
watch(TestStatus, function (newValue, oldValue) {
console.log(newValue, oldValue);
ActiveStatue.value = newValue
})
watch(ActiveStatue, function (newValue, oldValue) {
if (newValue === 'success' || newValue === 'error') {
skipDisabled.value = false
} }
if (newValue === 'success' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
stepsActiveIndex.value++;
stepsActiveIndex.value++;
nextStepText.value = '检测完成'
}
if (newValue === 'test_init_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
stepsActiveIndex.value++;
stepsActiveIndex.value++;
nextStepText.value = '初始化失败'
}
if (newValue === 'connect_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
stepsActiveIndex.value++;
stepsActiveIndex.value++;
nextStepText.value = '连接超时'
}
})
const sendPause = () => {
console.log('发送暂停指令')
Object.assign(webMsgSend.value, {
requestId: 'Pause_Success'
}) // todo 可移除
}
const sendResume = () => {
console.log('发送继续检测指令')
Object.assign(webMsgSend.value, {
requestId: 'Resume_Success'
}) // todo 可移除
}
const sendReCheck = () => {
console.log('发送重新检测指令')
// startPreTest({
// userPageId: "cdf",
// devIds:deviceIds,
// planId:planId,
// errorSysId:'cb407009f9894a8a8933b5d9b1e2f71d',
// scriptId:"a303b2224845fcc6f60198b8ca23dca9",
// operateType:'1' // '0'为预检测、1为正式检测
// }).then(res => {
// console.log(res)
/* if (res.code === 20000) {
TestStatus.value = 'start'
webMsgSend.value = ''
} else {
ElMessage.error(res.message)
}*/
// })
TestStatus.value = 'start'
}
const getIcon = (index: number) => { const getIcon = (index: number) => {
if (stepsActiveIndex.value > index) return SuccessFilled; if (stepsActiveIndex.value > index) return SuccessFilled;
switch (index) { switch (index) {
case 0: return h(<svg-icon name="preTest"></svg-icon>); case 0:
case 1: return UploadFilled; return h(<svg-icon name="preTest"></svg-icon>);
case 2: return Odometer; case 1:
case 3: return Coin; return UploadFilled;
case 4: return Key; case 2:
default: return null; return Odometer;
case 3:
return Coin;
case 4:
return Key;
default:
return null;
} }
}; };
const nextStep = () => { const nextStep = () => {
if(stepsActiveIndex.value < stepsTotalNum.value ) if (stepsActiveIndex.value < stepsTotalNum.value) {
{ stepsActiveIndex.value++
if (!isTimeCheck.value) {//不具备守时检测,预检测后直接跳正式检测
stepsActiveIndex.value++ stepsActiveIndex.value++
if(!isTimeCheck.value){//不具备守时检测,预检测后直接跳正式检测
stepsActiveIndex.value++
}
ActiveStatue.value = 'waiting'
} }
else if(stepsActiveIndex.value === stepsTotalNum.value)
{
//emit('update:visible', false); // 关闭对话框
clearData()
dialogVisible.value = false;
}
};
function clearData(){ ActiveStatue.value = 'waiting'
stepsActiveIndex.value = 0; } else if (stepsActiveIndex.value === stepsTotalNum.value) {
preTestStatus.value = "waiting" //emit('update:visible', false); // 关闭对话框
timeTestStatus.value = "waiting" clearData()
channelsTestStatus.value = "waiting" dialogVisible.value = false;
TestStatus.value = "waiting"
ActiveStatue.value = "waiting"
skipDisabled.value = false
nextStepText.value = "下一步"
} }
const beforeClose = (done: () => void) => { };
console.log(stepsActiveIndex.value,stepsTotalNum.value)
if(stepsActiveIndex.value < stepsTotalNum.value) function clearData() {
{ stepsActiveIndex.value = 0;
ElMessageBox.confirm( preTestStatus.value = "waiting"
'检测未完成,是否退出当前检测流程?', timeTestStatus.value = "waiting"
'提示', channelsTestStatus.value = "waiting"
{ TestStatus.value = "waiting"
confirmButtonText: '确定', ActiveStatue.value = "waiting"
cancelButtonText: '取消', skipDisabled.value = false
type: 'warning', nextStepText.value = "下一步"
} }
const beforeClose = (done: () => void) => {
console.log(stepsActiveIndex.value, stepsTotalNum.value)
if (stepsActiveIndex.value < stepsTotalNum.value) {
ElMessageBox.confirm(
'检测未完成,是否退出当前检测流程?',
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
) )
.then(() => { .then(() => {
clearData() clearData()
// todo 关闭弹窗,终止整个检测流程 // todo 关闭弹窗,终止整个检测流程
//emit('update:visible', false); // 关闭对话框 //emit('update:visible', false); // 关闭对话框
dialogVisible.value = false; dialogVisible.value = false;
}) })
} } else {
else clearData()
{ //emit('update:visible', false); // 关闭对话框
clearData() dialogVisible.value = false;
//emit('update:visible', false); // 关闭对话框 }
dialogVisible.value = false;
}
// ElMessageBox.confirm('Are you sure to close this dialog?') // ElMessageBox.confirm('Are you sure to close this dialog?')
// .then(() => { // .then(() => {
// done() // done()
@@ -474,31 +482,31 @@ const getIcon = (index: number) => {
// // catch error // // catch error
// }) // })
} }
const handleCancel = () => { const handleCancel = () => {
// clearData() // clearData()
// emit('update:visible', false); // 关闭对话框 // emit('update:visible', false); // 关闭对话框
testRef.value?.clear() testRef.value?.clear()
}; };
// // 当 props.visible 改变时,更新 formData
// watch(() => props.visible, (newVal) => {
// if (!newVal) {
// // 这里可以重置表单数据,如果需要的话
// // 当 props.visible 改变时,更新 formData // }
// watch(() => props.visible, (newVal) => { // });
// if (!newVal) {
// // 这里可以重置表单数据,如果需要的话
// } // 对外映射
// }); defineExpose({open})
</script>
// 对外映射 <style scoped lang="scss">
defineExpose({ open })
</script>
<style scoped lang="scss"> :deep(.dialog-big .el-dialog__body) {
max-height: 840px !important;
:deep(.dialog-big .el-dialog__body){
max-height: 840px !important;
} }
// :deep(.dialog-big){ // :deep(.dialog-big){
// max-height: 840px !important; // max-height: 840px !important;
// } // }
@@ -506,32 +514,45 @@ const getIcon = (index: number) => {
// max-height: 840px !important; // max-height: 840px !important;
// } // }
.steps-container :deep(.test-head-steps){ .steps-container :deep(.test-head-steps) {
height: 80px; height: 80px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.steps-container :deep(.el-step__title) { .steps-container :deep(.el-step__title) {
font-size: 20px !important; /* 设置标题字体大小 */ font-size: 20px !important; /* 设置标题字体大小 */
vertical-align:baseline !important; vertical-align: baseline !important;
display: inline-block; /* 确保文字和图标在同一行 */ display: inline-block; /* 确保文字和图标在同一行 */
line-height: 1; /* 调整行高以确保底部对齐 */ line-height: 1; /* 调整行高以确保底部对齐 */
} }
.steps-container :deep(.el-step__icon-inner) { .steps-container :deep(.el-step__icon-inner) {
font-size: 18px !important; font-size: 18px !important;
vertical-align:baseline !important; vertical-align: baseline !important;
display: inline-block; /* 确保文字和图标在同一行 */ display: inline-block; /* 确保文字和图标在同一行 */
line-height: 1; /* 调整行高以确保底部对齐 */ line-height: 1; /* 调整行高以确保底部对齐 */
} }
.steps-container :deep(.el-step__icon) { .steps-container :deep(.el-step__icon) {
font-size: 18px !important; font-size: 18px !important;
vertical-align:baseline !important; vertical-align: baseline !important;
display: inline-block; /* 确保文字和图标在同一行 */ display: inline-block; /* 确保文字和图标在同一行 */
line-height: 1; /* 调整行高以确保底部对齐 */ line-height: 1; /* 调整行高以确保底部对齐 */
} }
.loading-box {
animation: loading 1.5s linear infinite;
}
@keyframes loading {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
// :deep(.test-head-steps){ // :deep(.test-head-steps){
// height: 100px; // height: 100px;
// margin-bottom: 20px; // margin-bottom: 20px;