diff --git a/src/components/home/Check/index.vue b/src/components/home/Check/index.vue index 7b1de2f..3d60b28 100644 --- a/src/components/home/Check/index.vue +++ b/src/components/home/Check/index.vue @@ -2,6 +2,7 @@ import { deviceSelfTestFinish, getDeviceSelfTest } from 'apis/system' import FtDialog from 'components/common/FTDialog/index.vue' import { ElMessageBox } from 'element-plus' +import { FtMessage } from 'libs/message' import { socket } from 'libs/socket' import { sendControl } from 'libs/utils' import { onMounted, ref, watch } from 'vue' @@ -38,7 +39,7 @@ const receiveMessageSelfMove = (data: any) => { checkTextList.value.push(data) percentage.value = data.schedule if (data.type === 'error') { - selfAgain.value = true + checkStartBtnDisabled.value = false } } const cmdIds: any = {} @@ -89,13 +90,26 @@ const addTextToCheckList = async (text: string, id: number) => { const activeStep = ref(0) const percentage = ref(0) const checkTextList = ref<{ title: string, type: 'success' | 'error' }[]>([]) -const selfAgain = ref(false) +const checkStartBtnDisabled = ref(false) let currentCommandId = '' const checkHandle = async () => { activeStep.value = 1 +} +watch(percentage, (newValue) => { + if (newValue === 100) { + const timer = setTimeout(() => { + FtMessage.success('设备自检已完成') + onClose() + clearTimeout(timer) + }, 1500) + } +}) +const checkAgain = async () => { + checkStartBtnDisabled.value = true + checkTextList.value = [] await ElMessageBox.confirm( - '设备即将开始自检', + '设备即将开始自检,请确认X、Y、Z轴电机行程无异物!', '提示', { confirmButtonText: '确认', @@ -115,39 +129,15 @@ const checkHandle = async () => { } await sendControl(params) } -watch(percentage, (newValue) => { - if (newValue === 100) { - const timer = setTimeout(() => { - selfAgain.value = true - clearTimeout(timer) - }, 300) - } - else { - selfAgain.value = false - } -}) -const checkAgain = async () => { - checkTextList.value = [] - currentCommandId = Date.now().toString() - const params = { - cmdId: currentCommandId, - cmdCode: 'move_test', - params: {}, - } - await sendControl(params) -} const onClose = async () => { await deviceSelfTestFinish() emits('ok') + checkStartBtnDisabled.value = false } diff --git a/src/views/main/index.vue b/src/views/main/index.vue index ddd27d6..fc740a5 100644 --- a/src/views/main/index.vue +++ b/src/views/main/index.vue @@ -26,7 +26,7 @@ const getStatus = async () => { await getDeviceStatus().then((res: any) => { systemStore.updateSystemStatus(res) if (!systemStore.systemStatus.selfTestCompleted && import.meta.env.FT_NODE_ENV !== 'test') { - ElMessageBox.confirm('检测到您还未完成自检,是否开始自检?', '提示', { + ElMessageBox.confirm('检测到设备未完成初始化及自检,是否开始?', '提示', { type: 'warning', confirmButtonText: '确定', showCancelButton: false, @@ -221,7 +221,7 @@ const nozzleSwitch = async () => { }) } else { - FtMessage.warning('喷头加热已经关闭') + FtMessage.warning('喷头加热已关闭') } }