u
This commit is contained in:
@@ -35,7 +35,9 @@
|
||||
|
||||
@if (_isExpanded && _currentUser?.Children?.Any() == true)
|
||||
{
|
||||
<CascadingValue Value="this">
|
||||
<OrganizationChartLevel Nodes="_currentUser.Children" Level="1" />
|
||||
</CascadingValue>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -50,6 +50,14 @@ public partial class OrganizationChart
|
||||
LastName = "رضایی",
|
||||
PersonalPurchase = 950000,
|
||||
TeamPurchase = 2100000
|
||||
},
|
||||
new UserNode
|
||||
{
|
||||
Id = 8,
|
||||
FirstName = "فرزاد",
|
||||
LastName = "رضایی",
|
||||
PersonalPurchase = 950000,
|
||||
TeamPurchase = 2100000
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -80,6 +88,14 @@ public partial class OrganizationChart
|
||||
LastName = "رضایی",
|
||||
PersonalPurchase = 1350000,
|
||||
TeamPurchase = 4100000
|
||||
},
|
||||
new UserNode
|
||||
{
|
||||
Id = 7,
|
||||
FirstName = "آرش",
|
||||
LastName = "رضایی",
|
||||
PersonalPurchase = 1350000,
|
||||
TeamPurchase = 4100000
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -13,11 +13,6 @@
|
||||
|
||||
.org-node {
|
||||
position: relative;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.root-node {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
.child-node {
|
||||
|
||||
@@ -7,7 +7,7 @@ public partial class OrganizationChartLevel
|
||||
[Parameter] public List<UserNode>? Nodes { get; set; }
|
||||
[Parameter] public int Level { get; set; } = 1;
|
||||
|
||||
[CascadingParameter] private OrganizationChart ParentChart { get; set; } = default!;
|
||||
[CascadingParameter] private OrganizationChart? ParentChart { get; set; }
|
||||
|
||||
private Size GetAvatarSize(int level)
|
||||
{
|
||||
@@ -21,7 +21,18 @@ public partial class OrganizationChartLevel
|
||||
|
||||
private void ToggleNodeExpand(long userId)
|
||||
{
|
||||
ParentChart?.ToggleNodeExpand(userId);
|
||||
if (ParentChart != null)
|
||||
{
|
||||
ParentChart.ToggleNodeExpand(userId);
|
||||
}
|
||||
}
|
||||
|
||||
private void SafeToggleNodeExpand(long userId)
|
||||
{
|
||||
if (ParentChart != null)
|
||||
{
|
||||
ParentChart.ToggleNodeExpand(userId);
|
||||
}
|
||||
}
|
||||
|
||||
public class UserNode
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
position: relative;
|
||||
margin-top: 40px;
|
||||
margin-top: 80px;
|
||||
}
|
||||
|
||||
.org-level::before {
|
||||
|
||||
Reference in New Issue
Block a user