From d7520e7ac7493d57c0a2eecf53c9385e7af398eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=96=AA=E5=90=8D?= <942005050@qq.com> Date: Wed, 15 Nov 2023 16:12:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80form=20=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E7=BC=96=E8=BE=91=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/BasicForm/src/BasicForm.vue | 37 +++++++++++++--------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/src/components/BasicForm/src/BasicForm.vue b/src/components/BasicForm/src/BasicForm.vue index beb2baf6f..0e3fa5436 100644 --- a/src/components/BasicForm/src/BasicForm.vue +++ b/src/components/BasicForm/src/BasicForm.vue @@ -218,23 +218,30 @@ const submitForm = async () => { const valid = await elForm.validate() if (!valid) return // 针对主子表 明细校验 - if (props.isBusiness && formType.value == 'create') { - const validateForm = await tableFormRef.value.validateForm() - if (!validateForm) { - if (props.tableData.length == 0) { - message.warning('请填写明细信息!') + if (props.isBusiness) { + formLoading.value = true + if (formType.value == 'create') { + const validateForm = await tableFormRef.value.validateForm() + if (!validateForm) { + if (props.tableData.length == 0) { + message.warning('请填写明细信息!') + return + } return } - return - } - // 主子表——提交请求 - formLoading.value = true - try { - const data = unref(formRef)?.formModel - emit('submitForm', formType.value, data ) - // dialogVisible.value = false - } finally { - // formLoading.value = false + // 主子表——提交请求 + try { + const data = unref(formRef)?.formModel + emit('submitForm', formType.value, data ) + } finally { + } + } else { + // 编辑 + try { + const data = unref(formRef)?.formModel + emit('submitForm', formType.value, data ) + } finally { + } } } else { // 基础数据单表——提交请求