|
|
@ -52,7 +52,7 @@ |
|
|
|
</div> |
|
|
|
<div class="project-list"> |
|
|
|
|
|
|
|
<div v-for="(item, index) in projects" :key="index" @click="selectProject(item)" :class="[ |
|
|
|
<div v-for="(item, index) in projects" :style="`background:${item.color}`" :key="index" @click="selectProject(item)" :class="[ |
|
|
|
isEmergencyEnabled ? 'project-item' : 'disabled-project-item', |
|
|
|
{ 'active-project-item': emergencyPosition.projIds.includes(item.projId) && isEmergencyEnabled }, |
|
|
|
]"> |
|
|
@ -111,12 +111,12 @@ |
|
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import { ref, onMounted, onUnmounted, onActivated, onDeactivated, watch } from 'vue'; |
|
|
|
import { useRouter, useRoute } from 'vue-router' |
|
|
|
import { ref, onMounted, onUnmounted, onActivated, watch } from 'vue'; |
|
|
|
import { useRouter } from 'vue-router' |
|
|
|
import { nanoid } from 'nanoid'; |
|
|
|
import { insertEmergency } from '@/services/Index/index'; |
|
|
|
import { useEmergencyStore, useConsumablesStore } from '@/store'; |
|
|
|
import type { ReactionPlate, AddEmergencyInfo } from '@/types/Index'; |
|
|
|
import { useEmergencyStore, useConsumablesStore, useDeviceStore } from '@/store'; |
|
|
|
import type { AddEmergencyInfo } from '@/types/Index'; |
|
|
|
import type { EmergencyPosStateMessage, TubeHolderStateMessage } from '@/websocket/socket'; |
|
|
|
import { ElMessage } from 'element-plus'; |
|
|
|
import { createWebSocket } from '@/websocket/socket'; |
|
|
@ -124,27 +124,13 @@ import { getServerInfo } from '@/utils/getServerInfo'; |
|
|
|
const ws = createWebSocket(getServerInfo().wsUrl); |
|
|
|
const consumableStore = useConsumablesStore(); |
|
|
|
const emergencyStore = useEmergencyStore(); |
|
|
|
// const deviceStore = useDeviceStore(); |
|
|
|
const deviceStore = useDeviceStore(); |
|
|
|
// 急诊位开启/关闭状态 |
|
|
|
const isEmergencyEnabled = ref(true);//设置表单是否可输入 |
|
|
|
|
|
|
|
// 模拟项目列表数据 |
|
|
|
const projects = ref<ReactionPlate[]>([]); |
|
|
|
const projects:any = ref(consumableStore.projectsAvailable); |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
// 延迟加载 projects,确保数据从持久化存储中加载完成 |
|
|
|
loadProject() |
|
|
|
}) |
|
|
|
|
|
|
|
const loadProject = ()=>{ |
|
|
|
//@ts-ignore |
|
|
|
if (consumableStore.consumableData.reactionPlateGroup && consumableStore.consumableData.reactionPlateGroup.length > 0) { |
|
|
|
projects.value = consumableStore.consumableData.reactionPlateGroup as ReactionPlate[]; |
|
|
|
} |
|
|
|
console.log('projects.value---', projects.value) |
|
|
|
//过滤projId为null的数据 |
|
|
|
projects.value = projects.value.filter(item => item.projId) |
|
|
|
} |
|
|
|
|
|
|
|
const bloodTypes = ref([ |
|
|
|
{ |
|
|
@ -225,12 +211,6 @@ const goBack = () => { |
|
|
|
router.go(-1); |
|
|
|
}; |
|
|
|
|
|
|
|
const route = useRoute() |
|
|
|
watch(route, (value)=>{ |
|
|
|
console.log('value==route=', value) |
|
|
|
loadProject() |
|
|
|
}) |
|
|
|
|
|
|
|
// 取消和确认事件 |
|
|
|
const cancelHandle = () => { |
|
|
|
router.push('/index/regular/consumables'); |
|
|
@ -241,20 +221,12 @@ const getProjectInfo = (projIds: number[]) => { |
|
|
|
} |
|
|
|
// 确认请求 |
|
|
|
const confirmHandle = async () => { |
|
|
|
//只有设备暂停状态才能添加急诊 |
|
|
|
// if (deviceStore.status !== 'PAUSE') { |
|
|
|
// ElMessage.error('设备未暂停,无法添加急诊'); |
|
|
|
// return |
|
|
|
// } |
|
|
|
//设备运行状态不能添加急诊 |
|
|
|
if (deviceStore.deviceState.workState === 'WORKING') { |
|
|
|
ElMessage.error('设备未暂停,无法添加急诊'); |
|
|
|
return |
|
|
|
} |
|
|
|
const emergencyInfo = emergencyPosition.value; |
|
|
|
// if(!emergencyInfo.sampleBarcode){ |
|
|
|
// ElMessage.error('请输入样本条形码'); |
|
|
|
// return |
|
|
|
// } |
|
|
|
// if(!emergencyInfo.userid){ |
|
|
|
// ElMessage.error('请输入用户ID'); |
|
|
|
// return |
|
|
|
// } |
|
|
|
if (emergencyInfo.projIds.length === 0) { |
|
|
|
ElMessage.error('请选择项目'); |
|
|
|
return |
|
|
|