Media.razor 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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))" style="width:30%" />
  35. <span>更新时间</span><RangePicker TValue="DateTime?[]" OnChange="@(date => onDateChage(date, 2))" style="width:30%" />
  36. </div>
  37. <div class="filter_row">
  38. <span>播放时段</span><RangePicker TValue="DateTime?[]" OnChange="@(date => onDateChage(date, 3))" Picker="DatePickerType.Time" Format="@("HH")" style="width:30%" />
  39. <span>油站</span><Input Placeholder="油站" @bind-Value="filterData.searchSiteName" Style="width:30%" />
  40. </div>
  41. <div class="filter_row" style="justify-content:start">
  42. <Button Icon="search" OnClick="Query" Style="margin-right:2%">查询</Button>
  43. <Button Icon="reload" OnClick="HandleReset" Style="margin-right:2%">重置</Button>
  44. <Button Icon="upload" OnClick="@(() => ShowDialog(1, null))">上传广告</Button>
  45. </div>
  46. </div>
  47. <UpdateMediaDialog onCallback="OnDialogCallback" onVisibleCallback="@((data) => OnDialogVisibleCallback(1,data))" @bind-IsVisible="isOpen" @bind-model="model" />
  48. <MediaPreview onVisibleCallback="@((data) => OnDialogVisibleCallback(2, data))" @bind-IsVisible="isPreviewOpen" @bind-media="previewModel" />
  49. <Table @ref="_Table" AutoHeight TItem="MediaInfoModel" DataSource="_DataSource" PageSize="filterData.pageSize" Total="Total"
  50. OnChange="OnChange">
  51. <ColumnDefinitions Context="row">
  52. <PropertyColumn Property="c => c.FileName" Title="文件名" />
  53. <PropertyColumn Property="c => c.MediaUploader" Title="操作人" />
  54. <PropertyColumn Property="c => c.SiteName" Title="油站" />
  55. <PropertyColumn Property="c=>c.MediaState" Title="文件状态">
  56. @{
  57. var tag = row.MediaState == 1 ? "可用" : "禁用";
  58. var color = row.MediaState == 1 ? TagColor.Green : TagColor.Red;
  59. }
  60. <Tag Color="@color">@tag</Tag>
  61. </PropertyColumn>
  62. <PropertyColumn Property="c => Utils.MachineStateJsonToString(c.MachineStateList)" Title="油机状态" />
  63. <PropertyColumn Property="c => c.StartTime" Title="播放时段">
  64. @{
  65. var tag = $"{row.StartTime}-{row.EndTime}";
  66. }
  67. <Tag>@tag</Tag>
  68. </PropertyColumn>
  69. <PropertyColumn Property="c => Utils.JoinDateTime(c.EffecitiveTime,c.FailureTime)" Title="有效时间段" />
  70. <PropertyColumn Property="c => c.EditTime" Title="修改日期" />
  71. <PropertyColumn Property="c => c.Remark" Title="备注" />
  72. <ActionColumn Width="180" Title="操作" Fixed="ColumnFixPlacement.Right">
  73. <Button Type="ButtonType.Primary" Color="Color.Blue6" OnClick="@(() => ShowPreviewDialog(row))">预览</Button>
  74. <Button Type="ButtonType.Primary" Color="Color.Blue6" OnClick="@(() => ShowDialog(2, row))">编辑</Button>
  75. <Button Type="ButtonType.Primary" Color="Color.Red6" OnClick="@(() => ShowDialog(3, row))">删除</Button>
  76. </ActionColumn>
  77. </ColumnDefinitions>
  78. <PaginationTemplate>
  79. <Pagination Class="@(context.PaginationClass + " my-custom-pagination")"
  80. Total="Total"
  81. PageSize="filterData.pageSize"
  82. Current="filterData.currentPage"
  83. ShowSizeChanger="true"
  84. ShowQuickJumper="true"
  85. OnChange="OnPageChange"
  86. ShowTotal="showTotal" />
  87. </PaginationTemplate>
  88. </Table>
  89. </Spin>
  90. <style>
  91. .filter_box{
  92. display:flex;
  93. flex-direction:column;
  94. align-items:center;
  95. background:#ffffff;
  96. padding:2%;
  97. }
  98. .filter_row{
  99. display:flex;
  100. flex-direction:row;
  101. justify-content:space-between;
  102. align-items:center;
  103. width:100%;
  104. margin-top:2%;
  105. }
  106. </style>