Browse Source

fix:自检判断

master
guoapeng 4 months ago
parent
commit
0ae864f40c
  1. 37
      src/components/home/Check/index.vue
  2. 11
      src/components/spray/trayGraph/index.vue
  3. 1
      src/libs/utils.ts
  4. 2
      src/views/spray/index.vue

37
src/components/home/Check/index.vue

@ -22,9 +22,14 @@ const okHandle = () => {
const list = ['x轴是否在原点', 'y轴是否在原点', 'z轴是否在原点']
const status = ref<any>({})
onMounted(async () => {
socket.init(receiveMessage, 'cmd_response')
await change()
})
const change = async () => {
let num = 0
await nextTick(() => {
buttonCloseRef.value.setLoading(true)
buttonCloseRef.value?.setLoading(true)
})
status.value = await getDeviceSelfTest()
@ -36,22 +41,28 @@ onMounted(async () => {
}
}
await interval()
buttonCloseRef.value.setLoading(false)
buttonCloseRef.value?.setLoading(false)
closeVisible.value = false
socket.init(receiveMessage, 'cmd_response')
})
}
const receiveMessage = (data: any) => {
if (data.cmdId === cmdId && data.status === 'success') {
for (let i = 0; i < checkList.value.length; i++) {
checkList.value[i].result = 'padding'
setTimeout(() => {
checkList.value[i].result = 'success'
}, 500)
if (data.cmdId === cmdId) {
if (data.status === 'success') {
for (let i = 0; i < checkList.value.length; i++) {
checkList.value[i].result = 'padding'
setTimeout(() => {
checkList.value[i].result = 'success'
}, 500)
}
buttonRef.value.setLoading(false)
closeVisible.value = true
}
else if (data.status === 'fail') {
FtMessage.error('自检失败')
change()
buttonRef.value.setLoading(false)
closeVisible.value = false
}
buttonRef.value.setLoading(false)
closeVisible.value = true
}
}

11
src/components/spray/trayGraph/index.vue

@ -1,6 +1,6 @@
<script setup lang="ts">
import Konva from 'konva'
import { computed, onMounted, ref, watch } from 'vue'
import { computed, nextTick, onMounted, ref, watch } from 'vue'
const props = defineProps({
container: {
@ -176,9 +176,12 @@ const updateLine = (point: { x: number, y: number }, index: number, stroke: stri
if (!lines.value[index]) {
addLine(stroke)
}
const currentLine = lines.value[index]
currentLine.points([...currentLine.points(), point.x, point.y])
currentLine.getLayer()!.batchDraw() //
nextTick(() => {
const currentLine = lines.value[index]
console.log(currentLine, currentLine.points())
currentLine.points([...currentLine.points(), point.x, point.y])
currentLine.getLayer()!.batchDraw() //
})
}
// line

1
src/libs/utils.ts

@ -109,4 +109,3 @@ const rgbToHex = (r: number, g: number, b: number): string => {
}
export const colors = generateColors(100)
console.log(colors)

2
src/views/spray/index.vue

@ -408,7 +408,7 @@ const addCraft = () => {
<p class="tray-name">
玻片{{ index + 1 }}
</p>
<TrayGraph ref="sprayRefs" :container="`spray-${index + 1}`" :select="p.select" />
<TrayGraph ref="sprayRefs" :key="index" :container="`spray-${index + 1}`" :select="p.select" />
<el-checkbox v-model="p.select" />
</div>
</div>

Loading…
Cancel
Save