diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 95189d6..dcedf65 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -2,6 +2,8 @@ import ColorEdit from 'components/color/Edit/index.vue' import AddLiquid from 'components/home/AddLiquid/index.vue' import StartHeat from 'components/home/StartHeat/index.vue' +import { ElMessageBox } from 'element-plus' +import { useHomeStore } from 'stores/homeStore' import { useSystemStore } from 'stores/systemStore' import { watch } from 'vue' @@ -42,6 +44,10 @@ const list = [ ] +const homeStore = useHomeStore() + +let currentCommandId = '' + const chartBox = ref(null) const systemStore = useSystemStore() @@ -55,7 +61,25 @@ const colorVisible = ref(false) const heatVisible = ref(false) const currentHeatModuleCode = ref('MODULE_1') -const startHeat = (moduleCode: 'MODULE_1' | 'MODULE_2') => { +const startHeat = async (moduleCode: 'MODULE_1' | 'MODULE_2') => { + // TODO 停止加热判断条件 + if (false) { + await ElMessageBox.confirm('确定停止加热?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }) + currentCommandId = Date.now().toString() + const params = { + commandId: currentCommandId, + command: 'heater_stop', + params: { + heatModuleCode: moduleCode, + }, + } + await homeStore.sendControl(params) + return + } currentHeatModuleCode.value = moduleCode heatVisible.value = true }