Media.razor 7.4 KB

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