From 6092f2b24adb848567b84264a55882dbdf8da749 Mon Sep 17 00:00:00 2001 From: guoapeng Date: Tue, 15 Jul 2025 20:18:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B7=A5=E8=89=BA=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=92=8C=E5=96=B7=E6=B6=82=E5=8F=82=E6=95=B0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=A0=A1=E9=AA=8C=E8=87=AA=E5=8A=A8=E5=AE=9A?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/martixCraft/Edit/index.vue | 11 ++++++----- src/components/spray/sprayParams/index.vue | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/components/martixCraft/Edit/index.vue b/src/components/martixCraft/Edit/index.vue index 2205141..77baa5e 100644 --- a/src/components/martixCraft/Edit/index.vue +++ b/src/components/martixCraft/Edit/index.vue @@ -85,12 +85,13 @@ const formRef = ref() const okLoading = ref(false) const okHandle = () => { - formRef.value.validate(async (valid: any) => { + formRef.value.validate(async (valid: any, err: any) => { if (!valid) { - // const keys = Object.keys(err) - // if (!keys.includes('matrixId') && !keys.includes('name')) { - // - // } + const keys = Object.keys(err).filter((item: string) => item.split('.').length === 3).map((item: string) => Number(item.split('.')[1])).sort((a, b) => a - b) + if (keys.length) { + activeTab.value = keys[0] + swiperInstance?.slideTo(activeTab.value) + } return } okLoading.value = true diff --git a/src/components/spray/sprayParams/index.vue b/src/components/spray/sprayParams/index.vue index f1052be..857b04d 100644 --- a/src/components/spray/sprayParams/index.vue +++ b/src/components/spray/sprayParams/index.vue @@ -85,11 +85,11 @@ const okLoading = ref(false) const okHandle = () => { formRef.value.validate(async (valid: any, err: any) => { if (!valid) { - console.log(err) - // const keys = Object.keys(err) - // if (!keys.includes('matrixId') && !keys.includes('name')) { - // - // } + const keys = Object.keys(err).filter((item: string) => item.split('.').length === 3).map((item: string) => Number(item.split('.')[1])).sort((a, b) => a - b) + if (keys.length) { + activeTab.value = keys[0] + swiperInstance?.slideTo(activeTab.value) + } return } try { @@ -112,11 +112,11 @@ const okHandle = () => { const updateCraftAndOk = () => { formRef.value.validate(async (valid: any, err: any) => { if (!valid) { - console.log(err) - // const keys = Object.keys(err) - // if (!keys.includes('matrixId') && !keys.includes('name')) { - // - // } + const keys = Object.keys(err).filter((item: string) => item.split('.').length === 3).map((item: string) => Number(item.split('.')[1])).sort((a, b) => a - b) + if (keys.length) { + activeTab.value = keys[0] + swiperInstance?.slideTo(activeTab.value) + } return } try {