|
|
@ -55,7 +55,7 @@ |
|
|
|
</div> |
|
|
|
<div class="move-liquid-area"> |
|
|
|
<MoveLiquidArea |
|
|
|
:isLoad="isLoad" |
|
|
|
:isLoad="isLoadedConsumables" |
|
|
|
:isLoading="isLoading" |
|
|
|
:moveLiquids="moveLiquids" |
|
|
|
:tempTipNum="tempTipNum" |
|
|
@ -87,7 +87,7 @@ |
|
|
|
gridWidth="240px" |
|
|
|
gridHeight="240px" |
|
|
|
:activeColor="item.color" |
|
|
|
:inUse="item.isUsed" |
|
|
|
:inUse="item.isInstall" |
|
|
|
/> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -113,21 +113,14 @@ import type { |
|
|
|
ConsumablesStateMessage, |
|
|
|
SensorStateMessage, |
|
|
|
EmergencyPosStateMessage, |
|
|
|
} from '@/websocket/socket' |
|
|
|
import { getServerInfo } from '@/utils/getServerInfo' |
|
|
|
import { formatScanReports } from '@/utils/errorHandler' |
|
|
|
} from '../../../websocket/socket' |
|
|
|
import { getServerInfo } from '../../../utils/getServerInfo' |
|
|
|
import { formatScanReports } from '../../../utils/errorHandler' |
|
|
|
import { ElMessage } from 'element-plus' |
|
|
|
|
|
|
|
const { wsUrl } = getServerInfo('/api/v1/app/ws/state') |
|
|
|
const socket = createWebSocket(wsUrl) |
|
|
|
|
|
|
|
// const sliderValue = ref(25); // 初始值 |
|
|
|
// const totalVal = ref(50) |
|
|
|
|
|
|
|
// const hVal = ref(10) |
|
|
|
// const hTotal = ref(60) |
|
|
|
// const vVal = ref(10) |
|
|
|
// const vTotal = ref(60) |
|
|
|
|
|
|
|
const consumableStore = useConsumablesStore() |
|
|
|
const emergencyStore = useEmergencyStore() |
|
|
|
const deviceStore = useDeviceStore() |
|
|
@ -135,8 +128,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[]>([]) |
|
|
@ -155,7 +149,7 @@ const moveLiquids = ref<LiquidState[]>([ |
|
|
|
tipNum: 0, |
|
|
|
}, |
|
|
|
]) |
|
|
|
// 新增状态 |
|
|
|
// 是否显示扫描报告(列表弹窗) |
|
|
|
const showScanResults = ref(false) |
|
|
|
interface ScanReport { |
|
|
|
channel: number |
|
|
@ -166,8 +160,7 @@ interface ScanReport { |
|
|
|
lotId: string | null |
|
|
|
} |
|
|
|
const formattedReports = ref<ScanReport[]>([]) |
|
|
|
//是否加载 |
|
|
|
const isAlreadyLoad = ref(false) |
|
|
|
|
|
|
|
// 临时状态管理小球激活数量 |
|
|
|
const tempTipNum = ref<number[]>([ |
|
|
|
...moveLiquids.value.map((liquid) => liquid.tipNum), |
|
|
@ -182,7 +175,7 @@ interface BufferLittle { |
|
|
|
type?: string |
|
|
|
projId?: number |
|
|
|
projName?: string |
|
|
|
isUsed?: boolean |
|
|
|
isInstall?: boolean |
|
|
|
} |
|
|
|
const bufferLittles = ref<BufferLittle[]>([ |
|
|
|
{ |
|
|
@ -228,16 +221,17 @@ const bufferBig = ref<BottleGroup[]>( |
|
|
|
) |
|
|
|
//急诊区状态 |
|
|
|
const emergencyInfo = ref(emergencyStore.$state.emergencyInfo || {}) |
|
|
|
//是否处理扫描结果 |
|
|
|
//提示扫描报告后,是否进一步显示 耗材结果 |
|
|
|
const isHandleScan = ref(false) |
|
|
|
// 确认扫描结果 |
|
|
|
const handleConfirmScan = () => { |
|
|
|
showScanResults.value = false |
|
|
|
isHandleScan.value = true |
|
|
|
if (formattedReports.value.some((report) => report.isError)) { |
|
|
|
isLoad.value = false |
|
|
|
isAlreadyLoad.value = false |
|
|
|
isHandleScan.value = false |
|
|
|
isLoadedConsumables.value = false |
|
|
|
ElMessage.warning('存在错误,请检查耗材') |
|
|
|
} else { |
|
|
|
isHandleScan.value = true |
|
|
|
} |
|
|
|
} |
|
|
|
//使用websocket保证数据的实时性 |
|
|
@ -253,13 +247,14 @@ const handleSensorState = (data: SensorStateMessage['data']) => { |
|
|
|
// 可以添加温度异常处理逻辑 |
|
|
|
if (currentTemperature.value > 40) { |
|
|
|
console.warn('温度过高警告') |
|
|
|
// 可以在这里添加其他警告逻辑 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//所有的耗材是否都有,如果有一项没有则为false |
|
|
|
let hasAllConsumables = ref(false) |
|
|
|
//处理耗材状态 |
|
|
|
const handleConsumablesState = (data: ConsumablesStateMessage['data']) => { |
|
|
|
if (isAlreadyLoad.value && isHandleScan.value) { |
|
|
|
if (isHandleScan.value) { |
|
|
|
consumableStore.setConsumablesData(data) |
|
|
|
if (!isDragging.value) { |
|
|
|
moveLiquids.value = data.tips |
|
|
@ -267,14 +262,24 @@ const handleConsumablesState = (data: ConsumablesStateMessage['data']) => { |
|
|
|
plates.value = data.reactionPlateGroup as ReactionPlate[] |
|
|
|
bufferLittles.value = data.littBottleGroup as BufferLittle[] |
|
|
|
bufferBig.value = data.larBottleGroup as BottleGroup[] |
|
|
|
if( |
|
|
|
(data.tips && data.tips.length ) && |
|
|
|
(data.reactionPlateGroup && data.reactionPlateGroup.length) && |
|
|
|
(data.littBottleGroup && data.littBottleGroup.length) && |
|
|
|
(data.larBottleGroup && data.larBottleGroup.length) |
|
|
|
){ |
|
|
|
hasAllConsumables.value = true; |
|
|
|
}else{ |
|
|
|
console.log('正在拖动,不更新耗材') |
|
|
|
hasAllConsumables.value = false; |
|
|
|
} |
|
|
|
//放入全局story 中 |
|
|
|
consumableStore.hasAllConsumables = hasAllConsumables.value |
|
|
|
} else { |
|
|
|
return |
|
|
|
console.log('正在拖动,不更新耗材') |
|
|
|
} |
|
|
|
} |
|
|
|
// 使用事件总线更新状态 |
|
|
|
} |
|
|
|
// 使用事件总线更新 反应板和缓冲液状态 |
|
|
|
const updatePlatesAndBuffers = ({ |
|
|
|
type, |
|
|
|
value, |
|
|
@ -295,7 +300,7 @@ const updatePlatesAndBuffers = ({ |
|
|
|
bufferLittles.value[index].num = value |
|
|
|
} |
|
|
|
if (type === 'BigBuf' && bufferBig.value && bufferBig.value[index]) { |
|
|
|
bufferBig.value[index].isUse = value > 0 |
|
|
|
bufferBig.value[index].isInstall = value > 0 |
|
|
|
} |
|
|
|
} |
|
|
|
onMounted(() => { |
|
|
@ -303,10 +308,9 @@ onMounted(() => { |
|
|
|
startWebSocket() |
|
|
|
socket.subscribe<SensorStateMessage>('SensorState', handleSensorState) |
|
|
|
socket.subscribe<ConsumablesStateMessage>( |
|
|
|
'ConsumablesStateService', |
|
|
|
'ConsumablesState', |
|
|
|
handleConsumablesState, |
|
|
|
) |
|
|
|
// getEmergencyInfo() |
|
|
|
}) |
|
|
|
onBeforeUnmount(() => { |
|
|
|
// 清除事件总线的监听 |
|
|
@ -316,14 +320,14 @@ onBeforeUnmount(() => { |
|
|
|
} |
|
|
|
socket.unsubscribe<SensorStateMessage>('SensorState', handleSensorState) |
|
|
|
socket.unsubscribe<ConsumablesStateMessage>( |
|
|
|
'ConsumablesStateService', |
|
|
|
'ConsumablesState', |
|
|
|
handleConsumablesState, |
|
|
|
) |
|
|
|
}) |
|
|
|
// 在组件激活时恢复状态 |
|
|
|
onActivated(() => { |
|
|
|
emergencyInfo.value = emergencyStore.$state.emergencyInfo || {} |
|
|
|
if (!isLoad.value) { |
|
|
|
if (!isLoadedConsumables.value) { |
|
|
|
console.log('组件被激活了') |
|
|
|
} |
|
|
|
}) |
|
|
@ -351,7 +355,7 @@ const handleIsLoad = async () => { |
|
|
|
} catch (error) { |
|
|
|
console.error('加载耗材失败:', error) |
|
|
|
isLoading.value = false |
|
|
|
isAlreadyLoad.value = false |
|
|
|
isHandleScan.value = false |
|
|
|
ElMessage.error('加载耗材失败') |
|
|
|
} |
|
|
|
} |
|
|
@ -365,8 +369,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 |
|
|
|
isAlreadyLoad.value = true |
|
|
|
isLoadedConsumables.value = true |
|
|
|
consumableStore.setConsumablesData(consumablesData.value) |
|
|
|
} |
|
|
|
} else { |
|
|
@ -375,13 +378,9 @@ watch(isHandleScan, (newVal) => { |
|
|
|
} |
|
|
|
}) |
|
|
|
const handleIsUnload = () => { |
|
|
|
isLoad.value = !isLoad.value |
|
|
|
isLoadedConsumables.value = !isLoadedConsumables.value |
|
|
|
isLoading.value = false |
|
|
|
isAlreadyLoad.value = false |
|
|
|
socket.unsubscribe<ConsumablesStateMessage>( |
|
|
|
'ConsumablesStateService', |
|
|
|
handleConsumablesState, |
|
|
|
) |
|
|
|
isHandleScan.value = false |
|
|
|
// 重置 moveLiquids 和 tempTipNum |
|
|
|
moveLiquids.value = [ |
|
|
|
{ id: 1, tipNum: 0 }, |
|
|
@ -431,7 +430,7 @@ const handleIsUnload = () => { |
|
|
|
color: '#4caf50', |
|
|
|
}, |
|
|
|
] |
|
|
|
bufferBig.value = Array.from({ length: 6 }, () => ({ num: 0, isUse: false })) |
|
|
|
bufferBig.value = Array.from({ length: 6 }, () => ({ num: 0, isInstall: false })) |
|
|
|
} |
|
|
|
|
|
|
|
const isDragging = ref(false) |
|
|
@ -445,6 +444,7 @@ const updateTipNum = async ({ |
|
|
|
tipNum: number |
|
|
|
sync: boolean |
|
|
|
}) => { |
|
|
|
if (tipNum < 0) { return } |
|
|
|
if (deviceStore.status === 'IDLE') { |
|
|
|
tempTipNum.value[index] = tipNum |
|
|
|
//调用接口 |
|
|
|