fix(projects): fix manage page drawer operate about data reset. fixed #415, fixed #417

This commit is contained in:
Soybean
2024-05-05 00:41:50 +08:00
parent 734ef9852c
commit f4513e1e38
4 changed files with 16 additions and 22 deletions

View File

@@ -68,11 +68,8 @@ const roleId = computed(() => props.rowData?.id || -1);
const isEdit = computed(() => props.operateType === 'edit');
function handleUpdateModelWhenEdit() {
if (props.operateType === 'add') {
Object.assign(model, createDefaultModel());
return;
}
function handleInitModel() {
Object.assign(model, createDefaultModel());
if (props.operateType === 'edit' && props.rowData) {
Object.assign(model, props.rowData);
@@ -93,7 +90,7 @@ async function handleSubmit() {
watch(visible, () => {
if (visible.value) {
handleUpdateModelWhenEdit();
handleInitModel();
restoreValidation();
}
});