|
|
@ -55,7 +55,7 @@ |
|
|
|
</div> |
|
|
|
<div class="move-liquid-area"> |
|
|
|
<MoveLiquidArea |
|
|
|
:isLoad="isLoad" |
|
|
|
:isLoad="isLoadedConsumables" |
|
|
|
:isLoading="isLoading" |
|
|
|
:moveLiquids="moveLiquids" |
|
|
|
:tempTipNum="tempTipNum" |
|
|
@ -99,6 +99,7 @@ import { MoveLiquidArea, SpttingPlates, MainComponent } from '../Components' |
|
|
|
// import SliderAreaEx from '../components/Consumables/SliderAreaEx.vue'; |
|
|
|
// import DragAreaEx from '../components/Consumables/DragAreaEx.vue'; |
|
|
|
import { ref, onMounted, onActivated, onBeforeUnmount, watch } from 'vue' |
|
|
|
import * as R from 'ramda' |
|
|
|
import { |
|
|
|
getInitState, |
|
|
|
scanConsumables, |
|
|
@ -116,11 +117,12 @@ import type { |
|
|
|
} from '../../../websocket/socket' |
|
|
|
import { getServerInfo } from '../../../utils/getServerInfo' |
|
|
|
import { formatScanReports } from '../../../utils/errorHandler' |
|
|
|
import { devOptions } from '@/constant' |
|
|
|
import { ElMessage } from 'element-plus' |
|
|
|
|
|
|
|
const { wsUrl } = getServerInfo('/api/v1/app/ws/state') |
|
|
|
const socket = createWebSocket(wsUrl) |
|
|
|
|
|
|
|
|
|
|
|
const consumableStore = useConsumablesStore() |
|
|
|
const emergencyStore = useEmergencyStore() |
|
|
|
const deviceStore = useDeviceStore() |
|
|
@ -128,8 +130,9 @@ const deviceStore = useDeviceStore() |
|
|
|
const currentTemperature = ref(40) |
|
|
|
// 废料区状态 |
|
|
|
const wasteStatus = ref(false) |
|
|
|
// 父组件状态 |
|
|
|
const isLoad = ref(false) |
|
|
|
// 是否已经加载(扫描)过耗材,界面上展示着耗材 |
|
|
|
const isLoadedConsumables = ref(false) |
|
|
|
// 是否处理加载(扫描)耗材过程中 |
|
|
|
const isLoading = ref(false) |
|
|
|
// 反应板夹的状态 |
|
|
|
const plates = ref<ReactionPlate[]>([]) |
|
|
@ -148,7 +151,7 @@ const moveLiquids = ref<LiquidState[]>([ |
|
|
|
tipNum: 0, |
|
|
|
}, |
|
|
|
]) |
|
|
|
// 新增状态 |
|
|
|
// 是否显示扫描报告(列表弹窗) |
|
|
|
const showScanResults = ref(false) |
|
|
|
interface ScanReport { |
|
|
|
channel: number |
|
|
@ -159,8 +162,9 @@ interface ScanReport { |
|
|
|
lotId: string | null |
|
|
|
} |
|
|
|
const formattedReports = ref<ScanReport[]>([]) |
|
|
|
|
|
|
|
//是否加载 |
|
|
|
const isAlreadyLoad = ref(false) |
|
|
|
const isAlreadyLoad = ref(false) //?? |
|
|
|
// 临时状态管理小球激活数量 |
|
|
|
const tempTipNum = ref<number[]>([ |
|
|
|
...moveLiquids.value.map((liquid) => liquid.tipNum), |
|
|
@ -221,16 +225,18 @@ const bufferBig = ref<BottleGroup[]>( |
|
|
|
) |
|
|
|
//急诊区状态 |
|
|
|
const emergencyInfo = ref(emergencyStore.$state.emergencyInfo || {}) |
|
|
|
//是否处理扫描结果 |
|
|
|
const isHandleScan = ref(false) |
|
|
|
//提示扫描报告后,是否进一步显示 耗材结果 |
|
|
|
const isHandleScan = ref(false) |
|
|
|
// 确认扫描结果 |
|
|
|
const handleConfirmScan = () => { |
|
|
|
showScanResults.value = false |
|
|
|
isHandleScan.value = true |
|
|
|
if (formattedReports.value.some((report) => report.isError)) { |
|
|
|
isLoad.value = false |
|
|
|
isHandleScan.value = false |
|
|
|
isLoadedConsumables.value = false |
|
|
|
isAlreadyLoad.value = false |
|
|
|
ElMessage.warning('存在错误,请检查耗材') |
|
|
|
} else { |
|
|
|
isHandleScan.value = true |
|
|
|
} |
|
|
|
} |
|
|
|
//使用websocket保证数据的实时性 |
|
|
@ -246,7 +252,6 @@ const handleSensorState = (data: SensorStateMessage['data']) => { |
|
|
|
// 可以添加温度异常处理逻辑 |
|
|
|
if (currentTemperature.value > 40) { |
|
|
|
console.warn('温度过高警告') |
|
|
|
// 可以在这里添加其他警告逻辑 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -258,16 +263,19 @@ const handleConsumablesState = (data: ConsumablesStateMessage['data']) => { |
|
|
|
moveLiquids.value = data.tips |
|
|
|
tempTipNum.value = [...moveLiquids.value.map((liquid) => liquid.tipNum)] |
|
|
|
plates.value = data.reactionPlateGroup as ReactionPlate[] |
|
|
|
bufferLittles.value = data.littBottleGroup as BufferLittle[] |
|
|
|
if (!devOptions.enable_LittleBottle_isUsed) { |
|
|
|
//@ts-ignore |
|
|
|
bufferLittles.value = R.map(R.omit(['isUsed']) ,data.littBottleGroup) |
|
|
|
} else { |
|
|
|
bufferLittles.value = data.littBottleGroup as BufferLittle[] |
|
|
|
} |
|
|
|
bufferBig.value = data.larBottleGroup as BottleGroup[] |
|
|
|
} else { |
|
|
|
console.log('正在拖动,不更新耗材') |
|
|
|
} |
|
|
|
} else { |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
// 使用事件总线更新状态 |
|
|
|
// 使用事件总线更新 反应板和缓冲液状态 |
|
|
|
const updatePlatesAndBuffers = ({ |
|
|
|
type, |
|
|
|
value, |
|
|
@ -299,7 +307,6 @@ onMounted(() => { |
|
|
|
'ConsumablesState', |
|
|
|
handleConsumablesState, |
|
|
|
) |
|
|
|
// getEmergencyInfo() |
|
|
|
}) |
|
|
|
onBeforeUnmount(() => { |
|
|
|
// 清除事件总线的监听 |
|
|
@ -316,7 +323,7 @@ onBeforeUnmount(() => { |
|
|
|
// 在组件激活时恢复状态 |
|
|
|
onActivated(() => { |
|
|
|
emergencyInfo.value = emergencyStore.$state.emergencyInfo || {} |
|
|
|
if (!isLoad.value) { |
|
|
|
if (!isLoadedConsumables.value) { |
|
|
|
console.log('组件被激活了') |
|
|
|
} |
|
|
|
}) |
|
|
@ -358,7 +365,7 @@ watch(isHandleScan, (newVal) => { |
|
|
|
.littBottleGroup as BufferLittle[] |
|
|
|
bufferBig.value = consumablesData.value.larBottleGroup as BottleGroup[] |
|
|
|
tempTipNum.value = [...moveLiquids.value.map((liquid) => liquid.tipNum)] |
|
|
|
isLoad.value = true |
|
|
|
isLoadedConsumables.value = true |
|
|
|
isAlreadyLoad.value = true |
|
|
|
consumableStore.setConsumablesData(consumablesData.value) |
|
|
|
} |
|
|
@ -368,14 +375,10 @@ watch(isHandleScan, (newVal) => { |
|
|
|
} |
|
|
|
}) |
|
|
|
const handleIsUnload = () => { |
|
|
|
isLoad.value = !isLoad.value |
|
|
|
isLoadedConsumables.value = !isLoadedConsumables.value |
|
|
|
isLoading.value = false |
|
|
|
isAlreadyLoad.value = false |
|
|
|
isHandleScan.value = false |
|
|
|
socket.unsubscribe<ConsumablesStateMessage>( |
|
|
|
'ConsumablesState', |
|
|
|
handleConsumablesState, |
|
|
|
) |
|
|
|
// 重置 moveLiquids 和 tempTipNum |
|
|
|
moveLiquids.value = [ |
|
|
|
{ id: 1, tipNum: 0 }, |
|
|
|