Media.razor 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. @page "/media/list"
  2. @using AI.Platform.Core.Entity.Media
  3. @using AI.Platform.Page.Pages.Media.Model;
  4. @attribute [ReuseTabsPage(Title = "广告列表")]
  5. <Spin Spinning="Loading">
  6. <div class="filter_box">
  7. <div class="filter_row">
  8. <span>文件名</span><Input Placeholder="请输入要查找的文件名" @bind-Value="filterData.searchFileName" Style="width:30%" />
  9. <span>上传人</span><Input Placeholder="上传人" @bind-Value="filterData.searchMediaUploader" Style="width:30%" />
  10. </div>
  11. <div class="filter_row">
  12. <span>广告状态</span>
  13. <SimpleSelect OnSelectedItemChanged="OnSelectItemChange" Style="width:30%">
  14. <SelectOptions>
  15. <SimpleSelectOption Value="-1" Label="全部" style="width:30%" />
  16. <SimpleSelectOption Value="0" Label="禁用" style="width:30%" />
  17. <SimpleSelectOption Value="1" Label="可用" style="width:30%" />
  18. </SelectOptions>
  19. </SimpleSelect>
  20. <span>油机状态</span>
  21. <SimpleSelect Mode="SelectMode.Multiple" OnSelectedItemsChanged="OnSelectItemsChange" style="width:30%">
  22. <SelectOptions>
  23. <SimpleSelectOption Value="idle" Label="空闲" />
  24. <SimpleSelectOption Value="lock" Label="锁枪" />
  25. <SimpleSelectOption Value="offline" Label="脱机" />
  26. <SimpleSelectOption Value="lift" Label="提枪" />
  27. <SimpleSelectOption Value="authorised" Label="授权" />
  28. <SimpleSelectOption Value="start" Label="开始" />
  29. <SimpleSelectOption Value="fueling" Label="加油中" />
  30. </SelectOptions>
  31. </SimpleSelect>
  32. </div>
  33. <div class="filter_row">
  34. <span>有效时间段</span><RangePicker TValue="DateTime?[]" OnChange="@(date => onDateChage(date,1))" />
  35. <span>更新时间</span><RangePicker TValue="DateTime?[]" OnChange="@(date => onDateChage(date, 2))" />
  36. </div>
  37. <div class="filter_row" style="justify-content:start">
  38. <span style="margin-right:5%">播放时段</span><RangePicker TValue="DateTime?[]" OnChange="@(date => onDateChage(date, 3))" Picker="DatePickerType.Time" Format="@("HH")"/>
  39. </div>
  40. <div class="filter_row" style="justify-content:start">
  41. <Button Icon="search" OnClick="Query" Style="margin-right:2%">查询</Button>
  42. <Button Icon="reload" OnClick="HandleReset" Style="margin-right:2%">重置</Button>
  43. <Button Icon="upload" OnClick="@(() => ShowDialog(1, null))">上传广告</Button>
  44. </div>
  45. </div>
  46. <UpdateMediaDialog onCallback="OnDialogCallback" onVisibleCallback="@((data) => OnDialogVisibleCallback(1,data))" @bind-IsVisible="isOpen" @bind-model="model" />
  47. <MediaPreview onVisibleCallback="@((data) => OnDialogVisibleCallback(2, data))" @bind-IsVisible="isPreviewOpen" @bind-media="previewModel" />
  48. <Table @ref="_Table" AutoHeight TItem="MediaInfoModel" DataSource="_DataSource" PageSize="filterData.pageSize" Total="Total"
  49. OnChange="OnChange">
  50. <ColumnDefinitions Context="row">
  51. <PropertyColumn Property="c => c.FileName" Title="文件名" />
  52. <PropertyColumn Property="c => c.MediaUploader" Title="上传人" />
  53. <PropertyColumn Property="c => c.SiteName" Title="油站" />
  54. <PropertyColumn Property="c=>c.MediaState" Title="文件状态">
  55. @{
  56. var tag = row.MediaState == 1 ? "可用" : "禁用";
  57. var color = row.MediaState == 1 ? TagColor.Green : TagColor.Red;
  58. }
  59. <Tag Color="@color">@tag</Tag>
  60. </PropertyColumn>
  61. <PropertyColumn Property="c => Utils.MachineStateJsonToString(c.MachineStateList)" Title="油机状态" />
  62. <PropertyColumn Property="c => c.StartTime" Title="播放时段">
  63. @{
  64. var tag = $"{row.StartTime}-{row.EndTime}";
  65. }
  66. <Tag>@tag</Tag>
  67. </PropertyColumn>
  68. <PropertyColumn Property="c => Utils.JoinDateTime(c.EffecitiveTime,c.FailureTime)" Title="有效时间段" />
  69. <PropertyColumn Property="c => c.EditTime" Title="修改日期" />
  70. <PropertyColumn Property="c => c.Remark" Title="备注" />
  71. <ActionColumn Width="180" Title="操作" Fixed="ColumnFixPlacement.Right">
  72. <Button Type="ButtonType.Primary" Color="Color.Blue6" OnClick="@(() => ShowPreviewDialog(row))">预览</Button>
  73. <Button Type="ButtonType.Primary" Color="Color.Blue6" OnClick="@(() => ShowDialog(2, row))">编辑</Button>
  74. <Button Type="ButtonType.Primary" Color="Color.Red6" OnClick="@(() => ShowDialog(3, row))">删除</Button>
  75. </ActionColumn>
  76. </ColumnDefinitions>
  77. <PaginationTemplate>
  78. <Pagination Class="@(context.PaginationClass + " my-custom-pagination")"
  79. Total="Total"
  80. PageSize="filterData.pageSize"
  81. Current="filterData.currentPage"
  82. ShowSizeChanger="true"
  83. ShowQuickJumper="true"
  84. OnChange="OnPageChange"
  85. ShowTotal="showTotal" />
  86. </PaginationTemplate>
  87. </Table>
  88. </Spin>
  89. <style>
  90. .filter_box{
  91. display:flex;
  92. flex-direction:column;
  93. align-items:center;
  94. background:#ffffff;
  95. padding:2%;
  96. }
  97. .filter_row{
  98. display:flex;
  99. flex-direction:row;
  100. justify-content:space-between;
  101. align-items:center;
  102. width:100%;
  103. margin-top:2%;
  104. }
  105. </style>