|
@ -4,26 +4,27 @@ import { getSolsList } from 'apis/solution' |
|
|
import { ElMessageBox } from 'element-plus' |
|
|
import { ElMessageBox } from 'element-plus' |
|
|
import { FtMessage } from 'libs/message' |
|
|
import { FtMessage } from 'libs/message' |
|
|
import { socket } from 'libs/socket' |
|
|
import { socket } from 'libs/socket' |
|
|
|
|
|
import { useHomeStore } from 'stores/homeStore' |
|
|
import { onMounted, onUnmounted, ref } from 'vue' |
|
|
import { onMounted, onUnmounted, ref } from 'vue' |
|
|
|
|
|
|
|
|
const loading = ref(false) |
|
|
const loading = ref(false) |
|
|
|
|
|
|
|
|
const statisticNumber = ref(0) |
|
|
const statisticNumber = ref(0) |
|
|
|
|
|
|
|
|
|
|
|
const homeStore = useHomeStore() |
|
|
onMounted(async () => { |
|
|
onMounted(async () => { |
|
|
loading.value = true |
|
|
loading.value = true |
|
|
socket.init(receiveMessage, 'pump_position') |
|
|
|
|
|
await getSolutionList() |
|
|
await getSolutionList() |
|
|
await getCraftList() |
|
|
await getCraftList() |
|
|
loading.value = false |
|
|
loading.value = false |
|
|
|
|
|
socket.init(receiveMessage, 'pump_position') |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
onUnmounted(() => { |
|
|
|
|
|
|
|
|
/* onUnmounted(() => { |
|
|
socket.unregisterCallback(receiveMessage, 'pump_position') |
|
|
socket.unregisterCallback(receiveMessage, 'pump_position') |
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) */ |
|
|
const receiveMessage = (data: number) => { |
|
|
const receiveMessage = (data: number) => { |
|
|
statisticNumber.value = data |
|
|
|
|
|
|
|
|
console.log(`接收到泵的转数${data}`) |
|
|
|
|
|
statisticNumber.value = statisticNumber.value + data |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const form = ref<Craft.CraftItem>({}) |
|
|
const form = ref<Craft.CraftItem>({}) |
|
@ -83,8 +84,6 @@ const nameClick = (item: Craft.CraftItem) => { |
|
|
const solution = solutionList.value.find(s => s.id === item.solutionId) |
|
|
const solution = solutionList.value.find(s => s.id === item.solutionId) |
|
|
form.value = { |
|
|
form.value = { |
|
|
...item, |
|
|
...item, |
|
|
concentration: solution?.concentration, |
|
|
|
|
|
scale: solution?.scale, |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -103,6 +102,77 @@ const delHandle = async (id: number | undefined) => { |
|
|
loading.value = false |
|
|
loading.value = false |
|
|
FtMessage.success('删除成功') |
|
|
FtMessage.success('删除成功') |
|
|
} |
|
|
} |
|
|
|
|
|
let currentCommandId = '' |
|
|
|
|
|
// 正转 反转 |
|
|
|
|
|
const pumpRotate = async (direction: string) => { |
|
|
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
|
|
if (direction === 'FORWARD') { |
|
|
|
|
|
const params = { |
|
|
|
|
|
commandId: currentCommandId, |
|
|
|
|
|
command: 'pump_rotate_start', |
|
|
|
|
|
params: { |
|
|
|
|
|
direction: 'FORWARD', |
|
|
|
|
|
position: form.value.revolutions, |
|
|
|
|
|
solutionId: form.value.solutionId, |
|
|
|
|
|
concentration: form.value.concentration, |
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
await homeStore.sendControl(params) |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
const params = { |
|
|
|
|
|
commandId: currentCommandId, |
|
|
|
|
|
command: 'pump_rotate_start', |
|
|
|
|
|
params: { |
|
|
|
|
|
direction: 'BACKWARD', |
|
|
|
|
|
solutionId: form.value.solutionId, |
|
|
|
|
|
concentration: form.value.concentration, |
|
|
|
|
|
position: form.value.revolutions, |
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
await homeStore.sendControl(params) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 停止 |
|
|
|
|
|
const pumpStop = async () => { |
|
|
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
|
|
const params = { |
|
|
|
|
|
commandId: currentCommandId, |
|
|
|
|
|
command: 'pump_rotate_stop', |
|
|
|
|
|
params: { |
|
|
|
|
|
solutionId: form.value.solutionId, |
|
|
|
|
|
concentration: form.value.concentration, |
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
await homeStore.sendControl(params) |
|
|
|
|
|
} |
|
|
|
|
|
// 预充 |
|
|
|
|
|
const pumpPreFill = async () => { |
|
|
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
|
|
const params = { |
|
|
|
|
|
commandId: currentCommandId, |
|
|
|
|
|
command: 'solution_pre_fill_start', |
|
|
|
|
|
params: { |
|
|
|
|
|
solutionId: form.value.solutionId, |
|
|
|
|
|
concentration: form.value.concentration, |
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
await homeStore.sendControl(params) |
|
|
|
|
|
} |
|
|
|
|
|
// 加液 |
|
|
|
|
|
const pumpAddSolution = async () => { |
|
|
|
|
|
currentCommandId = Date.now().toString() |
|
|
|
|
|
const params = { |
|
|
|
|
|
commandId: currentCommandId, |
|
|
|
|
|
command: 'solution_add_start', |
|
|
|
|
|
params: { |
|
|
|
|
|
solutionId: form.value.solutionId, |
|
|
|
|
|
concentration: form.value.concentration, |
|
|
|
|
|
position: form.value.revolutions, |
|
|
|
|
|
}, |
|
|
|
|
|
} |
|
|
|
|
|
await homeStore.sendControl(params) |
|
|
|
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<template lang="pug"> |
|
|
<template lang="pug"> |
|
@ -137,20 +207,24 @@ const delHandle = async (id: number | undefined) => { |
|
|
template(#append) |
|
|
template(#append) |
|
|
span r |
|
|
span r |
|
|
div.statistic-box |
|
|
div.statistic-box |
|
|
|
|
|
ft-button(type="default" size="small" :click-handle="()=>statisticNumber=0") |
|
|
|
|
|
| 重置 |
|
|
span 蠕动泵体积及转数统计 |
|
|
span 蠕动泵体积及转数统计 |
|
|
el-statistic(:value="statisticNumber") |
|
|
el-statistic(:value="statisticNumber") |
|
|
|
|
|
ft-button(type="default" size="small" :click-handle="()=>form.revolutions=statisticNumber") |
|
|
|
|
|
| 设置 |
|
|
div.form-button-box |
|
|
div.form-button-box |
|
|
div |
|
|
div |
|
|
ft-button(type="primary" size="large") |
|
|
|
|
|
|
|
|
ft-button(type="primary" size="large" :click-handle="()=>pumpRotate('FORWARD')") |
|
|
| 正转 |
|
|
| 正转 |
|
|
ft-button(type="primary" size="large") |
|
|
|
|
|
|
|
|
ft-button(type="primary" size="large" :click-handle="()=>pumpRotate('BACKWARD')") |
|
|
| 反转 |
|
|
| 反转 |
|
|
ft-button(type="danger" size="large") |
|
|
|
|
|
|
|
|
ft-button(type="danger" size="large" :click-handle="()=>pumpStop()") |
|
|
| 停止 |
|
|
| 停止 |
|
|
div |
|
|
div |
|
|
ft-button(type="primary" size="large") |
|
|
|
|
|
|
|
|
ft-button(type="primary" size="large" :click-handle="()=>pumpPreFill()") |
|
|
| 预充 |
|
|
| 预充 |
|
|
ft-button(type="primary" size="large") |
|
|
|
|
|
|
|
|
ft-button(type="primary" size="large" :click-handle="()=>pumpAddSolution()") |
|
|
| 加液 |
|
|
| 加液 |
|
|
ft-button(type="primary" size="large" :click-handle="save") |
|
|
ft-button(type="primary" size="large" :click-handle="save") |
|
|
| 保存 |
|
|
| 保存 |
|
|