@@ -77,52 +83,20 @@ const props = defineProps({
default: 40,
},
})
+const emits = defineEmits(['updateReactionPlateNum','unloadConsumable'])
-const platesValue = ref(props.plates)
const totalVal = ref(25)
-const isDragging = ref(false)
-const deviceStore = useDeviceStore()
-watch(
- () => props.plates,
- (newValue) => {
- if (!isDragging.value) {
- platesValue.value = newValue
- }
- },
-)
-const updateSliderVal = async (plate, order) => {
- if (deviceStore.status === 'IDLE' && plate >= 0) {
- isDragging.value = true
- // eventBus.emit('confirm', {
- // type: 'Plate',
- // value: plate,
- // index: order - 1,
- // })
- platesValue.value[order - 1].num = plate
- } else {
- ElMessage.error('设备正在工作,无法修改数值')
- }
+const onPlateLongPress = (order) => {
+ emits('unloadConsumable', order - 1)
}
-const updateSliderEndVal = async (plate, order) => {
- isDragging.value = false
- if (deviceStore.status === 'IDLE' && plate >= 0) {
- try {
- const res = await updateConsumables({ group: `CG${order}`, num: plate })
- if (res.success) {
- // eventBus.emit('confirm', {
- // type: 'Plate',
- // value: plate,
- // index: order - 1,
- // })
- }
- } catch (error) {
- console.error('更新失败:', error)
- }
- } else {
- ElMessage.error('设备正在工作,无法修改数值')
- }
+const updateSliderVal = async (plateNum, order) => {
+ emits('updateReactionPlateNum', { index: order - 1, plateNum, sync: false })
+}
+
+const updateSliderEndVal = async (plateNum, order) => {
+ emits('updateReactionPlateNum', { index: order - 1, plateNum, sync: true })
}
// const changeNumRef = ref()
diff --git a/src/services/Index/regular.ts b/src/services/Index/regular.ts
index b89b94e..8d5768a 100644
--- a/src/services/Index/regular.ts
+++ b/src/services/Index/regular.ts
@@ -1,17 +1,4 @@
import apiClient from '../../utils/axios'
-//点击耗材页面加载耗材按钮
-export const loadConsumables = async () => {
- try {
- const res = await apiClient.get('/api/regular/consumables')
- return res.data
- } catch (error) {
- console.log(error)
- }
-}
-type oneConsumableParams = {
- group: number
- num: number
-}
//耗材扫描接口
export const scanConsumables = async () => {
@@ -26,21 +13,44 @@ export const scanConsumables = async () => {
}
}
-//耗材扫描单组
-export const oneScanConsumable = async (data: oneConsumableParams) => {
+export const unloadAllConsumable = async () => {
try {
const res = await apiClient.post(
- '/api/v1/app/consumableScan/oneScanConsumable',
- {
- ...data,
- },
+ '/api/v1/app/consumablesMgr/unInstallAllConsumable',
)
- console.log('单组扫描返回结果:', res)
return res.data
} catch (error) {
- console.log('单组扫描出错:', error)
+ console.log(error)
}
}
+
+export type ConsumableGroupNo = 'CG1' | 'CG2' | 'CG3' | 'CG4' | 'CG5' | 'CG6'
+
+export const unloadConsumable = async (params: {
+ group: ConsumableGroupNo
+}) => {
+ const res = await apiClient.post(
+ '/api/v1/app/consumablesMgr/unInstallConsumable',
+ null,
+ { params },
+ )
+ return res.data
+}
+//耗材扫描单组
+// export const oneScanConsumable = async (data: oneConsumableParams) => {
+// try {
+// const res = await apiClient.post(
+// '/api/v1/app/consumableScan/oneScanConsumable',
+// {
+// ...data,
+// },
+// )
+// console.log('单组扫描返回结果:', res)
+// return res.data
+// } catch (error) {
+// console.log('单组扫描出错:', error)
+// }
+// }
//修改耗材数量
export const updateConsumables = async (data: any) => {
console.log('🚀 ~ updateConsumables ~ data:', data)
diff --git a/src/store/modules/consumables.ts b/src/store/modules/consumables.ts
index c5a1efa..56f0b3a 100644
--- a/src/store/modules/consumables.ts
+++ b/src/store/modules/consumables.ts
@@ -6,46 +6,43 @@ import { ref } from 'vue'
// ReactionPlate,
// Tip,
// } from '../../types/Index'
-import type { PersistenceOptions } from 'pinia-plugin-persistedstate'
-import type {
- ConsumableGroupBase,
- LittleBottleGroup,
- LargeBottleGroup,
- TipInfo,
- ConsumablesStateMessage,
-} from '../../websocket/socket'
+// import type { PersistenceOptions } from 'pinia-plugin-persistedstate'
+import type { ConsumablesStateMessage } from '../../websocket/socket'
export const useConsumablesStore = defineStore(
'consumables',
() => {
// 定义状态
- const isLoad = ref(false)
- const isLoading = ref(false)
- const moveLiquids = ref
([])
- const plates = ref([])
- const bufferLittles = ref([])
- const bufferBig = ref([])
+ // const isLoad = ref(false)
+ // const moveLiquids = ref([])
+ // const plates = ref([])
+ // const bufferLittles = ref([])
+ // const bufferBig = ref([])
+ const consumableData = ref({
+ tips: [{ tipNum: 0 }, { tipNum: 0 }, { tipNum: 0 }],
+ reactionPlateGroup: Array.from({length: 6},() => ({num: 0, isInstall: false})),
+ littBottleGroup: Array.from({length: 6},() => ({num: 0, isInstall: false})),
+ larBottleGroup: Array.from({length: 6},() => ({num: 0,isInstall: false})),
+ })
//id卡是否插入
const isIdCardInserted = ref(false)
const wasteStatus = ref(false)
// 设置数据的 action
function setConsumablesData(data: ConsumablesStateMessage['data']) {
- isLoad.value = true // 设置为已加载状态
- plates.value = data.reactionPlateGroup
- bufferLittles.value = data.littBottleGroup
- bufferBig.value = data.larBottleGroup
- moveLiquids.value = data.tips
+ // isLoad.value = true // 设置为已加载状态
+ consumableData.value = data
}
-
- // 清除数据的 action
- function resetConsumablesData() {
- isLoad.value = false
- isLoading.value = false
- moveLiquids.value = []
- plates.value = []
- bufferLittles.value = []
- bufferBig.value = []
+ function updateTipNum(index: number, num: number) {
+ if (index < consumableData.value.tips.length && num >= 0) {
+ consumableData.value.tips[index].tipNum = num
+ }
+ }
+ function updateReactionPlateNum(index: number, num: number) {
+ if (index < consumableData.value.reactionPlateGroup.length && num >= 0) {
+ consumableData.value.reactionPlateGroup[index].num = num
+ }
}
+
function updateWasteStatus(status: boolean) {
wasteStatus.value = status
}
@@ -54,24 +51,22 @@ export const useConsumablesStore = defineStore(
}
return {
- isLoad,
- isLoading,
- moveLiquids,
- plates,
- bufferLittles,
- bufferBig,
+ updateIdCardStatus,
isIdCardInserted,
+
+ consumableData,
setConsumablesData,
- resetConsumablesData,
- updateIdCardStatus,
+ updateReactionPlateNum,
+ updateTipNum,
+
updateWasteStatus,
wasteStatus,
}
},
- {
- persist: {
- key: 'consumablesStore',
- storage: localStorage,
- },
- },
+ // {
+ // persist: {
+ // key: 'consumablesStore',
+ // storage: localStorage,
+ // },
+ // },
)
diff --git a/src/websocket/socket.ts b/src/websocket/socket.ts
index cc815a1..0338853 100644
--- a/src/websocket/socket.ts
+++ b/src/websocket/socket.ts
@@ -172,27 +172,28 @@ interface IncubationPlateStateMessage extends BaseMessage {
// ��材组信息基础接口
interface ConsumableGroupBase {
- projId: number | null
- projName: string | null
- projShortName: string | null
+ projId: number
+ projName: string
+ projShortName: string
lotId: string
color: string
num: number
+ isInstall: boolean
+ reserveNum: number
}
+export interface ReactionPlateGroup extends Partial {}
+
// 小缓冲液接口
-interface LittleBottleGroup extends ConsumableGroupBase {
- type: string | null
-}
+interface LittleBottleGroup extends Partial {}
// 大缓冲液接口
-interface LargeBottleGroup extends ConsumableGroupBase {
- isInstall: boolean
-}
+interface LargeBottleGroup extends Partial {}
// Tips信息接口
interface TipInfo {
tipNum: number
+ totalNum?: number
}
// 耗材状态消息接口
@@ -201,9 +202,8 @@ interface ConsumablesStateMessage extends BaseMessage {
messageType: 'Report'
dataType: 'ConsumablesState'
data: {
- scanDate: number
tips: TipInfo[]
- reactionPlateGroup: ConsumableGroupBase[]
+ reactionPlateGroup: ReactionPlateGroup[]
littBottleGroup: LittleBottleGroup[]
larBottleGroup: LargeBottleGroup[]
}
diff --git a/tsconfig.app.json b/tsconfig.app.json
index 993bc05..a0fa6e2 100644
--- a/tsconfig.app.json
+++ b/tsconfig.app.json
@@ -1,7 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
- "composite":true,
+ "composite": true,
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
@@ -24,7 +24,12 @@
"baseUrl": ".",
"paths": {
"@/*": ["src/*"]
- },
+ }
},
- "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.vue"],
+ "include": [
+ "src/**/*.ts",
+ "src/**/*.tsx",
+ "src/**/*.vue",
+ "src/utils/longPressDirective.ts"
+ ]
}