Media.razor 5.6 KB

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