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 {