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) => {