fix(form): dialog submit event获取到的changeRecords为空

This commit is contained in:
roymondchen 2025-10-28 11:22:08 +08:00
parent fa208372ab
commit 02e1c7f479
3 changed files with 8 additions and 5 deletions

View File

@ -101,8 +101,9 @@ watchEffect(() => {
const submitHandler = async () => { const submitHandler = async () => {
try { try {
const changeRecords = form.value?.changeRecords;
const values = await form.value?.submitForm(); const values = await form.value?.submitForm();
emit('submit', values, { changeRecords: form.value?.changeRecords }); emit('submit', values, { changeRecords });
} catch (e) { } catch (e) {
emit('error', e); emit('error', e);
} }

View File

@ -42,7 +42,7 @@
</TMagicCol> </TMagicCol>
<TMagicCol :span="12"> <TMagicCol :span="12">
<slot name="footer"> <slot name="footer">
<TMagicButton @click="cancel" size="small"> </TMagicButton> <TMagicButton type="default" @click="cancel" size="small"> </TMagicButton>
<TMagicButton v-if="hasStep && stepActive > 1" type="info" size="small" @click="preStep" <TMagicButton v-if="hasStep && stepActive > 1" type="info" size="small" @click="preStep"
>上一步</TMagicButton >上一步</TMagicButton
> >
@ -131,8 +131,9 @@ const closeHandler = () => {
const save = async () => { const save = async () => {
try { try {
const changeRecords = form.value?.changeRecords;
const values = await form.value?.submitForm(); const values = await form.value?.submitForm();
emit('submit', values, { changeRecords: form.value?.changeRecords }); emit('submit', values, { changeRecords });
} catch (e) { } catch (e) {
emit('error', e); emit('error', e);
} }

View File

@ -42,7 +42,7 @@
</TMagicCol> </TMagicCol>
<TMagicCol :span="12"> <TMagicCol :span="12">
<slot name="footer"> <slot name="footer">
<TMagicButton @click="handleClose">关闭</TMagicButton> <TMagicButton type="default" @click="handleClose">关闭</TMagicButton>
<TMagicButton type="primary" :disabled="disabled" :loading="saveFetch" @click="submitHandler">{{ <TMagicButton type="primary" :disabled="disabled" :loading="saveFetch" @click="submitHandler">{{
confirmText confirmText
}}</TMagicButton> }}</TMagicButton>
@ -109,8 +109,9 @@ watchEffect(() => {
const submitHandler = async () => { const submitHandler = async () => {
try { try {
const changeRecords = form.value?.changeRecords;
const values = await form.value?.submitForm(); const values = await form.value?.submitForm();
emit('submit', values, { changeRecords: form.value?.changeRecords }); emit('submit', values, { changeRecords });
} catch (e) { } catch (e) {
emit('error', e); emit('error', e);
} }