diff --git a/src/apis/home.ts b/src/apis/home.ts index 64e029d..1ac3c2b 100644 --- a/src/apis/home.ts +++ b/src/apis/home.ts @@ -3,3 +3,4 @@ import http from 'libs/http' export const setTargetTemperature = (params: Home.SetTargetTemperatureParams): Promise => http.post('/heat/target-temperature', params) export const trayIn = (): Promise => http.post('/tray/in') export const trayOut = (): Promise => http.post('/tray/out') +export const trayTube = (params: Home.TrayTubeParams): Promise => http.post('/tray/out', params) diff --git a/src/assets/styles/element.scss b/src/assets/styles/element.scss index 1c69120..443acf6 100644 --- a/src/assets/styles/element.scss +++ b/src/assets/styles/element.scss @@ -4,7 +4,7 @@ - --el-color-primary: #26509C; + --el-color-primary: #1989fa; //--el-button-active-bg-color: linear-gradient(90deg, #0657C0 24%, #096AE0 101%); --text-color-primary: #17213c; //--el-color-success: rgba(88, 162, 95, 1); diff --git a/src/components/home/AddLiquid/index.vue b/src/components/home/AddLiquid/index.vue index 4f88a9b..aee54a2 100644 --- a/src/components/home/AddLiquid/index.vue +++ b/src/components/home/AddLiquid/index.vue @@ -2,17 +2,32 @@ import { getSolsList } from 'apis/solution' import emptyIcon from 'assets/images/empty.svg' import { FtMessage } from 'libs/message' +import { socket } from 'libs/socket' import { useHomeStore } from 'stores/homeStore' -import { onMounted, ref } from 'vue' +import { useSystemStore } from 'stores/systemStore' +import { onMounted, onUnmounted, ref } from 'vue' const emits = defineEmits(['ok', 'cancel']) const homeStore = useHomeStore() +const systemStore = useSystemStore() onMounted(() => { getSols() + socket.init(receiveMessage, 'cmd_debug') + socket.init(receiveMessage, 'cmd_response') }) +onUnmounted(() => { + socket.unregisterCallback(receiveMessage, 'cmd_debug') + socket.unregisterCallback(receiveMessage, 'cmd_response') +}) + +let currentCommandId = '' +const receiveMessage = (data: Socket.cmdData) => { + data.commandId === currentCommandId && systemStore.pushSystemList(data) +} + const form = ref<{ tubeNum: number solutionId: number @@ -77,16 +92,15 @@ const okHandle = async () => { return } console.log(mergeAddList()) - + currentCommandId = Date.now().toString() const params = { - commandId: Date.now().toString(), + commandId: currentCommandId, command: 'solution_add', params: { dataList: mergeAddList(), }, } await homeStore.sendControl(params) - // await debugStore.sendControl(params) emits('ok') } const cancel = () => { diff --git a/src/components/home/Tube/index.vue b/src/components/home/Tube/index.vue index e4716c7..eab4a60 100644 --- a/src/components/home/Tube/index.vue +++ b/src/components/home/Tube/index.vue @@ -1,5 +1,6 @@