Area.razor.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using AntDesign;
  2. using AntDesign.TableModels;
  3. using EasyTemplate.Tool;
  4. using Microsoft.JSInterop;
  5. namespace EasyTemplate.Blazor.Web.Components.Pages.Management.Area;
  6. public partial class Area
  7. {
  8. protected override async Task OnAfterRenderAsync(bool firstRender)
  9. {
  10. if (firstRender)
  11. {
  12. await NavigationManager.RedirectLogin(IJSRuntime);
  13. }
  14. }
  15. /// <summary>
  16. /// 查
  17. /// </summary>
  18. /// <returns></returns>
  19. private async Task Query()
  20. {
  21. Loading = true;
  22. DataSource = await Repository.AsQueryable().OrderBy(x => x.Sort).ToTreeAsync(x => x.Children, x => x.ParentCode, 0, x => x.AreaCode);
  23. Loading = false;
  24. }
  25. private async Task OnChange(QueryModel<SystemArea> query)
  26. => await Query();
  27. /// <summary>
  28. /// 账号
  29. /// </summary>
  30. private string Q_Name { get; set; }
  31. /// <summary>
  32. /// 注入实例
  33. /// </summary>
  34. [Inject] SqlSugarRepository<SystemArea> Repository { get; set; }
  35. /// <summary>
  36. ///
  37. /// </summary>
  38. [Inject] NavigationManager NavigationManager { get; set; }
  39. /// <summary>
  40. ///
  41. /// </summary>
  42. [Inject] IJSRuntime IJSRuntime { get; set; }
  43. /// <summary>
  44. ///
  45. /// </summary>
  46. private ITable Table;
  47. /// <summary>
  48. ///
  49. /// </summary>
  50. private IEnumerable<SystemArea> SelectedRows = [];
  51. /// <summary>
  52. ///
  53. /// </summary>
  54. private List<SystemArea> DataSource;
  55. /// <summary>
  56. ///
  57. /// </summary>
  58. private int Pi = 1;
  59. /// <summary>
  60. ///
  61. /// </summary>
  62. private int Ps = 20;
  63. /// <summary>
  64. ///
  65. /// </summary>
  66. private int _total;
  67. /// <summary>
  68. ///
  69. /// </summary>
  70. private bool Loading = false;
  71. }