手动检测功能修改、一键检测功能修改(均未完成)
This commit is contained in:
@@ -1,34 +1,30 @@
|
||||
<template>
|
||||
<el-dialog :title="dialogTitle" :model-value="dialogVisible" :before-close="beforeClose" @close="handleCancel" width="1200px" height="1000px"
|
||||
<el-dialog :title="dialogTitle" :model-value="dialogVisible" :before-close="beforeClose" @close="handleClose" width="1200px" height="1000px"
|
||||
draggable>
|
||||
|
||||
<div class="steps-container">
|
||||
<!-- simple -->
|
||||
<!-- :style="{color:node.label=='未检'?'#F56C6C':node.label=='检测中'?'#E6A23C':'#67C23A'}" -->
|
||||
<el-steps class="test-head-steps" simple :active="stepsActiveIndex" process-status="finish" finish-status="success">
|
||||
<!-- style="height:100px" -->
|
||||
<!-- <el-step title="预检测" :icon="getIcon(0)" /> -->
|
||||
<el-step title="预检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :Edit"/>
|
||||
<el-step title="守时检测" :icon="stepsActiveIndex > 1 ? SuccessFilled :UploadFilled" v-if="isTimeCheck"/>
|
||||
<!-- <el-step title="系数校准" :icon="stepsActiveIndex > 2 ? SuccessFilled :Odometer" /> -->
|
||||
<el-step title="正式检测" :icon="stepsActiveIndex > 3 ? SuccessFilled :Coin"/>
|
||||
<el-step title="检测完成" :icon="stepsActiveIndex > 4 ? SuccessFilled :Key"/>
|
||||
<el-steps class="test-head-steps" simple :active="stepsActiveIndex-1" process-status="finish" finish-status="success">
|
||||
<el-step v-if="preTestSelected" title="预检测" :icon="stepsActive === 1? SuccessFilled :Edit" @click="handleStepClick(1)"/>
|
||||
<el-step v-if="timeTestSelected" title="守时检测" :icon="stepsActive === 2? SuccessFilled :UploadFilled" @click="handleStepClick(2)"/>
|
||||
<el-step v-if="channelsTestSelected" title="系数校准" :icon="stepsActive === 3? SuccessFilled :Odometer" @click="handleStepClick(3)"/>
|
||||
<el-step v-if="testSelected" title="正式检测" :icon="stepsActive === 4? SuccessFilled :Coin" @click="handleStepClick(4)"/>
|
||||
<el-step title="检测完成" :icon="stepsActiveIndex > stepsTotalNum ? SuccessFilled :Key"/>
|
||||
</el-steps>
|
||||
</div>
|
||||
<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>
|
||||
<!-- <channelsTest v-if="stepsActiveIndex === 2" v-model:testStatus="channelsTestStatus"></channelsTest> -->
|
||||
<test v-if="stepsActiveIndex >= 2" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend" @update:webMsgSend="webMsgSend=$event"
|
||||
@sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck"></test>
|
||||
|
||||
<preTest v-if="showComponent" v-show="preTestSelected && stepsActiveView==1" ref="preTestRef" v-model:testStatus="preTestStatus" :webMsgSend="webMsgSend"/>
|
||||
<timeTest v-if="showComponent" v-show="timeTestSelected && stepsActiveView==2" v-model:testStatus="timeTestStatus"/>
|
||||
<!-- <channelsTest v-if="stepsActiveIndex === 3" v-model:testStatus="channelsTestStatus"></channelsTest>-->
|
||||
<factorTest v-if="showComponent" v-show="channelsTestSelected && stepsActiveView==3" v-model:testStatus="channelsTestStatus"/>
|
||||
<test v-if="showComponent" v-show="testSelected && stepsActiveView==4" v-model:testStatus="TestStatus" :webMsgSend="webMsgSend"
|
||||
@update:webMsgSend="webMsgSend=$event" @sendPause="sendPause" @sendResume="sendResume" @sendReCheck="sendReCheck"/>
|
||||
|
||||
<template #footer>
|
||||
<div>
|
||||
<!-- <el-button @click="handleCancel">取 消</el-button> -->
|
||||
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < 2 && ActiveStatue != 'success'" :disabled="skipDisabled"
|
||||
@click="nextStep">跳过
|
||||
<el-button type="primary" :icon="DArrowRight" v-if="stepsActiveIndex < stepsTotalNum && ActiveStatue != 'success'" @click="nextStep">跳过
|
||||
</el-button>
|
||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit" :disabled="btnState">开始检测</el-button>
|
||||
<el-button type="primary" v-if="TestStatus === 'process'" @click="handleSubmit" disabled>
|
||||
<el-button type="primary" v-if="ActiveStatue === 'process'" @click="handleSubmit" disabled>
|
||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
@@ -61,108 +57,27 @@
|
||||
</template>
|
||||
|
||||
<script lang="tsx" setup name="testPopup">
|
||||
import {h, reactive, ref, watch} from 'vue';
|
||||
import {reactive, ref, watch} from 'vue';
|
||||
import {ElMessage, ElMessageBox} from 'element-plus'
|
||||
//import IndicatorTypeDialog from "@/views/machine/errorSystem/components/IndicatorTypeDialog.vue"; // 导入子组件
|
||||
import {
|
||||
Close,
|
||||
Coin,
|
||||
DArrowRight,
|
||||
Edit,
|
||||
Key,
|
||||
Odometer,
|
||||
Refresh,
|
||||
Right,
|
||||
SuccessFilled,
|
||||
UploadFilled,
|
||||
VideoPlay,
|
||||
RefreshLeft, Loading
|
||||
} from '@element-plus/icons-vue'
|
||||
import {Coin, DArrowRight, Edit, Key, Odometer, Refresh, RefreshLeft, Right, SuccessFilled, UploadFilled, VideoPlay} from '@element-plus/icons-vue'
|
||||
import preTest from './preTest.vue'
|
||||
import timeTest from './timeTest.vue'
|
||||
import factorTest from './factorTest.vue'
|
||||
import test from './test.vue'
|
||||
import {Device} from '@/api/device/interface/device';
|
||||
import socketClient from '@/utils/webSocketClient';
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {startPreTest, pauseTest, resumeTest} from '@/api/socket/socket'
|
||||
import {showFullScreenLoading} from "@/components/Loading/fullScreen";
|
||||
import {pauseTest, startPreTest} from '@/api/socket/socket'
|
||||
|
||||
|
||||
//import SvgIcon from '@/components/SvgIcon.vue';
|
||||
|
||||
// import preTestIcon from '@/assets/icons/preTest.svg'
|
||||
|
||||
// const preTestIcon = `
|
||||
// <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="w-6 h-6">
|
||||
// </svg>
|
||||
// `;
|
||||
// const props = defineProps<{
|
||||
// visible: boolean;
|
||||
// dialogTitle: string;
|
||||
|
||||
// formData: {
|
||||
// id: string;//误差体系表Id
|
||||
// name: string;//误差体系名称
|
||||
// standard_Name:string;//参照标准名称
|
||||
// standard_Time:string;//标准推行时间
|
||||
// dev_Level:string;//使用设备等级
|
||||
// enable:number;//状态:0-不启用 1-启用
|
||||
// state:number;//0-删除 1-正常
|
||||
// };
|
||||
// }>();
|
||||
|
||||
// const emit = defineEmits<{
|
||||
// (e: 'update:visible', value: boolean): void;
|
||||
// (e: 'submit', data: any): void;
|
||||
// }>();
|
||||
const btnState = ref(false)
|
||||
const checkStore = useCheckStore();
|
||||
const skipDisabled = ref(false);
|
||||
const nextStepText = ref('下一步');
|
||||
const dialogVisible = ref(false)
|
||||
//定义与预检测配置数组
|
||||
const detectionOptions = ref([
|
||||
{
|
||||
id: 0,
|
||||
name: "源通讯检测",//判断源通讯是否正常
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
id: 1,
|
||||
name: "设备通讯检测",//判断设备的IP、Port、识别码、秘钥是否正常
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
name: "协议校验",//ICD报告触发测试
|
||||
selected: true,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
name: "相序校验",//判断装置的接线是否正确
|
||||
selected: true,
|
||||
},
|
||||
// {
|
||||
// id: 4,
|
||||
// name: "守时校验",//判断装置24小时内的守时误差是否小于1s
|
||||
// selected: true,
|
||||
// },
|
||||
// {
|
||||
// id: 5,
|
||||
// name: "通道系数校准",//通过私有协议与装置进行通讯,校准三相电压电流的通道系数
|
||||
// selected: true,
|
||||
// },
|
||||
// {
|
||||
// id: 6,
|
||||
// name: "实时数据比对",
|
||||
// },
|
||||
// {
|
||||
// id: 7,
|
||||
// name: "录波数据比对",
|
||||
// },
|
||||
]);
|
||||
|
||||
const stepsTotalNum = ref(4);//步骤总数
|
||||
const stepsActiveIndex = ref(0); //当前正在执行的步骤索引
|
||||
const stepsTotalNum = ref(-1);//步骤总数
|
||||
const stepsActiveIndex = ref(1); //当前正在执行的步骤索引
|
||||
const stepsActiveView = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,仅用于页面显示
|
||||
const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态
|
||||
const ActiveStatue = ref('waiting');//当前步骤状态
|
||||
const preTestStatus = ref('waiting');//预检测执行状态
|
||||
const timeTestStatus = ref('waiting');//守时校验执行状态
|
||||
@@ -170,50 +85,86 @@ const channelsTestStatus = ref('waiting');//通道系数校准执行状态
|
||||
const TestStatus = ref('waiting');//正式检测执行状态
|
||||
const webMsgSend = ref();//webSocket推送的数据
|
||||
|
||||
const dialogTitle = ref('');
|
||||
const isTimeCheck = ref(false)
|
||||
const preTestRef = ref(null);
|
||||
|
||||
|
||||
// const devIdArr = ref([])
|
||||
// const planId = ref('')
|
||||
const dialogTitle = ref('')
|
||||
const showComponent = ref(true)
|
||||
const preTestRef = ref(null)
|
||||
|
||||
const dataSocket = reactive({
|
||||
socketServe: socketClient.Instance,
|
||||
});
|
||||
// 打开弹窗,可能是新增,也可能是编辑
|
||||
const open = (selection: Device.ResPqDev[], title: string, time: boolean) => {
|
||||
|
||||
// 勾选的检测内容
|
||||
const preTestSelected = ref(false)
|
||||
const timeTestSelected = ref(false)
|
||||
const channelsTestSelected = ref(false)
|
||||
const testSelected = ref(false)
|
||||
|
||||
const checkStates = selection.map(item => item.checkState);
|
||||
// devIdArr.value = selection.map(item => item.id);
|
||||
// planId.value =selection[0].planId
|
||||
// console.log('wwwwwwwwwwwwwwwww',selection)
|
||||
const initOperate = () => {
|
||||
showComponent.value = true
|
||||
// 初始化勾选的检测内容
|
||||
preTestSelected.value = checkStore.selectTestItems.preTest
|
||||
timeTestSelected.value = checkStore.selectTestItems.timeTest
|
||||
channelsTestSelected.value = checkStore.selectTestItems.channelsTest
|
||||
testSelected.value = checkStore.selectTestItems.test
|
||||
|
||||
const allCheckStatesEqual = new Set(checkStates).size <= 1;
|
||||
let count = 0
|
||||
for (let key in checkStore.selectTestItems) {
|
||||
if (checkStore.selectTestItems[key]) {
|
||||
count++
|
||||
}
|
||||
}
|
||||
stepsTotalNum.value = count + 1
|
||||
|
||||
if (!allCheckStatesEqual) {
|
||||
ElMessageBox.confirm(
|
||||
'所勾选设备检测状态不一致,请重新选择',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
if (preTestSelected.value) {
|
||||
stepsActiveView.value = 1
|
||||
stepsActive.value = 1
|
||||
return
|
||||
}
|
||||
if (timeTestSelected.value) {
|
||||
stepsActiveView.value = 2
|
||||
stepsActive.value = 2
|
||||
return
|
||||
}
|
||||
if (channelsTestSelected.value) {
|
||||
stepsActiveView.value = 3
|
||||
stepsActive.value = 3
|
||||
return
|
||||
}
|
||||
if (testSelected.value) {
|
||||
stepsActiveView.value = 4
|
||||
stepsActive.value = 4
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
const open = (selection: Device.ResPqDev[], 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;
|
||||
isTimeCheck.value = time
|
||||
|
||||
if (preTestRef.value) {
|
||||
preTestRef.value.initializeParameters();
|
||||
}
|
||||
|
||||
preTestStatus.value = 'waiting';//预检测执行状态
|
||||
ActiveStatue.value = 'waiting'
|
||||
preTestStatus.value = 'waiting'
|
||||
//开始创建webSocket客户端
|
||||
|
||||
socketClient.Instance.connect();
|
||||
@@ -222,43 +173,30 @@ const open = (selection: Device.ResPqDev[], title: string, time: boolean) => {
|
||||
// 处理来自服务器的消息
|
||||
// console.log('Received message:', res);
|
||||
// 根据需要在这里添加更多的处理逻辑
|
||||
|
||||
if (res.code === 20000) {
|
||||
ElMessage.error(message.message)
|
||||
loading.close()
|
||||
//ElMessage.error(message.message)
|
||||
// loading.close()
|
||||
} else {
|
||||
webMsgSend.value = res
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
let loading;
|
||||
// let loading;
|
||||
const handleSubmit = () => {
|
||||
skipDisabled.value = true
|
||||
//btnState.value = true
|
||||
console.log('=============', stepsActiveIndex.value)
|
||||
|
||||
let deviceIds = checkStore.devices.map((item) => item.deviceId)
|
||||
let planId = checkStore.planId
|
||||
let planId = checkStore.plan.id
|
||||
|
||||
|
||||
if(!dataSocket.socketServe.connected){
|
||||
if (!dataSocket.socketServe.connected) {
|
||||
ElMessage.error('webSocket连接中断!')
|
||||
return
|
||||
}
|
||||
|
||||
switch (stepsActiveIndex.value) {
|
||||
case 0:
|
||||
// preTestStatus.value = 'start'
|
||||
|
||||
switch (stepsActive.value) {
|
||||
case 1:
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: deviceIds,
|
||||
@@ -275,35 +213,29 @@ const handleSubmit = () => {
|
||||
})
|
||||
preTestStatus.value = 'start'
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
timeTestStatus.value = 'start'
|
||||
break;
|
||||
// case 2:
|
||||
// channelsTestStatus.value = 'start'
|
||||
// break;
|
||||
case 2:
|
||||
case 3:
|
||||
channelsTestStatus.value = 'start'
|
||||
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'
|
||||
}
|
||||
/* if (res.code === 20000) {
|
||||
TestStatus.value = 'start'
|
||||
webMsgSend.value = ''
|
||||
} else {
|
||||
ElMessage.error(res.message)
|
||||
}*/
|
||||
})
|
||||
// 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') {
|
||||
// 发送继续指令
|
||||
@@ -311,20 +243,15 @@ const handleSubmit = () => {
|
||||
} else if (TestStatus.value == 'test_recheck') {
|
||||
// 发送重新检测指令
|
||||
sendReCheck()
|
||||
|
||||
|
||||
}else if (TestStatus.value == 'success') {
|
||||
emit('quitClicked'); // 触发事件
|
||||
} else if (TestStatus.value == 'success') {
|
||||
handleClose()
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'quitClicked'): void;
|
||||
}>();
|
||||
@@ -351,34 +278,24 @@ watch(TestStatus, function (newValue, oldValue) {
|
||||
})
|
||||
|
||||
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 === 'error' && stepsActiveIndex.value === stepsTotalNum.value - 3) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
if (newValue === 'error' && stepsActive.value === 1) {
|
||||
stepsActiveIndex.value = stepsTotalNum.value + 2
|
||||
nextStepText.value = '检测失败'
|
||||
}
|
||||
if (newValue === 'test_init_fail' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
if (newValue === 'success' && stepsActive.value === 4) {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '检测完成'
|
||||
}
|
||||
if (newValue === 'test_init_fail' && stepsActive.value === 4) {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '初始化失败'
|
||||
}
|
||||
if (newValue === 'connect_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
if (newValue === 'connect_timeout' && stepsActive.value === 4) {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '连接超时'
|
||||
}
|
||||
if (newValue === 'pause_timeout' && stepsActiveIndex.value === stepsTotalNum.value - 2) {
|
||||
stepsActiveIndex.value++;
|
||||
stepsActiveIndex.value++;
|
||||
if (newValue === 'pause_timeout' && stepsActive.value === 4) {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '结束测试'
|
||||
}
|
||||
})
|
||||
@@ -388,133 +305,131 @@ const sendPause = () => {
|
||||
|
||||
TestStatus.value = 'paused_ing'
|
||||
pauseTest()
|
||||
setTimeout(() => {
|
||||
Object.assign(webMsgSend.value, {
|
||||
requestId: 'preStopTest',
|
||||
operateCode: 'stop'
|
||||
})
|
||||
}, 5000)
|
||||
}
|
||||
const sendResume = () => {
|
||||
console.log('发起继续检测请求')
|
||||
|
||||
resumeTest({
|
||||
userPageId: "cdf",
|
||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||
planId: checkStore.planId,
|
||||
operateType: '2' // '1'为预检测、‘2‘为正式检测
|
||||
}).then(res => {
|
||||
Object.assign(webMsgSend.value, {
|
||||
requestId: 'Resume_Success'
|
||||
})
|
||||
// resumeTest({
|
||||
// userPageId: "cdf",
|
||||
// devIds: checkStore.devices.map((item) => item.deviceId),
|
||||
// planId: checkStore.plan.id,
|
||||
// operateType: '2' // '1'为预检测、‘2‘为正式检测
|
||||
// }).then(res => {
|
||||
// Object.assign(webMsgSend.value, {
|
||||
// requestId: 'Resume_Success'
|
||||
// })
|
||||
// })
|
||||
Object.assign(webMsgSend.value, {
|
||||
requestId: 'Resume_Success'
|
||||
})
|
||||
}
|
||||
|
||||
const sendReCheck = () => {
|
||||
console.log('发送重新检测指令')
|
||||
startPreTest({
|
||||
userPageId: "cdf",
|
||||
devIds: checkStore.devices.map((item) => item.deviceId),
|
||||
planId: checkStore.planId,
|
||||
operateType: '2' // 0:'系数校验','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: checkStore.devices.map((item) => item.deviceId),
|
||||
// planId: checkStore.plan.id,
|
||||
// operateType: '2' // 0:'系数校验','1'为预检测、‘2‘为正式检测
|
||||
// }).then(res => {
|
||||
// console.log(res)
|
||||
// if (res.code === 'A001014') {
|
||||
// ElMessageBox.alert('装置配置异常', '初始化失败', {
|
||||
// confirmButtonText: '确定',
|
||||
// type: 'error',
|
||||
// })
|
||||
// TestStatus.value = 'test_init_fail'
|
||||
// }
|
||||
// })
|
||||
TestStatus.value = 'start'
|
||||
}
|
||||
|
||||
const getIcon = (index: number) => {
|
||||
if (stepsActiveIndex.value > index) return SuccessFilled;
|
||||
switch (index) {
|
||||
case 0:
|
||||
return h(<svg-icon name="preTest"></svg-icon>);
|
||||
case 1:
|
||||
return UploadFilled;
|
||||
case 2:
|
||||
return Odometer;
|
||||
case 3:
|
||||
return Coin;
|
||||
case 4:
|
||||
return Key;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const nextStep = () => {
|
||||
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||
stepsActiveIndex.value++
|
||||
if (!isTimeCheck.value) {//不具备守时检测,预检测后直接跳正式检测
|
||||
stepsActiveIndex.value++
|
||||
}
|
||||
|
||||
ActiveStatue.value = 'waiting'
|
||||
} else if (stepsActiveIndex.value === stepsTotalNum.value || ActiveStatue.value === 'error') {
|
||||
//emit('update:visible', false); // 关闭对话框
|
||||
clearData()
|
||||
dialogVisible.value = false;
|
||||
if (stepsActiveIndex.value == stepsTotalNum.value + 1 || ActiveStatue.value === 'error') {
|
||||
handleClose()
|
||||
return
|
||||
}
|
||||
};
|
||||
if (ActiveStatue.value != 'error') {
|
||||
ActiveStatue.value = 'waiting'
|
||||
let tempStep = stepsActiveIndex.value
|
||||
let idx = 1
|
||||
stepsActiveIndex.value++
|
||||
for (let selectTestItemsKey in checkStore.selectTestItems) {
|
||||
if (tempStep == 0 && checkStore.selectTestItems[selectTestItemsKey]) {
|
||||
stepsActiveView.value = idx
|
||||
stepsActive.value = idx
|
||||
return
|
||||
}
|
||||
if (checkStore.selectTestItems[selectTestItemsKey] && tempStep != 0) {
|
||||
tempStep--
|
||||
}
|
||||
idx++
|
||||
}
|
||||
}
|
||||
|
||||
// if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||
// stepsActiveIndex.value++
|
||||
// if (!checkStore.selectTestItems.timeTest) { // 不具备守时检测
|
||||
// stepsActiveIndex.value++
|
||||
// }
|
||||
//
|
||||
// ActiveStatue.value = 'waiting'
|
||||
// } else if (stepsActiveIndex.value === stepsTotalNum.value || ActiveStatue.value === 'error') {
|
||||
// //emit('update:visible', false); // 关闭对话框
|
||||
// clearData()
|
||||
// dialogVisible.value = false;
|
||||
// }
|
||||
}
|
||||
|
||||
const handleStepClick = (step: number) => {
|
||||
if (step > stepsActive.value) {
|
||||
return
|
||||
} else {
|
||||
stepsActiveView.value = step
|
||||
}
|
||||
}
|
||||
|
||||
function clearData() {
|
||||
stepsActiveIndex.value = 0;
|
||||
stepsTotalNum.value = -1
|
||||
stepsActiveIndex.value = 1
|
||||
stepsActiveView.value = -1
|
||||
preTestStatus.value = "waiting"
|
||||
timeTestStatus.value = "waiting"
|
||||
channelsTestStatus.value = "waiting"
|
||||
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) {
|
||||
ElMessageBox.confirm(
|
||||
'检测未完成,是否退出当前检测流程?',
|
||||
'提示',
|
||||
{
|
||||
ElMessageBox.confirm('检测未完成,是否退出当前检测流程?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
clearData()
|
||||
// todo 关闭弹窗,终止整个检测流程
|
||||
//emit('update:visible', false); // 关闭对话框
|
||||
dialogVisible.value = false;
|
||||
})
|
||||
).then(() => {
|
||||
handleClose()
|
||||
})
|
||||
} else {
|
||||
clearData()
|
||||
//emit('update:visible', false); // 关闭对话框
|
||||
dialogVisible.value = false;
|
||||
handleClose()
|
||||
}
|
||||
// ElMessageBox.confirm('Are you sure to close this dialog?')
|
||||
// .then(() => {
|
||||
// done()
|
||||
// })
|
||||
// .catch(() => {
|
||||
// // catch error
|
||||
// })
|
||||
}
|
||||
const handleCancel = () => {
|
||||
|
||||
const handleClose = () => {
|
||||
dataSocket.socketServe.closeWs()
|
||||
dialogVisible.value = false;
|
||||
clearData()
|
||||
showComponent.value = false;
|
||||
|
||||
emit('quitClicked'); // 触发事件
|
||||
// clearData()
|
||||
// emit('update:visible', false); // 关闭对话框
|
||||
};
|
||||
|
||||
|
||||
// // 当 props.visible 改变时,更新 formData
|
||||
// watch(() => props.visible, (newVal) => {
|
||||
// if (!newVal) {
|
||||
// // 这里可以重置表单数据,如果需要的话
|
||||
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
// 对外映射
|
||||
defineExpose({open})
|
||||
@@ -526,13 +441,6 @@ defineExpose({open})
|
||||
max-height: 840px !important;
|
||||
}
|
||||
|
||||
// :deep(.dialog-big){
|
||||
// max-height: 840px !important;
|
||||
// }
|
||||
// :deep(.el-dialog__body){
|
||||
// max-height: 840px !important;
|
||||
// }
|
||||
|
||||
.steps-container :deep(.test-head-steps) {
|
||||
height: 80px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
Reference in New Issue
Block a user