|
|
@ -1,5 +1,6 @@ |
|
|
|
import { defineStore } from 'pinia' |
|
|
|
import { ref } from 'vue' |
|
|
|
import { ref,computed } from 'vue' |
|
|
|
import * as R from 'ramda' |
|
|
|
// import type {
|
|
|
|
// BottleGroup,
|
|
|
|
// ConsumableState,
|
|
|
@ -7,7 +8,7 @@ import { ref } from 'vue' |
|
|
|
// Tip,
|
|
|
|
// } from '../../types/Index'
|
|
|
|
// import type { PersistenceOptions } from 'pinia-plugin-persistedstate'
|
|
|
|
import type { ConsumablesStateMessage } from '../../websocket/socket' |
|
|
|
import type { ConsumablesStateMessage, ReactionPlateGroup } from '../../websocket/socket' |
|
|
|
|
|
|
|
export const useConsumablesStore = defineStore( |
|
|
|
'consumables', |
|
|
@ -58,6 +59,25 @@ export const useConsumablesStore = defineStore( |
|
|
|
isIdCardInserted.value = status |
|
|
|
} |
|
|
|
|
|
|
|
const projectsAvailable = computed(() => { |
|
|
|
// @ts-ignore
|
|
|
|
const group = R.groupBy( |
|
|
|
(p) => p.projName, |
|
|
|
consumableData.value.reactionPlateGroup, |
|
|
|
) |
|
|
|
const pNames = R.keys(group).filter((n) => n !== 'null') |
|
|
|
|
|
|
|
const projArr = pNames.map((n) => |
|
|
|
R.reduce( |
|
|
|
(acc, curr) => { |
|
|
|
return { ...curr, num: acc.num + (curr.num || 0) } |
|
|
|
}, |
|
|
|
{ num: 0 }, |
|
|
|
group[n] as ReactionPlateGroup[], |
|
|
|
), |
|
|
|
) |
|
|
|
return projArr |
|
|
|
}) |
|
|
|
//所有耗材都存在
|
|
|
|
let hasAllConsumables = ref(false) |
|
|
|
|
|
|
@ -70,8 +90,8 @@ export const useConsumablesStore = defineStore( |
|
|
|
updateReactionPlateNum, |
|
|
|
updateTipNum, |
|
|
|
|
|
|
|
// updateWasteStatus,
|
|
|
|
// wasteStatus,
|
|
|
|
projectsAvailable, |
|
|
|
|
|
|
|
hasAllConsumables, |
|
|
|
} |
|
|
|
}, |
|
|
|