From 8c38b94b5850632ceb7cd748c813f42051e9c231 Mon Sep 17 00:00:00 2001 From: zhangjiming Date: Tue, 25 Feb 2025 19:48:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=BD=E4=BB=A4=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/icon_operation.svg | 1 + src/services/txn.ts | 9 + src/stores/status.ts | 10 + src/views/components/Footer.vue | 110 ++- src/views/graphite/index.vue | 1480 +++++++++++++++++++-------------------- 5 files changed, 846 insertions(+), 764 deletions(-) create mode 100644 src/assets/icon_operation.svg diff --git a/src/assets/icon_operation.svg b/src/assets/icon_operation.svg new file mode 100644 index 0000000..8068d92 --- /dev/null +++ b/src/assets/icon_operation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/services/txn.ts b/src/services/txn.ts index cd315ce..ebfa268 100644 --- a/src/services/txn.ts +++ b/src/services/txn.ts @@ -59,3 +59,12 @@ export function getTxnRecord(txn: string, category: TxnRecord["category"]) { } return undefined; } + +export function peekTxnRecord(txn: string, category: TxnRecord["category"]) { + const record = txnCmdMap[txn]; + // 只有属于指定category时,才返回,且返回后删除记录,节约内存 + if (record.category === category) { + return record; + } + return undefined; +} \ No newline at end of file diff --git a/src/stores/status.ts b/src/stores/status.ts index 525527a..8061618 100644 --- a/src/stores/status.ts +++ b/src/stores/status.ts @@ -2,6 +2,7 @@ import { ref, computed } from "vue"; import { defineStore } from "pinia"; import * as R from "ramda"; import type { StatusDatagram } from "@/services/socket"; +import { BehaviorSubject, Subject } from "rxjs"; export const useStatusStore = defineStore("status", () => { const status = ref(); @@ -14,3 +15,12 @@ export const useStatusStore = defineStore("status", () => { return { status, setStatus }; }); + +// 进行中状态 +export type OnGoingStatus = "idle" | "doorOpening" | "doorClosing" | "shaking" | "injecting" | "movingToAct" | "movingToHeat"; + +const onGoingStatusSub = new BehaviorSubject('idle'); +export const onGoingStatusOb = onGoingStatusSub.asObservable(); +export function setOnGoingStatus(status: OnGoingStatus) { + onGoingStatusSub.next(status) +} \ No newline at end of file diff --git a/src/views/components/Footer.vue b/src/views/components/Footer.vue index bc8013c..3caa6ce 100644 --- a/src/views/components/Footer.vue +++ b/src/views/components/Footer.vue @@ -1,16 +1,24 @@