From 33a4f1bc9bba399f3e819a3091e102b9399c2ee0 Mon Sep 17 00:00:00 2001 From: zhangjiming Date: Mon, 24 Feb 2025 16:31:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E6=B6=B2=E9=85=8D=E7=BD=AE=E9=87=8D?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 2 +- src/App.vue | 2 + src/assets/container.svg | 2 +- src/services/socket.ts | 12 +++++- src/services/sysConfig/sysConfig.ts | 2 + src/views/addLiquid/addLiquid.vue | 67 +++++++++++++++++++++++------ src/views/debug/debug.vue | 2 +- src/views/graphite/components/CraftList.vue | 2 +- src/views/liquidConfig/index.vue | 2 +- vite.config.ts | 2 +- 10 files changed, 75 insertions(+), 20 deletions(-) diff --git a/.env b/.env index b7f7c2a..e51db6e 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -VITE_API_HOST=127.0.0.1 +VITE_API_HOST=192.168.1.125 VITE_API_PORT=8080 VITE_WS_PATH=/ws \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index bb99a78..2963f0c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -27,6 +27,8 @@ wsClient.dataOb.subscribe(data => { }); } else if (data.type === "crafts") { console.log("crafts:", data); + } else if (data.type === "container") { + settingStore.setContainerConf(data.data.containerList); } }); wsClient.connect(); diff --git a/src/assets/container.svg b/src/assets/container.svg index 910afb6..764c001 100644 --- a/src/assets/container.svg +++ b/src/assets/container.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/services/socket.ts b/src/services/socket.ts index 1004bba..8811a08 100644 --- a/src/services/socket.ts +++ b/src/services/socket.ts @@ -1,5 +1,6 @@ import { Subject } from "rxjs"; import type { StepCmd } from "./globalCmd/globalCmd"; +import type { Container } from "./sysConfig/sysConfig"; export type CmdSuccess = "D0000"; export type CmdFailure = "D1111"; @@ -115,7 +116,14 @@ export type StatusDatagram = { }; }; -export type Datagram = CmdDatagram | WarnDatagram | StatusDatagram | CraftDatagram; +export type ContainerDatagram = { + type: "container", + data: { + containerList: Container[]; + } +} + +export type Datagram = CmdDatagram | WarnDatagram | StatusDatagram | CraftDatagram | ContainerDatagram; export type DatagramType = Datagram["type"]; export type SocketState = "open" | "close" | "error"; @@ -171,7 +179,7 @@ class WebSocketClient { this.ws.onmessage = (event: MessageEvent) => { try { const data = JSON.parse(event.data) as Datagram; - // console.log('🚀 ~ WebSocketClient ~ bindEvents ~ data:', data) + // console.log("🚀 ~ WebSocketClient ~ bindEvents ~ data:", data); if (data.type === "cmd") { this.dataSub.next({ type: data.type, data: { ...data.data, success: data.data.status === "D0000" } }); } else { diff --git a/src/services/sysConfig/sysConfig.ts b/src/services/sysConfig/sysConfig.ts index 671f88a..cddeeb8 100644 --- a/src/services/sysConfig/sysConfig.ts +++ b/src/services/sysConfig/sysConfig.ts @@ -33,6 +33,8 @@ export type Container = { type: 0 | 1; // 0:酸液 1:废液 solutionId: number; pumpId: number; + capacityTotal: number; + capacityUsed: number; }; export function getContainerList() { diff --git a/src/views/addLiquid/addLiquid.vue b/src/views/addLiquid/addLiquid.vue index d530b3c..5a28855 100644 --- a/src/views/addLiquid/addLiquid.vue +++ b/src/views/addLiquid/addLiquid.vue @@ -1,15 +1,42 @@