From 3471d9d2308e9bc1264d74f6aaaf792f1812776b Mon Sep 17 00:00:00 2001 From: zhangjiming Date: Fri, 11 Apr 2025 10:35:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=80=E9=83=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/router.ts | 2 +- src/store/modules/consumables.ts | 26 ++++++++------------------ src/websocket/socket.ts | 3 +-- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/src/router/router.ts b/src/router/router.ts index b34237c..85f85f4 100644 --- a/src/router/router.ts +++ b/src/router/router.ts @@ -98,7 +98,7 @@ function getCurrentUser() { } // 路由守卫,检查本地 Token 是否存在 // 在 router/index.ts 中添加全局路由守卫 -// @ts-igmore +// @ts-ignore router.beforeEach((to, from, next) => { console.log('路由守卫--from--', to, from) const token = sessionStorage.getItem('token') diff --git a/src/store/modules/consumables.ts b/src/store/modules/consumables.ts index eafd8a8..a02cf8c 100644 --- a/src/store/modules/consumables.ts +++ b/src/store/modules/consumables.ts @@ -106,24 +106,14 @@ export const useConsumablesStore = defineStore( } const projectsAvailable = computed(() => { - - const group = R.groupBy( - //@ts-ignore - R.prop('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 as ReactionPlateGroup[] + return R.pipe( + R.filter(g => !!g.projName && g.projName !== 'null'), + R.groupBy(g => g.projName!), + R.values, + (groupArr) => R.map(R.reduce((acc, curr) => { + return { ...curr, num: (acc.num || 0) + (curr.num || 0) } + }, {}), groupArr as ReactionPlateGroup[][]) + )(consumableData.value.reactionPlateGroup) }) const tipCount = computed(() => { diff --git a/src/websocket/socket.ts b/src/websocket/socket.ts index eff4462..278c704 100644 --- a/src/websocket/socket.ts +++ b/src/websocket/socket.ts @@ -312,7 +312,7 @@ interface IncubationPlateStateMessage extends BaseMessage { } // ��材组信息基础接口 -interface ConsumableGroupBase { +export interface ConsumableGroupBase { projId: number projName: string projShortName: string @@ -526,7 +526,6 @@ export type { ProjectInfo, AppEventMessage, ConsumablesStateMessage, - ConsumableGroupBase, LittleBottleGroup, LargeBottleGroup, TipInfo,