From 5a04b3e16a4a3836a198dd6d989450340075807a Mon Sep 17 00:00:00 2001 From: guoapeng Date: Thu, 20 Mar 2025 18:04:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=B7=BB=E5=8A=A0=E8=87=AA=E6=A3=80?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/home/Check/index.vue | 2 +- src/libs/utils.ts | 14 +++++++++++--- src/views/home/index.vue | 26 +++++++++++++++----------- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/src/components/home/Check/index.vue b/src/components/home/Check/index.vue index fe03370..e536f28 100644 --- a/src/components/home/Check/index.vue +++ b/src/components/home/Check/index.vue @@ -54,7 +54,7 @@ const motorXYZOrigin = async () => { buttonRef.value.setLoading(true) const cmdId = Date.now().toString() const params = { - cmdCode: 'motor_xyz_origin', + cmdCode: 'device_self_test', cmdId, params: {}, } diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 23606ed..89dad63 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -1,5 +1,6 @@ import { control, debugControl } from 'apis/system' import { FtMessage } from 'libs/message' +import { socket } from 'libs/socket' import { useSystemStore } from 'stores/useSystemStore' export const sendControl = async (params: any, type?: string) => { @@ -29,9 +30,16 @@ export const sendControl = async (params: any, type?: string) => { } systemStore.systemList = [] - // const cmdName = cmdNameMap[params.cmdCode as keyof typeof cmdNameMap] || params.cmdCode - const res = await (type ? control(params) : debugControl(params)) - console.log(res) + const cmdName = cmdNameMap[params.cmdCode as keyof typeof cmdNameMap] || params.cmdCode + + socket.init((data: any) => { + systemStore.pushSystemList(data) + }, 'cmd_debug') + socket.init((data: any) => { + systemStore.pushSystemList(data) + }, 'cmd_response') + await (type ? control(params) : debugControl(params)) + FtMessage.success(`[${cmdName}]已发送`) // if (!res.ok) { // FtMessage.error(`[${cmdName}]发送失败`) // return diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 7934ca7..f6311e5 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -1,9 +1,11 @@