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 @@