This commit is contained in:
freedakgmail
2025-11-30 13:09:52 +08:00
parent 0281885f73
commit 89f1e061d4
146 changed files with 692 additions and 356 deletions
+22 -8
View File
@@ -42,19 +42,29 @@ export default function NewMemberPage() {
// 处理父母信息
if (fatherId) {
data.fatherId = fatherId
// 如果有父亲,尝试获取母亲(父亲的配偶)
const father = getMember(fatherId)
if (father?.spouseIds && father.spouseIds.length > 0) {
data.motherId = father.spouseIds[0]
}
}
if (motherId) {
data.motherId = motherId
// 如果有母亲,尝试获取父亲(母亲的配偶)
}
// 如果只有父亲没有母亲,尝试自动获取母亲(父亲的配偶)
if (fatherId && !motherId) {
const father = getMember(fatherId)
console.log('Looking for mother (father\'s spouse):', { fatherId, father, spouseIds: father?.spouseIds })
if (father?.spouseIds && father.spouseIds.length > 0) {
data.motherId = father.spouseIds[0]
console.log('Found mother:', data.motherId)
}
}
// 如果只有母亲没有父亲,尝试自动获取父亲(母亲的配偶)
if (motherId && !fatherId) {
const mother = getMember(motherId)
console.log('Looking for father (mother\'s spouse):', { motherId, mother, spouseIds: mother?.spouseIds })
if (mother?.spouseIds && mother.spouseIds.length > 0) {
data.fatherId = mother.spouseIds[0]
console.log('Found father:', data.fatherId)
}
}
@@ -63,8 +73,12 @@ export default function NewMemberPage() {
data.spouseIds = [spouseId]
}
// 处理子女信息(添加父母时使用)
if (childId) {
// 处理子女信息
const childrenIds = searchParams.getAll('childrenIds')
if (childrenIds.length > 0) {
data.childrenIds = childrenIds
} else if (childId) {
data.childrenIds = [childId]
}