update app edit

This commit is contained in:
yumaojun03 2025-08-24 09:27:02 +08:00
parent 55bd699475
commit 56caa73209
2 changed files with 22 additions and 12 deletions

View File

@ -51,8 +51,7 @@
</a-table-column>
</template>
</a-table>
<AppFormModel v-model:visible="formVisible" @update:visible="(v) => console.log(v)" :appData="currentApp"
@submit="fetchAppList" />
<AppFormModel v-model:visible="formVisible" :appData="currentApp" @submit="fetchAppList" />
</a-card>
</div>
</template>

View File

@ -119,13 +119,15 @@ onMounted(() => {
});
// 3. watchresetForm
watch(() => props.appData, (newVal) => {
watch(() => props.visible, (newVal) => {
if (props.appData) {
if (newVal) {
form.value = { ...newVal };
form.value = { ...props.appData };
} else {
resetForm();
}
}, { immediate: true });
}
}, { immediate: true, });
// ,
@ -141,10 +143,19 @@ const handleBeforeOk = async () => {
createAppLoading.value = true
try {
createAppLoading.value = true
if (editMode.value) {
await API.mpaas.AppUpdate(props.appData.id, {
...form.value,
name: form.value.name.trim()
});
return true
} else {
await API.mpaas.AppCreate({
...form.value,
name: form.value.name.trim()
});
}
return true
} catch (error) {
console.error('Error creating app:', error);