From a2873bf3c21bf554329f0e2cd963b3b3654037e0 Mon Sep 17 00:00:00 2001 From: freedakgmail Date: Sun, 30 Nov 2025 20:11:34 +0800 Subject: [PATCH] 0.3.1.4 --- components/tree/d3-org-chart-flow.tsx | 171 +++++++++++++++++--------- components/tree/family-node.tsx | 118 ++++++++++++++---- 2 files changed, 207 insertions(+), 82 deletions(-) diff --git a/components/tree/d3-org-chart-flow.tsx b/components/tree/d3-org-chart-flow.tsx index b3533f6a..b2ad0450 100644 --- a/components/tree/d3-org-chart-flow.tsx +++ b/components/tree/d3-org-chart-flow.tsx @@ -269,25 +269,38 @@ const D3OrgChartFlowComponent = forwardRef( .container(chartRef.current) .data(data) .nodeWidth(() => 160) - .nodeHeight(() => 120) - .childrenMargin(() => 50) - .compactMarginBetween(() => 35) - .compactMarginPair(() => 35) - .neighbourMargin(() => 35) - .siblingsMargin(() => 35) + .nodeHeight(() => 165) + .childrenMargin(() => 70) + .compactMarginBetween(() => 40) + .compactMarginPair(() => 40) + .neighbourMargin(() => 40) + .siblingsMargin(() => 40) .linkUpdate(function (d: any, i: any, arr: any) { - // 加深连线颜色 + // 中国风连线颜色 - 使用深褐色 d3.select(arr[i]) - .attr('stroke', '#475569') - .attr('stroke-width', 2.5) + .attr('stroke', '#78716c') + .attr('stroke-width', 2) }) .buttonContent(({ node }: any) => { return `
${node.children ? `` : ``} ${node.data._directSubordinates || 0}
` }) .nodeContent((d: any) => { const node = d.data - const color = node.gender === '男' ? '#3b82f6' : '#ec4899' - const bgColor = node.gender === '男' ? '#dbeafe' : '#fce7f3' + const isMale = node.gender === '男' + const isDead = !!node.deathYear + + // 庄严正式的中国风配色 + const borderColor = isDead ? '#78716c' : isMale ? '#92400e' : '#9f1239' + const bgGradient = isDead + ? 'linear-gradient(to bottom, #f5f5f4, #e7e5e4)' + : isMale + ? 'linear-gradient(to bottom, #fffbeb, #fef3c7, #fffbeb)' + : 'linear-gradient(to bottom, #fff1f2, #fce7f3, #fff1f2)' + const avatarBorder = isDead ? '#78716c' : isMale ? '#b45309' : '#be185d' + const textColor = isDead ? '#57534e' : '#1c1917' + const subTextColor = isDead ? '#78716c' : '#57534e' + const badgeBg = isDead ? '#57534e' : isMale ? '#92400e' : '#9f1239' + const badgeText = '#fef3c7' // 获取头像URL const avatarUrl = node.avatarUrl ? avatarCache.get(node.avatarUrl) : null @@ -300,87 +313,125 @@ const D3OrgChartFlowComponent = forwardRef( data-member-id="${node.id}" style=" position: relative; - width: 160px; - height: 120px; + width: 150px; + height: 155px; box-sizing: border-box; - background: ${node.deathYear ? '#fafafa' : 'white'}; - border: 2px solid ${color}; - border-radius: 10px; - padding: 8px; - box-shadow: 0 2px 8px rgba(0,0,0,0.1); + background: ${bgGradient}; + border: 3px solid ${borderColor}; + padding: 14px 10px 10px; + box-shadow: 0 4px 12px rgba(0,0,0,0.12); cursor: pointer; transition: all 0.3s; " - onmouseover="this.style.boxShadow='0 4px 12px rgba(0,0,0,0.2)'" - onmouseout="this.style.boxShadow='0 2px 8px rgba(0,0,0,0.1)'" + onmouseover="this.style.boxShadow='0 6px 20px rgba(0,0,0,0.2)'; this.style.transform='scale(1.02)'" + onmouseout="this.style.boxShadow='0 4px 12px rgba(0,0,0,0.12)'; this.style.transform='scale(1)'" > -
+ +
+ + +
+
+
+
+ + +
+ ${node.generation} +
+ + + ${isSelected ? ` +
+ +
+ ` : ''} + + +
+
${avatarUrl ? `${node.name}` - : node.gender === '女' - ? `` - : `` + : `` }
-
-
- ${node.name} - - ${isSelected ? `` : ''} -
-
- ${node.generation} -
+ + +
+ ${node.name} +
-
- ${node.birthYear ? `
- ${node.birthYear}${node.deathYear ? ` - ${node.deathYear}` : ''} - ${node.ageText ? `${node.ageText}` : ''} -
` : ''} - ${node.birthPlace ? `
- ${node.birthPlace} -
` : ''} + +
+ ${node.birthYear ? ` +
+ ${node.birthYear}${node.deathYear ? ` — ${node.deathYear}` : ' —'} +
+ ${node.ageText ? `
${node.ageText}
` : ''} + ` : ''}
+ ${node.spouseName && node.spouseId ? `
- 配偶: ${node.spouseName} + 配偶:${node.spouseName}
` : ''}
diff --git a/components/tree/family-node.tsx b/components/tree/family-node.tsx index a2ae38f5..beec7392 100644 --- a/components/tree/family-node.tsx +++ b/components/tree/family-node.tsx @@ -179,28 +179,92 @@ function PersonCard({ // 调试日志 console.log('PersonCard render:', member.fullName, { canEdit, hasAddOptions, relationMode }) + // 庄严正式的中国风配色 + const isDead = !!member.deathDate + const isMale = member.gender === 'MALE' + const cardContent = (
onSelect?.(member)} > -
+ {/* 内边框装饰 */} +
+ + {/* 四角装饰 - 更精致的角花 */} +
+
+
+
+ + {/* 世代标签 - 庄严印章风格 */} +
{member.generation}世
-
+ {/* 头像 - 方形带庄严边框 */} +
{avatarBlobUrl ? ( ) : ( member.gender === 'FEMALE' ? ( - + ) : ( - + ) )}
-
-
+ {/* 姓名和信息 */} +
+
{member.courtesyName && ( -
字 {member.courtesyName}
+
+ 字 {member.courtesyName} +
)} {lifeSpan && ( -
+
{lifeSpan}
)} {ageText && ( -
+
{ageText}
)} - {member.phone && ( -
- 📱 {member.phone} -
- )}
)