0.0.5.1
This commit is contained in:
@@ -88,11 +88,10 @@ const D3OrgChartFlowComponent = forwardRef<D3OrgChartRef, D3OrgChartFlowProps>(
|
||||
const member = members[currentId]
|
||||
if (!member) continue
|
||||
|
||||
// 获取配偶信息,确保配偶存在于members中
|
||||
let spouse = null
|
||||
if (member.spouseIds?.[0] && members[member.spouseIds[0]]) {
|
||||
spouse = members[member.spouseIds[0]]
|
||||
}
|
||||
// 获取所有配偶信息,确保配偶存在于members中
|
||||
const spouses = member.spouseIds
|
||||
?.map(id => members[id])
|
||||
.filter(Boolean) || []
|
||||
|
||||
// 确定父节点ID - 只有根节点的parentId为null
|
||||
let parentId: string | null = null
|
||||
@@ -135,8 +134,8 @@ const D3OrgChartFlowComponent = forwardRef<D3OrgChartRef, D3OrgChartFlowProps>(
|
||||
birthPlace: member.birthPlace || '',
|
||||
gender: member.gender === 'MALE' ? '男' : '女',
|
||||
avatarImageId: member.avatarImageId,
|
||||
spouseName: spouse?.fullName || '',
|
||||
spouseId: spouse?.id || null,
|
||||
spouseName: spouses.length > 0 ? spouses.map(s => s.fullName).join(', ') : '',
|
||||
spouseId: spouses.length > 0 ? spouses[0].id : null,
|
||||
hasChildren: Object.values(members).some(m => m.fatherId === member.id || m.motherId === member.id),
|
||||
ageText: ageText
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user