|
@ -8,20 +8,14 @@ import route_horizontal from 'assets/images/route_horizontal.png' |
|
|
import route_vertical_active from 'assets/images/route_vertical2.png' |
|
|
import route_vertical_active from 'assets/images/route_vertical2.png' |
|
|
import route_vertical from 'assets/images/route_vertical.png' |
|
|
import route_vertical from 'assets/images/route_vertical.png' |
|
|
import Edit from 'components/martixCraft/Edit/index.vue' |
|
|
import Edit from 'components/martixCraft/Edit/index.vue' |
|
|
import startSpray from 'components/spray/startSpray/index.vue' |
|
|
|
|
|
import TrayGraph from 'components/spray/trayGraph/index.vue' |
|
|
import TrayGraph from 'components/spray/trayGraph/index.vue' |
|
|
import { FtMessage } from 'libs/message' |
|
|
import { FtMessage } from 'libs/message' |
|
|
import { socket } from 'libs/socket' |
|
|
import { socket } from 'libs/socket' |
|
|
import { sendControl } from 'libs/utils' |
|
|
import { sendControl } from 'libs/utils' |
|
|
import { useSystemStore } from 'stores/useSystemStore' |
|
|
|
|
|
import { nextTick, onMounted, ref } from 'vue' |
|
|
import { nextTick, onMounted, ref } from 'vue' |
|
|
|
|
|
|
|
|
const systemStore = useSystemStore() |
|
|
|
|
|
|
|
|
|
|
|
const sprayRefs = ref<any>([]) |
|
|
const sprayRefs = ref<any>([]) |
|
|
|
|
|
|
|
|
const wsList = ref<any>([]) |
|
|
|
|
|
|
|
|
|
|
|
const updateParam = () => { |
|
|
const updateParam = () => { |
|
|
updateForm.value = { |
|
|
updateForm.value = { |
|
|
motorZHeight: form.value.motorZHeight, // 高度 |
|
|
motorZHeight: form.value.motorZHeight, // 高度 |
|
@ -84,8 +78,6 @@ const updateForm = ref({ |
|
|
movingSpeed: undefined, // 移动速度 |
|
|
movingSpeed: undefined, // 移动速度 |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
const visible = ref(false) |
|
|
|
|
|
|
|
|
|
|
|
const formRef = ref() |
|
|
const formRef = ref() |
|
|
|
|
|
|
|
|
const checkPosition = () => { |
|
|
const checkPosition = () => { |
|
@ -134,16 +126,44 @@ const startWork = async () => { |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
console.log(params) |
|
|
console.log(params) |
|
|
sendControl(params) |
|
|
|
|
|
visible.value = true |
|
|
|
|
|
wsList.value = [] |
|
|
|
|
|
socket.init(sprayTskReceiveMessage, 'spray_tsk') |
|
|
|
|
|
socket.init(sprayPointReceiveMessage, 'spray_point') |
|
|
socket.init(sprayPointReceiveMessage, 'spray_point') |
|
|
|
|
|
await sendControl(params) |
|
|
|
|
|
currentSpeed = Number(form.value.movingSpeed) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let currentSpeed = 0 |
|
|
|
|
|
let poll: ReturnType<typeof setInterval> |
|
|
|
|
|
|
|
|
const sprayPointReceiveMessage = (data: any) => { |
|
|
const sprayPointReceiveMessage = (data: any) => { |
|
|
drawLine(data.index, data.point) |
|
|
|
|
|
|
|
|
if (poll) { |
|
|
|
|
|
clearInterval(poll) |
|
|
|
|
|
} |
|
|
|
|
|
const { currentPoint, nextPoint, index } = data |
|
|
|
|
|
// 计算累加的mm |
|
|
|
|
|
const moveDistance = currentSpeed / 2 |
|
|
|
|
|
// y轴移动 |
|
|
|
|
|
if (currentPoint.x === nextPoint.x) { |
|
|
|
|
|
let currentY = currentPoint.y |
|
|
|
|
|
poll = setInterval(() => { |
|
|
|
|
|
currentY += moveDistance |
|
|
|
|
|
if (currentY >= nextPoint.y) { |
|
|
|
|
|
clearInterval(poll) |
|
|
|
|
|
} |
|
|
|
|
|
drawLine(index, { x: currentPoint.x * 5, y: currentY * 5 }) |
|
|
|
|
|
}, 500) |
|
|
|
|
|
} |
|
|
|
|
|
else if (currentPoint.y === nextPoint.y) { |
|
|
|
|
|
// x轴移动 |
|
|
|
|
|
let currentX = currentPoint.x |
|
|
|
|
|
poll = setInterval(() => { |
|
|
|
|
|
currentX += moveDistance |
|
|
|
|
|
if (currentX >= nextPoint.x) { |
|
|
|
|
|
clearInterval(poll) |
|
|
|
|
|
} |
|
|
|
|
|
drawLine(index, { x: currentX * 5, y: currentPoint.y * 5 }) |
|
|
|
|
|
}, 500) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const drawLine = async (index: number, point: { x: number, y: number }) => { |
|
|
const drawLine = async (index: number, point: { x: number, y: number }) => { |
|
@ -152,14 +172,10 @@ const drawLine = async (index: number, point: { x: number, y: number }) => { |
|
|
sprayRefs.value[index].addLine() |
|
|
sprayRefs.value[index].addLine() |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
console.log('drawLine', point) |
|
|
sprayRefs.value[index].updateLine(point) |
|
|
sprayRefs.value[index].updateLine(point) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const sprayTskReceiveMessage = (data: any) => { |
|
|
|
|
|
console.log(data) |
|
|
|
|
|
wsList.value.push(data) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const pauseWork = async () => { |
|
|
const pauseWork = async () => { |
|
|
const params = { |
|
|
const params = { |
|
|
cmdCode: 'matrix_spray_pause', |
|
|
cmdCode: 'matrix_spray_pause', |
|
@ -182,6 +198,7 @@ const continueWork = async () => { |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
await sendControl(params) |
|
|
await sendControl(params) |
|
|
|
|
|
currentSpeed = Number(form.value.movingSpeed) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const stopWork = async () => { |
|
|
const stopWork = async () => { |
|
@ -289,7 +306,7 @@ const addCraft = () => { |
|
|
<ft-button @click="continueWork"> |
|
|
<ft-button @click="continueWork"> |
|
|
继续喷涂 |
|
|
继续喷涂 |
|
|
</ft-button> |
|
|
</ft-button> |
|
|
<ft-button :disabled="systemStore.systemStatus.spraying" @click="stopWork"> |
|
|
|
|
|
|
|
|
<ft-button @click="stopWork"> |
|
|
结束喷涂 |
|
|
结束喷涂 |
|
|
</ft-button> |
|
|
</ft-button> |
|
|
</div> |
|
|
</div> |
|
@ -421,7 +438,7 @@ const addCraft = () => { |
|
|
</div> |
|
|
</div> |
|
|
</el-form> |
|
|
</el-form> |
|
|
</el-drawer> |
|
|
</el-drawer> |
|
|
<start-spray v-model="wsList" :visible @close="visible = false" /> |
|
|
|
|
|
|
|
|
<!-- <start-spray v-model="wsList" :visible @close="visible = false" /> --> |
|
|
<Edit v-if="addVisible" :matrix-list :form-data other-page @ok="ok" @cancel="addVisible = false" /> |
|
|
<Edit v-if="addVisible" :matrix-list :form-data other-page @ok="ok" @cancel="addVisible = false" /> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|