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