From 78ce09235d68d2846d6e9a403995aa451661e126 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Thu, 31 Jul 2025 17:16:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=85=8D=E6=96=B9=E8=BD=AC=E6=95=B0?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/craft/index.vue | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/views/craft/index.vue b/src/views/craft/index.vue index d3e2c68..4d204a9 100644 --- a/src/views/craft/index.vue +++ b/src/views/craft/index.vue @@ -3,17 +3,29 @@ import { createCraft, delCraft, getCraftList as getCraftListApi, updateCraft } f import { getSolsList } from 'apis/solution' import { ElMessageBox } from 'element-plus' import { FtMessage } from 'libs/message' -import { onMounted, ref } from 'vue' +import { socket } from 'libs/socket' +import { onMounted, onUnmounted, ref } from 'vue' const loading = ref(false) +const statisticNumber = ref(0) + onMounted(async () => { loading.value = true + socket.init(receiveMessage, 'pump_position') await getSolutionList() await getCraftList() loading.value = false }) +onUnmounted(() => { + socket.unregisterCallback(receiveMessage, 'pump_position') +}) + +const receiveMessage = (data: number) => { + statisticNumber.value = data +} + const form = ref({}) const formRef = ref() @@ -21,9 +33,6 @@ const rules = { solutionId: [ { required: true, message: '请选择溶液', trigger: 'change' }, ], - scale: [ - { required: true, message: '请输入溶液系数', trigger: 'blur' }, - ], concentration: [ { required: true, message: '请输入溶液浓度', trigger: 'blur' }, ], @@ -115,8 +124,6 @@ const delHandle = async (id: number | undefined) => { el-form-item(label="溶液名称" prop="solutionId") el-select(v-model="form.solutionId" placeholder="请选择溶液") el-option(v-for="item in solutionList" :key="item.id" :label="item.name" :value="item.id") - el-form-item(label="溶液系数" prop="scale") - el-input(v-model="form.scale" placeholder="请输入溶液系数") el-form-item(label="溶液浓度" prop="concentration") el-input(v-model="form.concentration" placeholder="请输入溶液浓度") template(#append) @@ -129,9 +136,10 @@ const delHandle = async (id: number | undefined) => { el-input(v-model="form.revolutions" placeholder="请输入蠕动泵转数") template(#append) span r - el-form-item(label="蠕动泵体积及转数统计" readonly prop="concentration") - el-input(v-model="form.concentration" placeholder="请输入蠕动泵体积及转数统计") - div(class="form-button-box") + div.statistic-box + span 蠕动泵体积及转数统计 + el-statistic(:value="statisticNumber") + div.form-button-box div ft-button(type="primary" size="large") | 正转 @@ -185,6 +193,12 @@ const delHandle = async (id: number | undefined) => { background rgba(64, 158, 255, 0.06) .el-form padding 20px 150px + .statistic-box + display flex + justify-content center + align-items center + .el-statistic + margin 0 30px .form-button-box display flex justify-content space-evenly