diff --git a/src/constant/index.ts b/src/constant/index.ts index dc5f1e3..b9178f2 100644 --- a/src/constant/index.ts +++ b/src/constant/index.ts @@ -1,24 +1,47 @@ -export const DICT = { - +import { Emergency } from '../types/Index/Emergency'; +// 开发选项 +export const devOptions = { + // 小瓶缓冲液对象的isInstall属性 +// enable_LittleBottle_isInstall: false, } + +export const DICT = {} //扫描状态 -export const SCAN_CONSUMABLES_STATE_MAP:any[] = [ - 'PASS',//通过 - 'EMPTY',//空 - 'EXPIRED',//耗材过期 - 'MISS_REACTION_PLATE',//没有反应板夹 - 'MISS_LITTSB',//缺少小缓冲液 - 'MISS_LARBS',//缺少大缓冲液 - 'MISS_IDCARD',//未找到匹配的项目ID卡 - 'LITTSB_LOTID_MISMATCH',//小缓冲液批号不匹配 - 'LARBS_LOTID_MISMATCH',//大缓冲液批号不匹配 - 'REACTION_PLATE_2D_CODE_FORMATE_ERROR',//反应板二维码格式错误 - 'CODE_ERROR_PROJINFO_IS_ERROR',//代码错误,项目信息异常 - 'UN_SUPPORT_PROJ',//不支持的项目 +export const SCAN_CONSUMABLES_STATE_MAP: any[] = [ + 'PASS', //通过 + 'EMPTY', //空 + 'EXPIRED', //耗材过期 + 'MISS_REACTION_PLATE', //没有反应板夹 + 'MISS_LITTSB', //缺少小缓冲液 + 'MISS_LARBS', //缺少大缓冲液 + 'MISS_IDCARD', //未找到匹配的项目ID卡 + 'LITTSB_LOTID_MISMATCH', //小缓冲液批号不匹配 + 'LARBS_LOTID_MISMATCH', //大缓冲液批号不匹配 + 'REACTION_PLATE_2D_CODE_FORMATE_ERROR', //反应板二维码格式错误 + 'CODE_ERROR_PROJINFO_IS_ERROR', //代码错误,项目信息异常 + 'UN_SUPPORT_PROJ', //不支持的项目 +] + +let scan_consumables_state_option: any = {} +SCAN_CONSUMABLES_STATE_MAP.map((el) => { + scan_consumables_state_option[el] = el +}) +export const SCAN_CONSUMABLES_STATE = scan_consumables_state_option + + +//急诊位状态处理出错 +const emergencyStateList = [ + "EMPTY", //空 + "TO_BE_PROCESSED", //待处理 + "PENDING",//挂起 + "RESOURCE_IS_READY",//资源准备好 + "PROCESSING",//处理中 + "PROCESS_COMPLETE", //完成 + "ERROR",//异常 ] -let scan_consumables_state_option:any = {} -SCAN_CONSUMABLES_STATE_MAP.map(el => { - scan_consumables_state_option[el] = el +let emergency_state_option: any = {} +emergencyStateList.map((el) => { + emergency_state_option[el] = el }) -export const SCAN_CONSUMABLES_STATE = scan_consumables_state_option; \ No newline at end of file +export const EMERGENCY_STATE = emergency_state_option diff --git a/src/mock/Index/Consumables.ts b/src/mock/Index/Consumables.ts index 2602020..da79ded 100644 --- a/src/mock/Index/Consumables.ts +++ b/src/mock/Index/Consumables.ts @@ -214,7 +214,7 @@ const consumablesScanResultData: ConsumablesScanResultData = Mock.mock({ lotId: '', color: '', num: 0, - isUse: false, + isInstall: false, }, { projId: 2, @@ -223,13 +223,13 @@ const consumablesScanResultData: ConsumablesScanResultData = Mock.mock({ lotId: 'FA020000', color: '#DC143C', num: 25, - isUse: true, + isInstall: true, }, { lotId: '', color: '', num: 0, - isUse: false, + isInstall: false, }, { projId: 4, @@ -238,7 +238,7 @@ const consumablesScanResultData: ConsumablesScanResultData = Mock.mock({ lotId: 'FA040000', color: '#FF69B4', num: 25, - isUse: true, + isInstall: true, }, { projId: 5, @@ -247,7 +247,7 @@ const consumablesScanResultData: ConsumablesScanResultData = Mock.mock({ lotId: 'FA050000', color: '#FF1493', num: 25, - isUse: true, + isInstall: true, }, { projId: 6, @@ -256,7 +256,7 @@ const consumablesScanResultData: ConsumablesScanResultData = Mock.mock({ lotId: 'FA060000', color: '#C71585', num: 25, - isUse: true, + isInstall: true, }, ], }, @@ -405,7 +405,7 @@ const consumableOneChannelData: ConsumablesOneChannel = Mock.mock({ lotId: '', color: '', num: 0, - isUse: false, + isInstall: false, }, { projId: 2, @@ -414,13 +414,13 @@ const consumableOneChannelData: ConsumablesOneChannel = Mock.mock({ lotId: 'FA020000', color: '#DC143C', num: 25, - isUse: true, + isInstall: true, }, { lotId: '', color: '', num: 0, - isUse: false, + isInstall: false, }, { projId: 4, @@ -429,7 +429,7 @@ const consumableOneChannelData: ConsumablesOneChannel = Mock.mock({ lotId: 'FA040000', color: '#FF69B4', num: 25, - isUse: true, + isInstall: true, }, { projId: 5, @@ -438,7 +438,7 @@ const consumableOneChannelData: ConsumablesOneChannel = Mock.mock({ lotId: 'FA050000', color: '#FF1493', num: 25, - isUse: true, + isInstall: true, }, { projId: 6, @@ -447,7 +447,7 @@ const consumableOneChannelData: ConsumablesOneChannel = Mock.mock({ lotId: 'FA060000', color: '#C71585', num: 25, - isUse: true, + isInstall: true, }, ], }, diff --git a/src/pages/Index/Index.vue b/src/pages/Index/Index.vue index d14e1ad..40c0513 100644 --- a/src/pages/Index/Index.vue +++ b/src/pages/Index/Index.vue @@ -50,7 +50,7 @@ - + @@ -373,7 +373,7 @@ onMounted(() => { // 开始检测 const checkInit = () => { const hasExecutedReset = sessionStorage.getItem('deviceResetFinished'); - if (hasExecutedReset === "false") { + if (!hasExecutedReset || hasExecutedReset === 'false') { showModal.value = true; } }; diff --git a/src/pages/Index/Regular/Consumables.vue b/src/pages/Index/Regular/Consumables.vue index 138c346..d5f92be 100644 --- a/src/pages/Index/Regular/Consumables.vue +++ b/src/pages/Index/Regular/Consumables.vue @@ -55,7 +55,7 @@
@@ -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([]) @@ -155,7 +149,7 @@ const moveLiquids = ref([ tipNum: 0, }, ]) -// 新增状态 +// 是否显示扫描报告(列表弹窗) const showScanResults = ref(false) interface ScanReport { channel: number @@ -166,8 +160,7 @@ interface ScanReport { lotId: string | null } const formattedReports = ref([]) -//是否加载 -const isAlreadyLoad = ref(false) + // 临时状态管理小球激活数量 const tempTipNum = ref([ ...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([ { @@ -228,16 +221,17 @@ const bufferBig = ref( ) //急诊区状态 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 - 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{ + hasAllConsumables.value = false; + } + //放入全局story 中 + consumableStore.hasAllConsumables = hasAllConsumables.value } else { console.log('正在拖动,不更新耗材') } - } else { - return } } -// 使用事件总线更新状态 +// 使用事件总线更新 反应板和缓冲液状态 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('SensorState', handleSensorState) socket.subscribe( - 'ConsumablesStateService', + 'ConsumablesState', handleConsumablesState, ) - // getEmergencyInfo() }) onBeforeUnmount(() => { // 清除事件总线的监听 @@ -316,14 +320,14 @@ onBeforeUnmount(() => { } socket.unsubscribe('SensorState', handleSensorState) socket.unsubscribe( - '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( - '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 //调用接口 diff --git a/src/pages/Index/Regular/Emergency.vue b/src/pages/Index/Regular/Emergency.vue index 60fc838..52ea129 100644 --- a/src/pages/Index/Regular/Emergency.vue +++ b/src/pages/Index/Regular/Emergency.vue @@ -235,14 +235,14 @@ const confirmHandle = async () => { // return // } const emergencyInfo = emergencyPosition.value; - if(!emergencyInfo.sampleBarcode){ - ElMessage.error('请输入样本条形码'); - return - } - if(!emergencyInfo.userid){ - ElMessage.error('请输入用户ID'); - return - } + // if(!emergencyInfo.sampleBarcode){ + // ElMessage.error('请输入样本条形码'); + // return + // } + // if(!emergencyInfo.userid){ + // ElMessage.error('请输入用户ID'); + // return + // } if (emergencyInfo.projIds.length === 0) { ElMessage.error('请选择项目'); return @@ -270,14 +270,15 @@ const confirmHandle = async () => { }; emergencyStore.setInfo(emergencyData); - // 跳转到运行中页面并传递数据 + // 跳转到运行中(孵育盘)页面并传递数据 router.push({ path: "/index/regular/running", }); + //高亮运行TAB + sessionStorage.setItem('currentTab', '2') } else { console.log("🚀 ~ confirmHandle ~ res:", res) } - }; // 项目选择事件 diff --git a/src/pages/Index/Regular/Running.vue b/src/pages/Index/Regular/Running.vue index d3d87b4..161f47b 100644 --- a/src/pages/Index/Regular/Running.vue +++ b/src/pages/Index/Regular/Running.vue @@ -1,6 +1,6 @@ - -
- - 孵育盘温度 - - - - 100℃ - - -
- -
- - 光学模组 - -
- - - - - xxx - - xxxx - xxxxxxx - -
-
- 空闲 -
-
- -
-{{ - index+1 -}} -
-
-
+
+ + 孵育盘温度 + + + 100℃ + +
+ +
+ + 光学模组 + +
+ + + + xxx + xxxx + xxxxxxx + +
+
+ 空闲 +
+
+ +
+ {{ index + 1 }} +
+
+
+ @click="!item.isPlaceholder && toggleSelectItem(item, index)" + > -
{{ index +1 }}
-
+
+ {{ index + 1 }} +
+
-
- 急诊 -
+
+ 急诊 +
+ :tube="sampleTube" + :index="0" + :projects="sampleProjects" + :bloodTypes="sampleBloodTypes" + />
-
- -
+
+ +
@@ -147,13 +222,23 @@ border-radius: 5px;
-
+
{{ consumablesStore.moveLiquids[0].tipNum }}/120
- +
@@ -168,7 +253,9 @@ border-radius: 5px;
废料箱已满
请尽快清理废料箱
- 确认 + 确认
@@ -182,19 +269,37 @@ border-radius: 5px;
确认要添加急诊吗?
- 取消 - 确认 + 取消 + 确认
- +