|
|
@ -78,12 +78,18 @@ |
|
|
|
|
|
|
|
<!-- 底部操作信息 --> |
|
|
|
<el-footer class="footer-info"> |
|
|
|
<el-dropdown placement="top-start"> |
|
|
|
<div class="user-card"> |
|
|
|
<img class="user-logo" src="@/assets/Index/user.svg" /> |
|
|
|
<div class="user-name">{{ username || '未登录' }}</div> |
|
|
|
<!-- <el-dropdown placement="top-start"> --> |
|
|
|
<div class="user-card" @click="onClickLoginUser"> |
|
|
|
<img class="user-logo" src="@/assets/Index/user.svg" /> |
|
|
|
<div class="user-name"> |
|
|
|
{{ |
|
|
|
deviceStore.contextState.loginFlag |
|
|
|
? deviceStore.contextState.loginUser.account |
|
|
|
: '未登录' |
|
|
|
}} |
|
|
|
</div> |
|
|
|
<template #dropdown> |
|
|
|
</div> |
|
|
|
<!-- <template #dropdown> |
|
|
|
<el-dropdown-menu> |
|
|
|
<el-dropdown-item> |
|
|
|
<img |
|
|
@ -92,12 +98,12 @@ |
|
|
|
height="30" |
|
|
|
/> |
|
|
|
<button class="logout" style="width: 100px" @click="onLogout"> |
|
|
|
注销 |
|
|
|
退出 |
|
|
|
</button> |
|
|
|
</el-dropdown-item> |
|
|
|
</el-dropdown-menu> |
|
|
|
</template> |
|
|
|
</el-dropdown> |
|
|
|
</el-dropdown> --> |
|
|
|
|
|
|
|
<div class="equipment-status" @click="showRecentMsgDialog = true"> |
|
|
|
<div |
|
|
@ -291,8 +297,8 @@ |
|
|
|
</template> |
|
|
|
<script setup lang="ts"> |
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
import { ref, onMounted, computed } from 'vue' |
|
|
|
import { ElDialog } from 'element-plus' |
|
|
|
import { ref, onMounted, computed, watch } from 'vue' |
|
|
|
import { ElDialog, ElMessageBox } from 'element-plus' |
|
|
|
import { Time, InitWarn, LoadingModal } from './components/Consumables' |
|
|
|
import { |
|
|
|
startWork, |
|
|
@ -308,7 +314,7 @@ import { |
|
|
|
getBloodTypes, |
|
|
|
confirmPromptInfo, |
|
|
|
} from '../../services/index' |
|
|
|
import { User } from '../../types/Index' |
|
|
|
|
|
|
|
import { |
|
|
|
useConsumablesStore, |
|
|
|
useDeviceStore, |
|
|
@ -320,6 +326,7 @@ import { createWebSocket } from '../../websocket/socket' |
|
|
|
import type { |
|
|
|
AppEventMessage, |
|
|
|
ConsumablesStateMessage, |
|
|
|
DeviceContextStateMessage, |
|
|
|
DeviceWorkStateMessage, |
|
|
|
EmergencyPosStateMessage, |
|
|
|
EventReport, |
|
|
@ -354,12 +361,6 @@ const settingTubeStore = useSettingTestTubeStore() |
|
|
|
const tubeRackStore = useTestTubeStore() |
|
|
|
const emergencyStore = useEmergencyStore() |
|
|
|
|
|
|
|
// 新增的变量 |
|
|
|
const user = ref<User>( |
|
|
|
JSON.parse(sessionStorage.getItem('token') || '{}') as unknown as User, |
|
|
|
) |
|
|
|
|
|
|
|
const username = ref<string>(user.value.account) |
|
|
|
const failMessage = ref('') // 存储动态生成的错误信息 |
|
|
|
const idCardInserted = ref(false) // id卡插入状态 |
|
|
|
//事件状态 |
|
|
@ -371,6 +372,15 @@ const WarnMessage = ref<string>('') |
|
|
|
|
|
|
|
const showRecentMsgDialog = ref(false) |
|
|
|
|
|
|
|
const onClickLoginUser = () => { |
|
|
|
ElMessageBox.confirm('是否退出登录?') |
|
|
|
.then(() => { |
|
|
|
onLogout() |
|
|
|
}) |
|
|
|
.catch(() => { |
|
|
|
// catch error |
|
|
|
}) |
|
|
|
} |
|
|
|
// WebSocket 实例 |
|
|
|
const eventUrl = getServerInfo('/api/v1/app/ws/event') |
|
|
|
const wsEvent = createWebSocket(eventUrl.wsUrl) |
|
|
@ -452,6 +462,9 @@ const showInitDeviceAlert = () => { |
|
|
|
const handleDeviceState = (data: DeviceWorkStateMessage['data']) => { |
|
|
|
deviceStore.setDeviceState(data) |
|
|
|
} |
|
|
|
const handleDeviceContextState = (data: DeviceContextStateMessage['data']) => { |
|
|
|
deviceStore.setContextState(data) |
|
|
|
} |
|
|
|
const handleSensorState = (data: SensorStateMessage['data']) => { |
|
|
|
deviceStore.setSensorState(data) |
|
|
|
} |
|
|
@ -512,6 +525,10 @@ onMounted(() => { |
|
|
|
'DeviceWorkState', |
|
|
|
handleDeviceState, |
|
|
|
) |
|
|
|
wsState.subscribe<DeviceContextStateMessage>( |
|
|
|
'DeviceContext', |
|
|
|
handleDeviceContextState, |
|
|
|
) |
|
|
|
wsState.subscribe<SensorStateMessage>('SensorState', handleSensorState) |
|
|
|
wsState.subscribe<FooterMessageState>('MessageBoxState', handleFooterState) |
|
|
|
wsState.subscribe<TubeHolderStateMessage>( |
|
|
@ -701,6 +718,18 @@ onMounted(() => { |
|
|
|
updateLinePosition(defaultTab) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
watch( |
|
|
|
() => deviceStore.contextState, |
|
|
|
(newVal) => { |
|
|
|
if (!newVal.loginFlag) { |
|
|
|
router.push({ |
|
|
|
path: '/login', |
|
|
|
}) |
|
|
|
sessionStorage.setItem('token', '') |
|
|
|
} |
|
|
|
}, |
|
|
|
) |
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped lang="less"> |
|
|
|