From d3c0d44d3935cfa3b634d9be613db0c65bc10530 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Wed, 16 Jul 2025 11:01:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B7=A5=E8=89=BA=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E5=B0=86=E9=80=89=E5=8C=BA=E4=B9=9F=E5=B8=A6?= =?UTF-8?q?=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/log/sprayParams/index.vue | 391 +++++++++++++++++++++++++++++ src/components/martixCraft/Edit/index.vue | 8 +- src/components/spray/sprayParams/index.vue | 6 + src/views/log/index.vue | 7 +- 4 files changed, 407 insertions(+), 5 deletions(-) create mode 100644 src/components/log/sprayParams/index.vue diff --git a/src/components/log/sprayParams/index.vue b/src/components/log/sprayParams/index.vue new file mode 100644 index 0000000..d685cc7 --- /dev/null +++ b/src/components/log/sprayParams/index.vue @@ -0,0 +1,391 @@ + + + + + diff --git a/src/components/martixCraft/Edit/index.vue b/src/components/martixCraft/Edit/index.vue index 77baa5e..41f625c 100644 --- a/src/components/martixCraft/Edit/index.vue +++ b/src/components/martixCraft/Edit/index.vue @@ -129,7 +129,12 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' | return } form.value.times.push(cloneDeep(form.value.times.at(-1))) + const selection = sprayRefs.value[activeTab.value].getSelection() + console.log(selection) activeTab.value = form.value.times.length - 1 + nextTick(() => { + sprayRefs.value[activeTab.value].updateSelection(selection.x1 * 5, selection.y1 * 5, (selection.x2 - selection.x1) * 5, (selection.y2 - selection.y1) * 5) + }) } else if (action === 'remove') { if (form.value.times.length <= 1) { @@ -142,9 +147,10 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' | } form.value.times.splice(activeTab.value, 1) } - swiperInstance?.slideTo(activeTab.value) + // 异步任务调用 setTimeout(() => { + swiperInstance?.slideTo(activeTab.value) swiperInstance?.update() }, 100) } diff --git a/src/components/spray/sprayParams/index.vue b/src/components/spray/sprayParams/index.vue index 857b04d..900b11c 100644 --- a/src/components/spray/sprayParams/index.vue +++ b/src/components/spray/sprayParams/index.vue @@ -67,6 +67,7 @@ const loading = ref(false) onMounted(async () => { loading.value = true form.value = cloneDeep(props.formData) + console.log(form.value) form.value.hasSet && (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) @@ -151,7 +152,12 @@ const handleTabsEdit = (targetName: TabPaneName | undefined, action: 'remove' | return } form.value.times.push(cloneDeep(form.value.times.at(-1))) + const selection = sprayRefs.value[activeTab.value].getSelection() + console.log(selection) activeTab.value = form.value.times.length - 1 + nextTick(() => { + sprayRefs.value[activeTab.value].updateSelection(selection.x1 * 5, selection.y1 * 5, (selection.x2 - selection.x1) * 5, (selection.y2 - selection.y1) * 5) + }) } else if (action === 'remove') { if (form.value.times.length <= 1) { diff --git a/src/views/log/index.vue b/src/views/log/index.vue index 89090f7..d2c28c9 100644 --- a/src/views/log/index.vue +++ b/src/views/log/index.vue @@ -4,7 +4,7 @@ import { del, list } from 'apis/log' import { list as matrixList } from 'apis/matrix' import { list as matrixCraftList } from 'apis/matrixCraft' import FtButton from 'components/common/FTButton/index.vue' -import SprayParams from 'components/spray/sprayParams/index.vue' +import SprayParams from 'components/log/sprayParams/index.vue' import { ElMessageBox } from 'element-plus' import { FtMessage } from 'libs/message' import { onMounted, ref } from 'vue' @@ -37,7 +37,7 @@ const getList = async () => { tableData.value = tableData.value.map((item: any) => { return { ...item, - ...JSON.parse(item.matrixInfo), + matrixInfo: JSON.parse(item.matrixInfo), } }) const res1 = await matrixList({ pageNum: 1, pageSize: 1000 }) @@ -76,7 +76,7 @@ const selectCraftVisible = ref(false) const currentFormData = ref({}) const viewParams = (row: any) => { - currentFormData.value = row + currentFormData.value = row.matrixInfo selectCraftVisible.value = true } @@ -138,7 +138,6 @@ const viewParams = (row: any) => {