From bc6d07419dd0927d2162a7daff789403eabcf36f Mon Sep 17 00:00:00 2001
From: maochaoying <925670706@qq.com>
Date: Thu, 9 Nov 2023 15:23:24 +0800
Subject: [PATCH] =?UTF-8?q?=E7=A6=BB=E5=BC=80=E9=A1=B5=E9=9D=A2=E7=9A=84?=
=?UTF-8?q?=E5=BC=B9=E7=AA=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/SealTest.vue | 44 +++++++---
src/components/dialogs/LeaveModal.vue | 150 ++++++++++++++++++++++++++++++++++
src/pages/Home.vue | 40 ++++++++-
3 files changed, 222 insertions(+), 12 deletions(-)
create mode 100644 src/components/dialogs/LeaveModal.vue
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/#/'
}