diff --git a/src/components/SealTest.vue b/src/components/SealTest.vue index fcab8fc..ec9828a 100644 --- a/src/components/SealTest.vue +++ b/src/components/SealTest.vue @@ -80,7 +80,7 @@ + + diff --git a/src/pages/Home.vue b/src/pages/Home.vue index bb79af2..26ef2cf 100644 --- a/src/pages/Home.vue +++ b/src/pages/Home.vue @@ -352,6 +352,13 @@ v-if="loginModalVisible" :hideLoginModal="hideLoginModal" /> + @@ -364,6 +371,7 @@ import Formula from 'cpns/Formula' import Operator from 'cpns/Operator' import Audit from 'cpns/Audit' import SealTest from 'cpns/SealTest' +import LeaveModal from 'cpns/dialogs/LeaveModal' import DisinfectionSetting from 'cpns/DisinfectionSetting' import Progress from 'cpns/Progress' import LiquidHandle from 'cpns/LiquidHandle' @@ -375,6 +383,7 @@ import { useWebSocketStore, useSettingStore, useUserStore, + useSealStore, } from '@/store' import { logoutJSON, @@ -389,6 +398,7 @@ import { useRouter } from 'vue-router' const router = useRouter() const webSocketStore = useWebSocketStore() const settingStore = useSettingStore() +const sealStore = useSealStore() const userStore = useUserStore() const { socketCommandInstance } = storeToRefs(webSocketStore) webSocketStore.initCommandSocket() @@ -426,7 +436,13 @@ const onChange = a => { input.value = a } -const changeTab = index => { +const leaveModalVisible = ref(false) + +const hiddenLeaveModal = () => { + leaveModalVisible.value = false +} + +const changeTabReal = index => { if (index == 5) { // 判断是否为管理员登陆 如果为管理员直接显示, webSocketStore.sendCommandMsg(getDisinfectionConfigJSON) @@ -445,6 +461,19 @@ const changeTab = index => { } } +const clickType = ref(-1) + +const changeTab = index => { + // 判断如果tab不是密封测试 且 当前已经开始测试则需要弹窗提醒 以便关闭阀门 + if (index != 8 && sealStore.isStartTest) { + // show modal 和 点击注销按钮同逻辑 + clickType.value = index + leaveModalVisible.value = true + return + } + changeTabReal(index) +} + const getdateTime = () => { nowTime.value = moment().utcOffset(8).format('YYYY-MM-DD HH:mm:ss') } @@ -472,6 +501,15 @@ onBeforeUnmount(() => { }) const handleLogout = () => { + if (sealStore.isStartTest) { + // show modal 和 点击注销按钮同逻辑 + leaveModalVisible.value = true + clickType.value = -2 + return + } + handleLogoutReal() +} +const handleLogoutReal = () => { webSocketStore?.sendCommandMsg(logoutJSON) window.location.href = 'http://127.0.0.1/#/' }