|
|
@ -12,7 +12,7 @@ import Edit from 'components/martixCraft/Edit/index.vue' |
|
|
|
import TrayGraph from 'components/spray/trayGraph/index.vue' |
|
|
|
import { FtMessage } from 'libs/message' |
|
|
|
import { socket } from 'libs/socket' |
|
|
|
import { sendControl } from 'libs/utils' |
|
|
|
import { colors, sendControl } from 'libs/utils' |
|
|
|
import { useSystemStore } from 'stores/useSystemStore' |
|
|
|
import { nextTick, onMounted, onUnmounted, ref } from 'vue' |
|
|
|
|
|
|
@ -55,17 +55,16 @@ onMounted(async () => { |
|
|
|
await getDeviceStatus().then((res: any) => { |
|
|
|
systemStore.updateSystemStatus(res) |
|
|
|
if (systemStore.systemStatus.spraying) { |
|
|
|
FtMessage.info('正在喷涂中...') |
|
|
|
maskVisible.value = true |
|
|
|
getSpraying() |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
const isActive = true |
|
|
|
|
|
|
|
onUnmounted(() => { |
|
|
|
socket.unregisterCallback(sprayPointReceiveMessage, 'spray_point') |
|
|
|
socket.unregisterCallback(finishMessage, 'cmd_response') |
|
|
|
// isActive = false |
|
|
|
}) |
|
|
|
|
|
|
|
const getSpraying = async () => { |
|
|
@ -100,7 +99,7 @@ const getMatrixList = async () => { |
|
|
|
matrixList.value = res.list |
|
|
|
} |
|
|
|
|
|
|
|
const form = ref({ |
|
|
|
const form = ref<SprayForm>({ |
|
|
|
matrixId: undefined, |
|
|
|
matrixCraftId: undefined, |
|
|
|
matrixPathType: 'horizontal', // 路径类型 |
|
|
@ -112,10 +111,15 @@ const form = ref({ |
|
|
|
spacing: undefined, // 毫米 |
|
|
|
movingSpeed: undefined, // 移动速度 |
|
|
|
times: undefined, // 喷涂遍数 |
|
|
|
position: [{ select: true }, { select: false }, { select: false }, { select: false }], |
|
|
|
position: [ |
|
|
|
{ select: true, x1: 0, y1: 0, x2: 25, y2: 75, index: 0 }, |
|
|
|
{ select: false, x1: 0, y1: 0, x2: 25, y2: 75, index: 1 }, |
|
|
|
{ select: false, x1: 0, y1: 0, x2: 25, y2: 75, index: 2 }, |
|
|
|
{ select: false, x1: 0, y1: 0, x2: 25, y2: 75, index: 3 }, |
|
|
|
], |
|
|
|
}) |
|
|
|
|
|
|
|
const updateForm = ref({ |
|
|
|
const updateForm = ref<SprayUpdateForm>({ |
|
|
|
motorZHeight: undefined, // 高度 |
|
|
|
gasPressure: undefined, // Mpa兆帕 |
|
|
|
volume: undefined, // 单位uL微升 |
|
|
@ -152,7 +156,7 @@ const checkPosition = () => { |
|
|
|
return position |
|
|
|
} |
|
|
|
|
|
|
|
const maskVisible = ref(false) |
|
|
|
const maskVisible = ref(true) |
|
|
|
const startWork = async () => { |
|
|
|
formRef.value.validate(async (valid: boolean) => { |
|
|
|
console.log('valid', valid) |
|
|
@ -174,9 +178,7 @@ const startWork = async () => { |
|
|
|
position, |
|
|
|
}, |
|
|
|
} |
|
|
|
console.log(params) |
|
|
|
// socket.init(sprayPointReceiveMessage, 'spray_point') |
|
|
|
// socket.init(finishMessage, 'cmd_response') |
|
|
|
|
|
|
|
maskVisible.value = true |
|
|
|
await sendControl(params) |
|
|
|
currentSpeed = Number(form.value.movingSpeed) |
|
|
@ -186,7 +188,7 @@ const startWork = async () => { |
|
|
|
let currentSpeed = 0 |
|
|
|
// let poll: ReturnType<typeof setInterval> |
|
|
|
console.log(currentSpeed) |
|
|
|
const colors = ['#FAF0E6', '#191970', '#2E8B57', '#C0FF3E', '#8B658B', '#EE7942', '#EE1289', '#FF00FF', '#C6E2FF', '#556B2F', '#00BFFF', '#7B68EE'] |
|
|
|
|
|
|
|
const sprayPointReceiveMessage = (data: any) => { |
|
|
|
if (data.cmdId === cmdId) { |
|
|
|
const { currentPoint, index, number } = data |
|
|
@ -238,11 +240,7 @@ const finishMessage = (data: any) => { |
|
|
|
const drawLine = async (index: number, point: { x: number, y: number }, number: number) => { |
|
|
|
console.log('drawLine', sprayRefs.value[index], index, point, number) |
|
|
|
await nextTick(() => { |
|
|
|
if (!isActive) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (!(sprayRefs.value[index].hasLine(number))) { |
|
|
|
if (!sprayRefs.value[index].hasLine(number)) { |
|
|
|
sprayRefs.value[index].addLine(colors[number]) |
|
|
|
} |
|
|
|
sprayRefs.value[index].updateLine(point, number, colors[number]) |
|
|
@ -346,7 +344,7 @@ const rules = { |
|
|
|
const addVisible = ref(false) |
|
|
|
const ok = async () => { |
|
|
|
addVisible.value = false |
|
|
|
matrixCraftList.value = await getListByMatrixId(form.value.matrixId) |
|
|
|
matrixCraftList.value = await getListByMatrixId(form.value.matrixId as number) |
|
|
|
} |
|
|
|
|
|
|
|
const upDateLoading = ref(false) |
|
|
@ -381,28 +379,26 @@ const addCraft = () => { |
|
|
|
<template> |
|
|
|
<div class="spray-container"> |
|
|
|
<el-form ref="formRef" label-width="120" :model="form" :rules="rules"> |
|
|
|
<div class="spray-left"> |
|
|
|
<div> |
|
|
|
<ft-button type="primary" @click="startWork"> |
|
|
|
<div class="button-box"> |
|
|
|
<ft-button type="primary" :disabled="systemStore.systemStatus.spraying" @click="startWork"> |
|
|
|
开始喷涂 |
|
|
|
</ft-button> |
|
|
|
<ft-button type="primary" @click="updateParam"> |
|
|
|
<ft-button type="primary" :disabled="!systemStore.systemStatus.spraying" @click="updateParam"> |
|
|
|
调整参数 |
|
|
|
</ft-button> |
|
|
|
<ft-button @click="pauseWork"> |
|
|
|
<ft-button type="primary" :disabled="!systemStore.systemStatus.suspendable" @click="pauseWork"> |
|
|
|
暂停喷涂 |
|
|
|
</ft-button> |
|
|
|
<ft-button @click="continueWork"> |
|
|
|
<ft-button type="primary" :disabled="!systemStore.systemStatus.paused" @click="continueWork"> |
|
|
|
继续喷涂 |
|
|
|
</ft-button> |
|
|
|
<ft-button @click="stopWork"> |
|
|
|
<ft-button type="primary" :disabled="!systemStore.systemStatus.spraying" @click="stopWork"> |
|
|
|
结束喷涂 |
|
|
|
</ft-button> |
|
|
|
</div> |
|
|
|
<div style="display: flex"> |
|
|
|
<div class="select-box" /> |
|
|
|
</div> |
|
|
|
<div style="display: flex; position: relative"> |
|
|
|
<div class="spray-box"> |
|
|
|
<div class="spray-left"> |
|
|
|
<div style="display: flex; position: relative;height: fit-content"> |
|
|
|
<div v-show="maskVisible" class="mask-box" /> |
|
|
|
<div |
|
|
|
v-for="(p, index) in form.position" |
|
|
@ -413,7 +409,7 @@ const addCraft = () => { |
|
|
|
玻片{{ index + 1 }} |
|
|
|
</p> |
|
|
|
<TrayGraph ref="sprayRefs" :container="`spray-${index + 1}`" :select="p.select" /> |
|
|
|
<el-checkbox v-model="p.select" style="margin-top: 10px" /> |
|
|
|
<el-checkbox v-model="p.select" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -486,7 +482,8 @@ const addCraft = () => { |
|
|
|
<el-input v-model="form.times" type="number" /> |
|
|
|
<span class="unit-text">次</span> |
|
|
|
</el-form-item> |
|
|
|
<div style="display: flex; justify-content: center"> |
|
|
|
<el-form-item> |
|
|
|
<div style="display: flex; justify-content: center;width: 100%"> |
|
|
|
<ft-button type="primary" :loading="upDateLoading" @click="updateCraft"> |
|
|
|
更新工艺 |
|
|
|
</ft-button> |
|
|
@ -494,6 +491,8 @@ const addCraft = () => { |
|
|
|
保存到新工艺 |
|
|
|
</ft-button> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
<el-drawer v-model="infoVisible" title="调整参数" direction="rtl" :close-on-click-modal="false"> |
|
|
@ -537,7 +536,6 @@ const addCraft = () => { |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
</el-drawer> |
|
|
|
<!-- <start-spray v-model="wsList" :visible @close="visible = false" /> --> |
|
|
|
<Edit v-if="addVisible" :matrix-list :form-data other-page @ok="ok" @cancel="addVisible = false" /> |
|
|
|
</div> |
|
|
|
</template> |
|
|
@ -550,11 +548,20 @@ const addCraft = () => { |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
justify-content: space-between; |
|
|
|
overflow: auto; |
|
|
|
.button-box { |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
} |
|
|
|
.spray-box { |
|
|
|
display: flex; |
|
|
|
justify-content: space-between; |
|
|
|
.spray-left { |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
justify-content: center |
|
|
|
} |
|
|
|
.spray-form { |
|
|
|
display: flex; |
|
|
@ -562,6 +569,8 @@ const addCraft = () => { |
|
|
|
justify-content: center; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
.el-input, |
|
|
|
.el-select { |
|
|
@ -601,7 +610,7 @@ const addCraft = () => { |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
background: rgba(255, 255, 255, 0.1); |
|
|
|
z-index: 5000; |
|
|
|
z-index: 2000; |
|
|
|
} |
|
|
|
.tray-name { |
|
|
|
color: var(--el-color-primary); |
|
|
|