|
|
@ -18,36 +18,6 @@ import { nextTick, onMounted, onUnmounted, ref } from 'vue' |
|
|
|
|
|
|
|
const systemStore = useSystemStore() |
|
|
|
|
|
|
|
const sprayRefs = ref<any>([]) |
|
|
|
|
|
|
|
const updateParam = () => { |
|
|
|
updateForm.value = { |
|
|
|
motorZHeight: form.value.motorZHeight, // 高度 |
|
|
|
gasPressure: form.value.gasPressure, // Mpa兆帕 |
|
|
|
volume: form.value.volume, // 单位uL微升 |
|
|
|
highVoltage: form.value.highVoltage, // 是否打开高压 |
|
|
|
highVoltageValue: form.value.highVoltageValue, // 高压值 |
|
|
|
movingSpeed: form.value.movingSpeed, // 毫米 |
|
|
|
} |
|
|
|
infoVisible.value = true |
|
|
|
} |
|
|
|
|
|
|
|
const submitParam = async () => { |
|
|
|
const params = { |
|
|
|
cmdCode: 'matrix_spray_change_param', |
|
|
|
cmdId: '', |
|
|
|
params: updateForm.value, |
|
|
|
} |
|
|
|
form.value = { |
|
|
|
...form.value, |
|
|
|
...updateForm.value, |
|
|
|
} |
|
|
|
await sendControl(params) |
|
|
|
infoVisible.value = false |
|
|
|
} |
|
|
|
|
|
|
|
const infoVisible = ref(false) |
|
|
|
|
|
|
|
onMounted(async () => { |
|
|
|
socket.init(sprayPointReceiveMessage, 'spray_point') |
|
|
|
socket.init(finishMessage, 'cmd_response') |
|
|
@ -67,6 +37,26 @@ onUnmounted(() => { |
|
|
|
socket.unregisterCallback(finishMessage, 'cmd_response') |
|
|
|
}) |
|
|
|
|
|
|
|
const matrixList = ref<{ name: string, id: number }[]>([]) |
|
|
|
const getMatrixList = async () => { |
|
|
|
const res = await listMatrix({ pageNum: 1, pageSize: 100, matrixName: '' }) |
|
|
|
matrixList.value = res.list |
|
|
|
} |
|
|
|
|
|
|
|
const matrixCraftList = ref<any>([]) |
|
|
|
const matrixChange = async (value: number) => { |
|
|
|
form.value.matrixCraftId = undefined |
|
|
|
matrixCraftList.value = await getListByMatrixId(value) |
|
|
|
} |
|
|
|
|
|
|
|
const matrixCraftChange = (value: number) => { |
|
|
|
form.value = { |
|
|
|
...form.value, |
|
|
|
...matrixCraftList.value.find((item: { id: number }) => item.id === value), |
|
|
|
} |
|
|
|
// formRef.value.validate() |
|
|
|
} |
|
|
|
|
|
|
|
const getSpraying = async () => { |
|
|
|
const res: any = await getSprayStatus() |
|
|
|
const sprayTaskSprayedList = res.sprayTaskSprayedList |
|
|
@ -93,10 +83,34 @@ const getSpraying = async () => { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const matrixList = ref([]) |
|
|
|
const getMatrixList = async () => { |
|
|
|
const res = await listMatrix({ pageNum: 1, pageSize: 100, matrixName: '' }) |
|
|
|
matrixList.value = res.list |
|
|
|
const sprayRefs = ref<any>([]) |
|
|
|
|
|
|
|
const infoVisible = ref(false) |
|
|
|
|
|
|
|
const updateParam = () => { |
|
|
|
updateForm.value = { |
|
|
|
motorZHeight: form.value.motorZHeight, // 高度 |
|
|
|
gasPressure: form.value.gasPressure, // Mpa兆帕 |
|
|
|
volume: form.value.volume, // 单位uL微升 |
|
|
|
highVoltage: form.value.highVoltage, // 是否打开高压 |
|
|
|
highVoltageValue: form.value.highVoltageValue, // 高压值 |
|
|
|
movingSpeed: form.value.movingSpeed, // 毫米 |
|
|
|
} |
|
|
|
infoVisible.value = true |
|
|
|
} |
|
|
|
|
|
|
|
const submitParam = async () => { |
|
|
|
const params = { |
|
|
|
cmdCode: 'matrix_spray_change_param', |
|
|
|
cmdId: '', |
|
|
|
params: updateForm.value, |
|
|
|
} |
|
|
|
form.value = { |
|
|
|
...form.value, |
|
|
|
...updateForm.value, |
|
|
|
} |
|
|
|
await sendControl(params) |
|
|
|
infoVisible.value = false |
|
|
|
} |
|
|
|
|
|
|
|
const form = ref<SprayForm>({ |
|
|
@ -145,7 +159,7 @@ const checkPosition = () => { |
|
|
|
} |
|
|
|
}) |
|
|
|
.filter((item: { select: boolean }) => item.select) |
|
|
|
console.log(position) |
|
|
|
|
|
|
|
for (let i = 0; i < position.length; i++) { |
|
|
|
const p = position[i] |
|
|
|
if (p.x1 < 0 || p.y1 < 0 || p.x2 < 0 || p.y2 < 0 || p.x1 > 25 || p.y1 > 75 || p.x2 > 25 || p.y2 > 75) { |
|
|
@ -157,6 +171,7 @@ const checkPosition = () => { |
|
|
|
} |
|
|
|
|
|
|
|
const maskVisible = ref(false) |
|
|
|
|
|
|
|
const startWork = async () => { |
|
|
|
formRef.value.validate(async (valid: boolean) => { |
|
|
|
console.log('valid', valid) |
|
|
@ -185,10 +200,49 @@ const startWork = async () => { |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const pauseWork = async () => { |
|
|
|
const params = { |
|
|
|
cmdCode: 'matrix_spray_pause', |
|
|
|
cmdId: '', |
|
|
|
} |
|
|
|
await sendControl(params) |
|
|
|
} |
|
|
|
|
|
|
|
const continueWork = async () => { |
|
|
|
const params = { |
|
|
|
cmdCode: 'matrix_spray_continue', |
|
|
|
cmdId: '', |
|
|
|
params: { |
|
|
|
motorZHeight: form.value.motorZHeight, // 高度 |
|
|
|
gasPressure: form.value.gasPressure, // Mpa兆帕 |
|
|
|
volume: form.value.volume, // 单位uL微升 |
|
|
|
highVoltage: form.value.highVoltage, // 是否打开高压 |
|
|
|
highVoltageValue: form.value.highVoltageValue, // 高压值 |
|
|
|
movingSpeed: form.value.movingSpeed, // 毫米 |
|
|
|
}, |
|
|
|
} |
|
|
|
await sendControl(params) |
|
|
|
currentSpeed = Number(form.value.movingSpeed) |
|
|
|
} |
|
|
|
|
|
|
|
const stopWork = async () => { |
|
|
|
const params = { |
|
|
|
cmdCode: 'matrix_spray_stop', |
|
|
|
cmdId: '', |
|
|
|
} |
|
|
|
await sendControl(params) |
|
|
|
form.value.position.forEach((item, index) => { |
|
|
|
if (item.select) { |
|
|
|
sprayRefs.value[index].clearLines() |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
let currentSpeed = 0 |
|
|
|
// let poll: ReturnType<typeof setInterval> |
|
|
|
console.log(currentSpeed) |
|
|
|
// let poll: ReturnType<typeof setInterval> |
|
|
|
|
|
|
|
let cmdId = '' |
|
|
|
const sprayPointReceiveMessage = (data: any) => { |
|
|
|
if (data.cmdId === cmdId) { |
|
|
|
const { currentPoint, index, number } = data |
|
|
@ -225,7 +279,7 @@ const sprayPointReceiveMessage = (data: any) => { |
|
|
|
// }, 500) |
|
|
|
// } |
|
|
|
} |
|
|
|
let cmdId = '' |
|
|
|
|
|
|
|
const finishMessage = (data: any) => { |
|
|
|
if (data.cmdId === cmdId) { |
|
|
|
if (data.status === 'fail') { |
|
|
@ -255,78 +309,39 @@ const drawLine = async (index: number, point: { x: number, y: number }, number: |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const pauseWork = async () => { |
|
|
|
const params = { |
|
|
|
cmdCode: 'matrix_spray_pause', |
|
|
|
cmdId: '', |
|
|
|
} |
|
|
|
await sendControl(params) |
|
|
|
} |
|
|
|
|
|
|
|
const continueWork = async () => { |
|
|
|
const params = { |
|
|
|
cmdCode: 'matrix_spray_continue', |
|
|
|
cmdId: '', |
|
|
|
params: { |
|
|
|
motorZHeight: form.value.motorZHeight, // 高度 |
|
|
|
gasPressure: form.value.gasPressure, // Mpa兆帕 |
|
|
|
volume: form.value.volume, // 单位uL微升 |
|
|
|
highVoltage: form.value.highVoltage, // 是否打开高压 |
|
|
|
highVoltageValue: form.value.highVoltageValue, // 高压值 |
|
|
|
movingSpeed: form.value.movingSpeed, // 毫米 |
|
|
|
}, |
|
|
|
} |
|
|
|
await sendControl(params) |
|
|
|
currentSpeed = Number(form.value.movingSpeed) |
|
|
|
} |
|
|
|
|
|
|
|
const stopWork = async () => { |
|
|
|
const params = { |
|
|
|
cmdCode: 'matrix_spray_stop', |
|
|
|
cmdId: '', |
|
|
|
} |
|
|
|
await sendControl(params) |
|
|
|
form.value.position.forEach((item, index) => { |
|
|
|
if (item.select) { |
|
|
|
sprayRefs.value[index].clearLines() |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const matrixCraftList = ref<any>([]) |
|
|
|
const matrixChange = async (value: number) => { |
|
|
|
form.value.matrixCraftId = undefined |
|
|
|
matrixCraftList.value = await getListByMatrixId(value) |
|
|
|
} |
|
|
|
|
|
|
|
const matrixCraftChange = (value: number) => { |
|
|
|
form.value = { |
|
|
|
...form.value, |
|
|
|
...matrixCraftList.value.find((item: { id: number }) => item.id === value), |
|
|
|
} |
|
|
|
// formRef.value.validate() |
|
|
|
} |
|
|
|
|
|
|
|
const rules = { |
|
|
|
matrixId: [{ required: true, message: '请选择基质', trigger: 'change' }], |
|
|
|
const updateFormRules = { |
|
|
|
motorZHeight: [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
trigger: 'blur', |
|
|
|
validator: (rule: any, value: any, callback: any) => { |
|
|
|
setTimeout(() => { |
|
|
|
if (value < 15) { |
|
|
|
callback(new Error('最小安全高度为15mm')) |
|
|
|
} |
|
|
|
else { |
|
|
|
callback() |
|
|
|
if (!value) { |
|
|
|
callback(new Error('请输入高度')) |
|
|
|
} |
|
|
|
else |
|
|
|
if (value < 15) { |
|
|
|
callback(new Error('最小安全高度为15mm')) |
|
|
|
} |
|
|
|
else { |
|
|
|
callback() |
|
|
|
} |
|
|
|
}, 500) |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
gasPressure: [{ required: true, message: '请输入氮气气压', trigger: 'blur' }], |
|
|
|
volume: [{ required: true, message: '请输入基质流速', trigger: 'blur' }], |
|
|
|
volume: [{ required: true, trigger: 'blur', validator: (rule: any, value: any, callback: any) => { |
|
|
|
if (!value) { |
|
|
|
callback(new Error('请输入基质流速')) |
|
|
|
} |
|
|
|
else if (value > 100) { |
|
|
|
callback(new Error('基质流速最大为100 uL/min')) |
|
|
|
} |
|
|
|
else { |
|
|
|
callback() |
|
|
|
} |
|
|
|
} }], |
|
|
|
highVoltageValue: [ |
|
|
|
{ |
|
|
|
required: true, |
|
|
@ -344,9 +359,24 @@ const rules = { |
|
|
|
}, |
|
|
|
}, |
|
|
|
], |
|
|
|
movingSpeed: [{ required: true, message: '请输入移动速度', trigger: 'blur' }], |
|
|
|
movingSpeed: [{ required: true, trigger: 'blur', validator: (rule: any, value: any, callback: any) => { |
|
|
|
if (!value) { |
|
|
|
callback(new Error('请输入移动速度')) |
|
|
|
} |
|
|
|
else if (value > 50) { |
|
|
|
callback(new Error('移动速度最大为50 mm/s')) |
|
|
|
} |
|
|
|
else { |
|
|
|
callback() |
|
|
|
} |
|
|
|
} }], |
|
|
|
} |
|
|
|
|
|
|
|
const rules = { |
|
|
|
matrixId: [{ required: true, message: '请选择基质', trigger: 'change' }], |
|
|
|
spacing: [{ required: true, message: '请输入间距', trigger: 'blur' }], |
|
|
|
times: [{ required: true, message: '请输入喷涂次数', trigger: 'blur' }], |
|
|
|
...updateFormRules, |
|
|
|
} |
|
|
|
|
|
|
|
const addVisible = ref(false) |
|
|
@ -471,7 +501,6 @@ const addCraft = () => { |
|
|
|
<el-input |
|
|
|
v-show="form.highVoltage" |
|
|
|
v-model="form.highVoltageValue" |
|
|
|
max="5000" |
|
|
|
type="number" |
|
|
|
class="voltage-input" |
|
|
|
/> |
|
|
@ -504,7 +533,7 @@ const addCraft = () => { |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
<el-drawer v-model="infoVisible" title="调整参数" direction="rtl" :close-on-click-modal="false"> |
|
|
|
<el-form label-width="auto" style="display: flex; flex-direction: column; justify-content: center"> |
|
|
|
<el-form :model="updateForm" label-width="auto" style="display: flex; flex-direction: column; justify-content: center" :rules="updateFormRules"> |
|
|
|
<div> |
|
|
|
<el-form-item label="Z轴高度" prop="motorZHeight"> |
|
|
|
<el-input v-model="updateForm.motorZHeight" type="number" /> |
|
|
|