|
|
@ -8,13 +8,29 @@ import StartExperiment from 'components/home/StartExperiment/index.vue' |
|
|
|
import Tube from 'components/home/Tube/index.vue' |
|
|
|
import { ElMessageBox } from 'element-plus' |
|
|
|
import { FtMessage } from 'libs/message' |
|
|
|
import { socket } from 'libs/socket' |
|
|
|
import { useHomeStore } from 'stores/homeStore' |
|
|
|
import { useSystemStore } from 'stores/systemStore' |
|
|
|
import { ref } from 'vue' |
|
|
|
import { onMounted, onUnmounted, ref } from 'vue' |
|
|
|
|
|
|
|
const homeStore = useHomeStore() |
|
|
|
const systemStore = useSystemStore() |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
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 startVisible = ref(false) |
|
|
|
|
|
|
|
// const startExperimentHandle = () => { |
|
|
@ -56,17 +72,21 @@ const setTemperature = (id: string) => { |
|
|
|
|
|
|
|
const addLiquidVisible = ref(false) |
|
|
|
const addLiquid = () => { |
|
|
|
const count = homeStore.heatAreaList.filter(item => item.selected).length |
|
|
|
if (!count) { |
|
|
|
FtMessage.warning('请选择加热区') |
|
|
|
if (!systemStore.systemStatus.solutionModule.trayStatus) { |
|
|
|
FtMessage.warning('加液区无托盘') |
|
|
|
return |
|
|
|
} |
|
|
|
addLiquidVisible.value = true |
|
|
|
} |
|
|
|
|
|
|
|
const door_open = async () => { |
|
|
|
if (systemStore.systemStatus.door.open) { |
|
|
|
FtMessage.warning('门已经是开启状态了') |
|
|
|
return |
|
|
|
} |
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
const params = { |
|
|
|
commandId: Date.now().toString(), |
|
|
|
commandId: currentCommandId, |
|
|
|
command: 'door_open', |
|
|
|
params: { }, |
|
|
|
} |
|
|
@ -86,8 +106,13 @@ const door_open = async () => { |
|
|
|
} |
|
|
|
|
|
|
|
const door_close = async () => { |
|
|
|
if (!systemStore.systemStatus.door.open) { |
|
|
|
FtMessage.warning('门已经是关闭状态了') |
|
|
|
return |
|
|
|
} |
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
const params = { |
|
|
|
commandId: Date.now().toString(), |
|
|
|
commandId: currentCommandId, |
|
|
|
command: 'door_close', |
|
|
|
params: { }, |
|
|
|
} |
|
|
@ -107,13 +132,19 @@ const door_close = async () => { |
|
|
|
} |
|
|
|
|
|
|
|
const move_to_heat_area = async () => { |
|
|
|
if (systemStore.systemStatus.solutionModule.trayStatus === 0) { |
|
|
|
FtMessage.warning('加液区无托盘') |
|
|
|
return |
|
|
|
} |
|
|
|
const selectedHeatAreas = homeStore.heatAreaList.filter(item => item.selected) |
|
|
|
if (!selectedHeatAreas.length || selectedHeatAreas.length > 1) { |
|
|
|
FtMessage.warning('请选择一个加热区') |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
const params = { |
|
|
|
commandId: Date.now().toString(), |
|
|
|
commandId: currentCommandId, |
|
|
|
command: 'move_to_heat_area', |
|
|
|
params: { |
|
|
|
heatId: selectedHeatAreas[0].value, |
|
|
@ -128,8 +159,13 @@ const move_to_solution_area = async () => { |
|
|
|
FtMessage.warning('请选择一个加热区') |
|
|
|
return |
|
|
|
} |
|
|
|
if (systemStore.systemStatus.solutionModule.trayStatus === 1) { |
|
|
|
FtMessage.warning('加液区有托盘') |
|
|
|
return |
|
|
|
} |
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
const params = { |
|
|
|
commandId: Date.now().toString(), |
|
|
|
commandId: currentCommandId, |
|
|
|
command: 'move_to_solution_area', |
|
|
|
params: { |
|
|
|
heatId: selectedHeatAreas[0].value, |
|
|
@ -148,8 +184,9 @@ const heat_start = async () => { |
|
|
|
FtMessage.warning('请先设置温度') |
|
|
|
return |
|
|
|
} |
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
const params = { |
|
|
|
commandId: Date.now().toString(), |
|
|
|
commandId: currentCommandId, |
|
|
|
command: 'heat_start', |
|
|
|
params: { |
|
|
|
heatId: selectedHeatAreas[0].value, |
|
|
@ -165,8 +202,9 @@ const heat_stop = async () => { |
|
|
|
FtMessage.warning('请选择一个加热区') |
|
|
|
return |
|
|
|
} |
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
const params = { |
|
|
|
commandId: Date.now().toString(), |
|
|
|
commandId: currentCommandId, |
|
|
|
command: 'heat_stop', |
|
|
|
params: { |
|
|
|
heatId: selectedHeatAreas[0].value, |
|
|
@ -181,8 +219,9 @@ const tray_up = async () => { |
|
|
|
FtMessage.warning('请选择一个加热区') |
|
|
|
return |
|
|
|
} |
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
const params = { |
|
|
|
commandId: Date.now().toString(), |
|
|
|
commandId: currentCommandId, |
|
|
|
command: 'tray_up', |
|
|
|
params: { |
|
|
|
heatId: selectedHeatAreas[0].value, |
|
|
@ -197,8 +236,9 @@ const tray_down = async () => { |
|
|
|
FtMessage.warning('请选择一个加热区') |
|
|
|
return |
|
|
|
} |
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
const params = { |
|
|
|
commandId: Date.now().toString(), |
|
|
|
commandId: currentCommandId, |
|
|
|
command: 'tray_down', |
|
|
|
params: { |
|
|
|
heatId: selectedHeatAreas[0].value, |
|
|
@ -208,8 +248,9 @@ const tray_down = async () => { |
|
|
|
} |
|
|
|
|
|
|
|
const shake_start = async () => { |
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
const params = { |
|
|
|
commandId: Date.now().toString(), |
|
|
|
commandId: currentCommandId, |
|
|
|
command: 'shake_start', |
|
|
|
params: { |
|
|
|
}, |
|
|
@ -218,8 +259,9 @@ const shake_start = async () => { |
|
|
|
} |
|
|
|
|
|
|
|
const shake_stop = async () => { |
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
const params = { |
|
|
|
commandId: Date.now().toString(), |
|
|
|
commandId: currentCommandId, |
|
|
|
command: 'shake_stop', |
|
|
|
params: { |
|
|
|
}, |
|
|
@ -228,8 +270,9 @@ const shake_stop = async () => { |
|
|
|
} |
|
|
|
|
|
|
|
const take_photo = async () => { |
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
const params = { |
|
|
|
commandId: Date.now().toString(), |
|
|
|
commandId: currentCommandId, |
|
|
|
command: 'take_photo', |
|
|
|
params: { |
|
|
|
}, |
|
|
|