Browse Source

fix: 喷涂设置切换工艺造成选区异常的问题

master
guoapeng 3 weeks ago
parent
commit
466f833e89
  1. 19
      src/components/spray/sprayParams/index.vue
  2. 2
      src/components/spray/trayGraph/index.vue

19
src/components/spray/sprayParams/index.vue

@ -178,16 +178,22 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' |
}, 100)
}
const swiperKey = ref(1)
const matrixCraftChange = async (id: number) => {
loading.value = true
form.value = await getCraftById(id)
console.log(form.value)
await nextTick(() => {
form.value.times?.forEach((item: any, index: number) => {
sprayRefs.value[index].updateSelection(item.x1 * 5, item.y1 * 5, (item.x2 - item.x1) * 5, (item.y2 - item.y1) * 5)
swiperInstance?.update()
swiperKey.value++
setTimeout(() => {
nextTick(() => {
form.value.times?.forEach((item: any, index: number) => {
console.log(item)
sprayRefs.value[index].updateSelection(item.x1 * 5, item.y1 * 5, (item.x2 - item.x1) * 5, (item.y2 - item.y1) * 5)
})
loading.value = false
})
loading.value = false
})
}, 0)
}
const onSlideChange = (swiper: any) => {
@ -249,6 +255,7 @@ const touchendHandle = () => {
<el-tab-pane v-for="(item, index) in form.times" :key="index" :label="`第${index + 1}次`" :name="index" />
</el-tabs>
<Swiper
:key="swiperKey"
:modules="[Pagination, Navigation]"
:pagination="{ clickable: true }"
:navigation="true"

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

@ -188,11 +188,13 @@ const getSelection = () => {
//
const updateSelection = (x: number, y: number, width: number, height: number) => {
if (rect.value) {
console.log(x, y, width, height)
rect.value.position({ x, y })
rect.value.width(width)
rect.value.height(height)
newWidth = width
newHeight = height
rect.value.clearCache()
layer.value.draw()
}
}

Loading…
Cancel
Save