微调
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="handleClose">取消</el-button>
|
||||
<el-button type="primary" @click="handleStart">开始测试</el-button>
|
||||
<el-button type="primary" @click="handleStart">确定</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
@@ -1040,7 +1040,7 @@ const handleTest = async (val: string) => {
|
||||
}
|
||||
|
||||
const openTestDialog = () => {
|
||||
testPopup.value?.open(channelsSelection.value, dialogTitle.value)
|
||||
testPopup.value?.open(dialogTitle.value)
|
||||
}
|
||||
|
||||
// 打开 drawer(新增、查看、编辑)
|
||||
|
||||
@@ -21,13 +21,21 @@
|
||||
<template #footer>
|
||||
<div>
|
||||
<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="ActiveStatue === 'process'" @click="handleSubmit" disabled>
|
||||
<el-button type="primary" :icon="VideoPlay" v-if="ActiveStatue === 'waiting'" @click="handleSubmit">开始检测</el-button>
|
||||
<el-button type="primary"
|
||||
v-if="ActiveStatue !== 'waiting' && ActiveStatue !== 'error' && ActiveStatue !== 'test_init_fail' && ActiveStatue !== 'connect_timeout' && ActiveStatue!=='pause_timeout'"
|
||||
disabled>
|
||||
<el-icon class="loading-box" style="color: #fff;margin-right: 8px;">
|
||||
<component :is="Refresh"/>
|
||||
</el-icon>
|
||||
检测中
|
||||
</el-button>
|
||||
<!-- <el-button type="primary" v-if="ActiveStatue === 'process'" disabled>-->
|
||||
<!-- <el-icon class="loading-box" style="color: #fff;margin-right: 8px;">-->
|
||||
<!-- <component :is="Refresh"/>-->
|
||||
<!-- </el-icon>-->
|
||||
<!-- 检测中-->
|
||||
<!-- </el-button>-->
|
||||
<el-button type="warning" :icon="VideoPlay" v-if="TestStatus === 'paused'" @click="handleSubmit">继续检测</el-button>
|
||||
<el-button type="primary" :icon="RefreshLeft" v-if="TestStatus === 'test_recheck'" @click="handleSubmit">重新检测</el-button>
|
||||
<el-button type="primary" v-if="TestStatus === 'test_init'" disabled>
|
||||
@@ -43,7 +51,7 @@
|
||||
暂停中
|
||||
</el-button>
|
||||
<el-button :type="ActiveStatue==='success'?'primary':'danger'" :icon="Right"
|
||||
v-if="ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout'"
|
||||
v-if="nextStepText!== '下一步' && (ActiveStatue === 'success'||ActiveStatue==='error'||ActiveStatue==='test_init_fail'||ActiveStatue==='connect_timeout'||ActiveStatue==='pause_timeout')"
|
||||
@click="nextStep">
|
||||
{{ nextStepText }}
|
||||
</el-button>
|
||||
@@ -67,7 +75,6 @@ import socketClient from '@/utils/webSocketClient';
|
||||
import {useCheckStore} from "@/stores/modules/check";
|
||||
import {pauseTest, startPreTest} from '@/api/socket/socket'
|
||||
|
||||
const btnState = ref(false)
|
||||
const checkStore = useCheckStore();
|
||||
const nextStepText = ref('下一步');
|
||||
const dialogVisible = ref(false)
|
||||
@@ -75,7 +82,7 @@ const dialogVisible = ref(false)
|
||||
const stepsTotalNum = ref(-1);//步骤总数
|
||||
const stepsActiveIndex = ref(1); //当前正在执行的步骤索引
|
||||
const stepsActiveView = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,仅用于页面显示
|
||||
const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态
|
||||
const stepsActive = ref(-1); //当前正在执行的步骤在(预处理、守时校验、系数校准、正式检测)中的排序,实际记录步骤的状态,用于切换步骤
|
||||
const ActiveStatue = ref('waiting');//当前步骤状态
|
||||
const preTestStatus = ref('waiting');//预检测执行状态
|
||||
const timeTestStatus = ref('waiting');//守时校验执行状态
|
||||
@@ -98,6 +105,12 @@ const channelsTestSelected = ref(false)
|
||||
const testSelected = ref(false)
|
||||
|
||||
const initOperate = () => {
|
||||
ActiveStatue.value = 'waiting'
|
||||
preTestStatus.value = 'waiting'
|
||||
timeTestStatus.value = 'waiting'
|
||||
channelsTestStatus.value = 'waiting'
|
||||
TestStatus.value = 'waiting'
|
||||
|
||||
showComponent.value = true
|
||||
// 初始化勾选的检测内容
|
||||
preTestSelected.value = checkStore.selectTestItems.preTest
|
||||
@@ -135,25 +148,9 @@ const initOperate = () => {
|
||||
}
|
||||
}
|
||||
|
||||
const open = (selection: Device.ResPqDev[], title: string) => {
|
||||
const open = (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;
|
||||
|
||||
@@ -161,14 +158,7 @@ const open = (selection: Device.ResPqDev[], title: string) => {
|
||||
preTestRef.value.initializeParameters();
|
||||
}
|
||||
|
||||
ActiveStatue.value = 'waiting'
|
||||
preTestStatus.value = 'waiting'
|
||||
timeTestStatus.value = 'waiting'
|
||||
channelsTestStatus.value = 'waiting'
|
||||
TestStatus.value = 'waiting'
|
||||
|
||||
//开始创建webSocket客户端
|
||||
|
||||
socketClient.Instance.connect();
|
||||
dataSocket.socketServe = socketClient.Instance;
|
||||
dataSocket.socketServe.registerCallBack('aaa', (res) => {
|
||||
@@ -181,8 +171,6 @@ const open = (selection: Device.ResPqDev[], title: string) => {
|
||||
} else {
|
||||
webMsgSend.value = res
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -223,21 +211,21 @@ const handleSubmit = () => {
|
||||
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'
|
||||
// }
|
||||
// })
|
||||
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') {
|
||||
// 发送继续指令
|
||||
@@ -245,9 +233,10 @@ const handleSubmit = () => {
|
||||
} else if (TestStatus.value == 'test_recheck') {
|
||||
// 发送重新检测指令
|
||||
sendReCheck()
|
||||
} else if (TestStatus.value == 'success') {
|
||||
handleClose()
|
||||
}
|
||||
// else if (TestStatus.value == 'success') {
|
||||
// handleClose()
|
||||
// }
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -281,7 +270,7 @@ watch(TestStatus, function (newValue, oldValue) {
|
||||
|
||||
watch(ActiveStatue, function (newValue, oldValue) {
|
||||
if (newValue === 'error' && stepsActive.value === 1) {
|
||||
stepsActiveIndex.value = stepsTotalNum.value + 2
|
||||
// stepsActiveIndex.value = stepsTotalNum.value + 2
|
||||
nextStepText.value = '检测失败'
|
||||
}
|
||||
if (newValue === 'success' && stepsActive.value === 4) {
|
||||
@@ -300,6 +289,10 @@ watch(ActiveStatue, function (newValue, oldValue) {
|
||||
stepsActiveIndex.value += 2
|
||||
nextStepText.value = '结束测试'
|
||||
}
|
||||
if (newValue === 'success' && nextStepText.value === '下一步') {
|
||||
nextStep()
|
||||
handleSubmit()
|
||||
}
|
||||
})
|
||||
|
||||
const sendPause = () => {
|
||||
@@ -410,7 +403,7 @@ function clearData() {
|
||||
}
|
||||
|
||||
const beforeClose = (done: () => void) => {
|
||||
if (stepsActiveIndex.value < stepsTotalNum.value) {
|
||||
if (stepsActiveIndex.value < stepsTotalNum.value && ActiveStatue.value != 'error') {
|
||||
ElMessageBox.confirm('检测未完成,是否退出当前检测流程?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
|
||||
Reference in New Issue
Block a user