GatherCategories.razor 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. @page "/gathercategories"
  2. @using aipmgr.Models
  3. @inject IJSRuntime JS
  4. <Table @ref="GatherCategoryTable" TItem="GatherCategoryModel" AllowResizing="true"
  5. IsPagination="true" PageItemsSource="@PageItemsSource" IsStriped="true" IsBordered="true" IsMultipleSelect="true"
  6. ShowToolbar="true" ShowSearch="true" ShowExtendButtons="true" ShowEmpty="true" ShowLoading="true"
  7. ShowDefaultButtons="false" EditDialogSize="Size.Large" ShowExtendEditButton="false" ShowExtendDeleteButton="false"
  8. ExtendButtonColumnWidth="200" SearchModel="@SearchModel" SearchMode="SearchMode.Top" ShowDeleteButton="false" ShowAddButton="false" ShowEditButton="false"
  9. OnQueryAsync="@OnSearchModelQueryAsync" OnResetSearchAsync="@OnResetSearchAsync">
  10. <TableToolbarTemplate>
  11. <TableToolbarButton TItem="GatherCategoryModel" Color="BootstrapBlazor.Components.Color.Success" Icon="fa fa-plus" Text="新建" TooltipText="新建采集分类" OnClick="@OnAddAsync" />
  12. </TableToolbarTemplate>
  13. <TableColumns>
  14. <TableColumn @bind-Field="@context.Name" TextWrap="false" Editable="true" TextEllipsis="true" Width="130" />
  15. <TableColumn @bind-Field="@context.OrganizationName" TextWrap="false" Width="50" IsReadonlyWhenEdit="true" TextEllipsis="true" />
  16. <TableColumn @bind-Field="@context.Gatherers" Width="120" TextWrap="false" IsReadonlyWhenEdit="true" TextEllipsis="true">
  17. <Template Context="value">
  18. @if (value != null)
  19. {
  20. @string.Join(", ", value.Value.Select(v => v.Name))
  21. }
  22. </Template>
  23. </TableColumn>
  24. <TableColumn @bind-Field="@context.CreateTime" TextWrap="false" IsReadonlyWhenEdit="true" Width="175" TextEllipsis="true" FormatString="yyyy-MM-dd HH:mm:ss" Sortable="true" />
  25. </TableColumns>
  26. <SearchTemplate>
  27. <div class="row g-3 form-inline">
  28. <div class="col-12 col-sm-4">
  29. <Select @bind-Value="@context.OrganizationId" Items="@_organizationItems" ShowLabel="true" />
  30. </div>
  31. <div class="col-12 col-sm-4">
  32. <BootstrapInput TValue="string" @bind-Value="@context.Name" ShowLabel="true" PlaceHolder="请输入..." />
  33. </div>
  34. <div class="col-12 col-sm-4">
  35. <BootstrapInput TValue="string" @bind-Value="@context.GathererName" ShowLabel="true" PlaceHolder="请输入..." />
  36. </div>
  37. </div>
  38. </SearchTemplate>
  39. <RowButtonTemplate Context="value">
  40. <Button Size="Size.ExtraSmall" Color="BootstrapBlazor.Components.Color.Primary" Icon="fa fa-edit" Text="编辑" OnClickWithoutRender="@(()=>OnEditAsync(value) )" />
  41. </RowButtonTemplate>
  42. </Table>
  43. <Modal @ref="_createOrEditModal" OnCloseAsync="OnCloseAsync">
  44. <ModalDialog ShowCloseButton="true" IsCentered="true" Size="Size.Medium" Title="@_title">
  45. <BodyTemplate>
  46. <ValidateForm Model="_currentGatherCategory">
  47. <div class="row g-3 form-inline">
  48. <div class="col-12 col-sm-12">
  49. <BootstrapInput TValue="string" @bind-Value="@_currentGatherCategory.Name" />
  50. </div>
  51. <div class="col-12 col-sm-12">
  52. @if (_changedType == ItemChangedType.Add)
  53. {
  54. <Select Items="@_organizationItems" @bind-Value="@_currentGatherCategory.OrganizationId" OnSelectedItemChanged="OnOrganizationChanged" />
  55. }
  56. else
  57. {
  58. <BootstrapInput TValue="string" @bind-Value="@_currentGatherCategory.OrganizationName" Readonly="true" />
  59. }
  60. </div>
  61. <div class="col-12 col-sm-12">
  62. <MultiSelect Items="@_gathererItems" @bind-Value="@_currentGatherCategory.GatherersValue" OnSelectedItemsChanged="OnGatherersChanged" />
  63. </div>
  64. </div>
  65. </ValidateForm>
  66. </BodyTemplate>
  67. <FooterTemplate>
  68. <Button Text="确定" Icon="fa fa-check" OnClick="@OnConfirmAsync" />
  69. </FooterTemplate>
  70. </ModalDialog>
  71. </Modal>
  72. <MessageBase @ref="_messageBaseRef"></MessageBase>