Area.razor 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. @page "/system/area"
  2. @attribute [ReuseTabsPage(Title = "区域管理")]
  3. <Spin Spinning="Loading">
  4. <Table @ref="Table" AutoHeight TItem="SystemArea" DataSource="DataSource"
  5. @bind-PageSize="Ps" @bind-PageIndex="Pi" TreeChildren="item=>item.Children" @bind-SelectedRows="SelectedRows"
  6. OnChange="OnChange">
  7. <ColumnDefinitions Context="row">
  8. <PropertyColumn Align="ColumnAlign.Center" Property="c => c.AreaName" Title="区域名称" />
  9. <PropertyColumn Align="ColumnAlign.Center" Property="c => c.AreaCode" Title="区域编码" />
  10. <PropertyColumn Align="ColumnAlign.Center" Property="c => c.Level" Title="层级" />
  11. </ColumnDefinitions>
  12. <PaginationTemplate>
  13. <Pagination Class="@(context.PaginationClass + " my-custom-pagination")"
  14. Total="context.Total"
  15. PageSize="context.PageSize"
  16. Current="context.PageIndex"
  17. ShowSizeChanger
  18. ShowQuickJumper
  19. OnChange="context.HandlePageChange" />
  20. </PaginationTemplate>
  21. </Table>
  22. </Spin>
  23. @inject ModalService ModalService;
  24. @inject ConfirmService ComfirmService;
  25. @inject IMessageService _message;
  26. @code {
  27. private async Task OnExpand(SystemArea row)
  28. {
  29. var data = row;
  30. if (data.Children == null)
  31. {
  32. await AddChildren(data);
  33. }
  34. }
  35. async Task AddChildren(SystemArea row)
  36. {
  37. await Task.Delay(1000);
  38. var index = row.Children?.Count() ?? 0;
  39. row.Children = row.Children ?? [];
  40. }
  41. }