From 0b7bab5ac5678dc00e2720b2d7700df87e89d9a9 Mon Sep 17 00:00:00 2001 From: zhangjiming Date: Sat, 22 Feb 2025 16:23:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=8A=B6=E6=80=81=E4=B8=8E?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 8 ++++++++ src/services/globalCmd/globalCmd.ts | 4 ++-- src/services/socket.ts | 8 +++++--- src/views/oreManage/components/CraftConfig.vue | 2 +- vite.config.ts | 8 ++++---- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/App.vue b/src/App.vue index 3fa6268..bb99a78 100644 --- a/src/App.vue +++ b/src/App.vue @@ -10,6 +10,7 @@ import { useStatusStore } from "./stores/status"; import { ElMessage } from "element-plus"; import { getUserList } from "./services/user/userManager"; import { useUserStore } from "./stores/user"; +import { getOreList } from "./services/ore/oreManage"; const router = useRouter(); const settingStore = useSettingStore(); const statusStore = useStatusStore(); @@ -24,6 +25,8 @@ wsClient.dataOb.subscribe(data => { message: data.data.msg, type: "warning", }); + } else if (data.type === "crafts") { + console.log("crafts:", data); } }); wsClient.connect(); @@ -55,6 +58,11 @@ onMounted(() => { userStore.setUserList(res.data.list); } }); + getOreList({ pageNum: 1, pageSize: 9999 }).then(res => { + if (res.success) { + settingStore.setOreList(res.data.list); + } + }); }); diff --git a/src/services/globalCmd/globalCmd.ts b/src/services/globalCmd/globalCmd.ts index f57f755..023ffe7 100644 --- a/src/services/globalCmd/globalCmd.ts +++ b/src/services/globalCmd/globalCmd.ts @@ -35,7 +35,7 @@ type MoveToSolStepStruct = { // }; }; type MoveToHeaterStepStruct = { - method: "moveToHeater"; + method: "moveToHeat"; // params: { // heaterId: number; // }; @@ -89,7 +89,7 @@ export const StepCmdDescMap: { [k in StepCmd]: string } = { downTray: "降下托盘", addLiquid: "添加溶液", moveToSol: "移至加液", - moveToHeater: "移至加热", + moveToHeat: "移至加热", shaking: "摇匀", startHeating: "开始加热", stopHeating: "停止加热", diff --git a/src/services/socket.ts b/src/services/socket.ts index 02432c2..1cccf73 100644 --- a/src/services/socket.ts +++ b/src/services/socket.ts @@ -17,10 +17,12 @@ export type CmdDatagram = { export type CraftDatagram = { type: "crafts"; data: { - // 当前工艺执行状态,0 表示未执行,1 表示正在执行,2 表示暂停执行,3 表示停止执行。 - status: 0 | 1 | 2 | 3; + // 当前工艺执行状态,0 表示未执行,1 表示正在执行,2 表示暂停执行,3 表示停止执行 4:Error, 6: 完成。 + status: 0 | 1 | 2 | 3 | 4 | 6; // 当前正在执行的具体工艺方法 method: StepCmd; + // 当前正在执行的工艺步骤索引 + methodIndex: number; // 加热区 ID heatId: number; }; @@ -39,7 +41,7 @@ export type StatusDatagram = { type: "status"; // 状态 data: { emergencyStop: boolean; // 硬件急停信号,true 为急停触发,false 为正常运行 - doorStatus: 0 | 1; // 门的状态,0 表示关闭,1 表示开启 + doorStatus: boolean; // 门的状态,false 表示关闭,true 表示开启 railArm: { x: number; y: number; diff --git a/src/views/oreManage/components/CraftConfig.vue b/src/views/oreManage/components/CraftConfig.vue index 069b2b1..009611f 100644 --- a/src/views/oreManage/components/CraftConfig.vue +++ b/src/views/oreManage/components/CraftConfig.vue @@ -47,7 +47,7 @@ const stepCmds: StepCmd[] = [ "downTray", "addLiquid", "moveToSol", - "moveToHeater", + "moveToHeat", "shaking", "startHeating", "stopHeating", diff --git a/vite.config.ts b/vite.config.ts index 6124bb3..a81163d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -17,10 +17,10 @@ export default defineConfig({ host: "0.0.0.0", port: 5174, proxy: { - '/api': { - target: 'http://192.168.1.125:8080', - changeOrigin: true, - // rewrite: (path) => path.replace(/^\/api/, ''), + "/api": { + target: "http://192.168.1.125:8080", + changeOrigin: true, + // rewrite: (path) => path.replace(/^\/api/, ''), }, }, },