diff --git a/src/components/Detail/src/Detail.vue b/src/components/Detail/src/Detail.vue index 3fa0c33b6..45ab2b064 100644 --- a/src/components/Detail/src/Detail.vue +++ b/src/components/Detail/src/Detail.vue @@ -696,7 +696,6 @@ const openDetail = async (row: any, titleName: any, titleValue: any, tableName: const updateList = ()=>{ getList() } -defineExpose({ openDetail, formRef ,updateList}) // 提供 open 方法,用于打开弹窗 // 获取备注列表 const getRemarkList = async () => { @@ -859,21 +858,39 @@ const submitForm = async (formType, data) => { const rs = (await props.detailValidate) ? await props.detailValidate(data) : true if (!rs) return if (formType === 'create') { - await props.apiCreate(data) - message.success(t('common.createSuccess')) + if(props.apiCreate){ + await props.apiCreate(data) + message.success(t('common.createSuccess')) + }else{ + emit('handleSubmitForm',formType, data) + } } else { - await props.apiUpdate(data) - message.success(t('common.updateSuccess')) + if(props.apiUpdate){ + await props.apiUpdate(data) + message.success(t('common.updateSuccess')) + }else{ + emit('handleSubmitForm',formType, data) + } + + } + if (formType === 'create'&&props.apiCreate||formType === 'update'&&props.apiUpdate) { + emit('handleMainFefresh') + formRef.value.dialogVisible = false + // 刷新当前列表 + await getList() + updateKey.value += 1 } - emit('handleMainFefresh') - formRef.value.dialogVisible = false - // 刷新当前列表 - await getList() - updateKey.value += 1 } finally { formRef.value.formLoading = false } } +//明细--新增,编辑,页面单独处理--用此方法刷新 +const submitUpdateList = async ()=>{ + formRef.value.dialogVisible = false + // 刷新当前列表 + await getList() + updateKey.value += 1 +} const searchTableSuccess1 = (formField, searchField, val, formRef) => { @@ -904,6 +921,8 @@ const emit = defineEmits([ 'detailBasicFormOnChange', 'formFormDateChange', 'buttonBaseClick', + 'handleMainFefresh', + 'handleSubmitForm' ]) /** 删除按钮操作 */ const handleDelete = async (id: number) => { @@ -997,6 +1016,8 @@ watch( getList() } ) +defineExpose({ openDetail, formRef ,updateList,submitUpdateList}) // 提供 open 方法,用于打开弹窗 +