diff --git a/src/views/space/familyTree.vue b/src/views/space/familyTree.vue index e23275ee..878124bb 100644 --- a/src/views/space/familyTree.vue +++ b/src/views/space/familyTree.vue @@ -77,7 +77,7 @@ - + { @@ -399,49 +403,18 @@ export default { } try { - const formData = new FormData(); - // 添加成员信息到 FormData - formData.append('name', this.currentMember.name); - formData.append('parentId', this.currentMember.parentId); - formData.append('relation', this.currentMember.relation); - formData.append('birthDate', this.currentMember.birthDate); - formData.append('phone', this.currentMember.phone); - formData.append('isCurrentUser', this.currentMember.isCurrentUser); - - // 添加图片文件到 FormData - if (this.currentMember.file) { - formData.append('file', this.currentMember.file); - } - const url = this.currentMember.id ? `/family-tree/${this.currentMember.id}` : - '/family-tree'; - + '/family-tree' await request({ url, method: this.currentMember.id ? 'put' : 'post', - data: formData, - headers: { - 'Content-Type': 'multipart/form-data' - } - }); - - ElMessage.success('保存成功'); - this.dialogVisible = false; - this.fetchTreeData(); - - // const url = this.currentMember.id ? - // `/family-tree/${this.currentMember.id}` : - // '/family-tree' - // await request({ - // url, - // method: this.currentMember.id ? 'put' : 'post', - // data: this.currentMember - // }) + data: this.currentMember + }) // console.log('保存成功:',response) 没有response么嘎 - // ElMessage.success('保存成功') - // this.dialogVisible = false - // this.fetchTreeData() + ElMessage.success('保存成功') + this.dialogVisible = false + this.fetchTreeData() } catch (error) { console.log('新增成员失败', this.currentMember) ElMessage.error('保存失败')