SysLogs.cshtml 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. @using WeApp
  2. @using WeApp.Authorization
  3. @using WeApp.Configuration
  4. @using WeApp.Views.Shared.SearchForm
  5. @{
  6. /**/
  7. ViewBag.ActiveMenu = PermissionNames.PagesSystemMgLogMg; //The menu item will be active for this page.
  8. ViewBag.Title = L("SysLogTitle");
  9. string serviceNames = ViewBag.ServiceNames;
  10. string methodNames = ViewBag.MethodNames;
  11. var searchItems = new SearchFormViewModel(new List<SearchItem>()
  12. {
  13. new SearchItem("methodName", L("methodName")),//.SetSelectItem(methodNames),
  14. new SearchItem("userName", L("userName")),
  15. new SearchItem("clientName",L("clientName")),
  16. new SearchItem("browserInfo", L("browserInfo"))
  17. });
  18. }
  19. @section styles{
  20. <style>
  21. .search-unit {
  22. float: left;
  23. margin-left: 10px;
  24. }
  25. .input-group .form-control.valid {
  26. border: 1px solid #aaa !important;
  27. }
  28. </style>
  29. }
  30. <div class="table-box iwb-bootstrap-table">
  31. @* @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu })*@
  32. <div class="btn-toolbar row" id="tableTool" role="toolbar" aria-label="Toolbar with button groups" style="">
  33. <div class="input-group input-group-sm hidden-sm hidden-xs hidden-sm search-box" style="position: relative; width: 100%; max-width: 100%;margin-bottom: 5px;">
  34. <form id="search-form">
  35. @{
  36. <div class="search-unit" data-index="2" style="width: 32%">
  37. <div class="input-group input-group-sm text-non" style="position: relative; width: 100%;">
  38. <span class="input-group-prepend" style=""><span class="input-group-text">@(L("executionTime"))</span></span>
  39. <input autocomplete="off" class="form-control dataRange KeyWords" id="ExecutionTime" name="ExecutionTime" data-field="ExecutionTime" data-ftype="5" data-etype="4" placeholder="@(L("SearchPlaceholder"))" type="text">
  40. </div>
  41. </div>
  42. <div class="search-unit" data-index="4" style="width: 32%">
  43. <div class="input-group input-group-sm text-non" style="position: relative; width: 100%;">
  44. <span class="input-group-prepend" style=""><span class="input-group-text">@(L("serviceName"))</span></span>
  45. <select id="ServiceName" name="ServiceName" class="form-control KeyWords" data-field="ServiceName" data-ftype="0" data-etype="0" placeholder="@(L("SearchPlaceholder"))...">
  46. <option value="">@(L("Select"))</option>
  47. @Html.Raw(serviceNames)
  48. </select>
  49. </div>
  50. </div>
  51. var selectItemStr = "{";
  52. if (searchItems.SearchItems != null)
  53. {
  54. int i = 0;
  55. <div class="search-unit" data-index="1" style="width: 32%">
  56. <div class="input-group input-group-sm text-non" style="position: relative; width: 100%;">
  57. <select id="Select-KeyField" name="Select-KeyField" class="form-control KeyField" style="width: 100px !important">
  58. @foreach (var item in searchItems.SearchItems)
  59. {
  60. int isSelect = 0;
  61. if (!string.IsNullOrEmpty(item.SelectItemStr))
  62. {
  63. selectItemStr += (selectItemStr == "{" ? "" : ",") + item.SelectItemStr;
  64. isSelect = 1;
  65. }
  66. string selected = i == 0 ? "selected" : "";
  67. int fieldType = (int)item.FieldType;
  68. int expType = (int)item.ExpType;
  69. <option value="@item.Field" data-index="1" data-select="@isSelect" data-field="@item.Field" data-field-type="@fieldType" data-exp-type="@expType" @selected>@item.DisplayName</option>
  70. i++;
  71. }
  72. </select>
  73. <input id="Select-KeyWords" name="Select-KeyWords" data-field="" data-ftype="0" data-etype="6" class="form-control pull-right KeyWords" style="width: calc(100% - 200px) !important; " placeholder="@(L("SearchPlaceholder"))..." autocomplete="off" />
  74. <span id="Search-btn" class="menu-btn input-group-append" data-type="_btnSearch"><span class="input-group-text" style="padding: 0 10px;"><i class="iconfont icon-search "></i></span></span>
  75. </div>
  76. </div>
  77. }
  78. selectItemStr += "}";
  79. }
  80. </form>
  81. </div>
  82. </div>
  83. <table id="table"
  84. data-url="@(IwbConsts.ApiAppUrl)AuditLogs/GetAll"
  85. data-striped="true" data-id-field="id" data-unique-id="id"
  86. data-method="post"
  87. data-side-pagination="server"
  88. data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
  89. data-cache="false"
  90. data-pagination="true"
  91. data-page-size="25"
  92. data-page-number="1"
  93. data-page-list="[25,50,100,200]" data-pagination-detail-h-align="right" data-pagination-h-align="left"
  94. data-click-to-select="true"
  95. data-single-select="true">
  96. <thead>
  97. <tr class="row" id="header">
  98. <th data-field="state" data-checkbox="true"></th>
  99. <th data-align="center" data-field="userName">@(L("userName"))</th>
  100. <th data-align="center" data-field="serviceName">@(L("serviceName"))</th>
  101. <th data-align="center" data-field="methodName">@(L("methodName"))</th>
  102. <th data-align="center" data-field="executionTime" data-formatter="DateTimeFormatter">@(L("executionTime"))</th>
  103. <th data-align="center" data-field="clientIpAddress">@(L("clientIpAddress"))</th>
  104. <th data-align="center" data-field="clientName">@(L("clientName"))</th>
  105. <th data-align="center" data-field="browserInfo">@(L("browserInfo"))</th>
  106. </tr>
  107. </thead>
  108. </table>
  109. </div>
  110. @section modal{
  111. }
  112. @section scripts
  113. {
  114. <script>
  115. $(function () {
  116. var now = new Date();
  117. $('#ExecutionTime').iwbDateRange({
  118. endDate: new Date(now.getTime() ),
  119. startDate: new Date(now.getTime() - 3 * 24 * 60 * 60 * 1000)
  120. });
  121. $(".search-unit select").select2();
  122. $("#Select-KeyField").off("change.keyfield").on("change.keyfield", function () {
  123. var $that = $(this).find("option:selected");
  124. var isSelect = $that.data("select"),
  125. field = $that.data("field"),
  126. expType = $that.data("exp-type"),
  127. fieldType = $that.data("field-type");
  128. changeKeyWord($that, isSelect,field, expType, fieldType);
  129. });
  130. LoadTable();
  131. var selectItem = @Html.Raw(selectItemStr);
  132. function changeKeyWord($that, isSelect, field, expType, fieldType) {
  133. var str;
  134. console.log(fieldType, "-", isSelect);
  135. if (isSelect) {
  136. if (selectItem.length < 0) {
  137. return;
  138. }
  139. str = '<select id="Select-KeyWords" data-field="' + field + '" data-ftype="' + fieldType + '" data-etype="' + expType + '" name="Select-KeyWords" class="form-control pull-right KeyWords" style="width: calc(100% - 200px) !important;" placeholder="@(L("SearchPlaceholder"))..." autocomplete="off" data-placeholder="@(L("SearchPlaceholder"))...">';
  140. str += selectItem[field];
  141. str += '</select>';
  142. $("#Select-KeyWords").next("span.select2").remove();
  143. $("#Select-KeyWords").remove();
  144. $("#Search-btn").before(str);
  145. $("#Select-KeyWords").select2();
  146. if ($("#Select-KeyField").parent().find(".search-btn").length > 0) {
  147. $("#Select-KeyWords").next().find(".select2-selection__arrow").css("right", "30px");
  148. }
  149. } else {
  150. if (fieldType === 1) {
  151. str = ' <input id="Select-KeyWords" data-field="' + field + '" data-ftype="' + fieldType + '" data-etype="' + expType + '" name="Select-KeyWords" class="form-control number pull-right KeyWords" style="width: calc(100% - 200px) !important" placeholder="@(L("SearchPlaceholder"))..." autocomplete="off" />';
  152. } else if (fieldType === 5) {
  153. str = ' <input id="Select-KeyWords" data-field="' + field + '" data-ftype="' + fieldType + '" data-etype="' + expType + '" name="Select-KeyWords" class="form-control dateISO pull-right KeyWords dateRange" style="width: calc(100% - 200px) !important" placeholder="@(L("SearchPlaceholder"))..." autocomplete="off" />';
  154. } else {
  155. str = '<input id="Select-KeyWords" data-field="' + field + '" data-ftype="' + fieldType + '" data-etype="' + expType + '" name="Select-KeyWords" class="form-control pull-right KeyWords" style="width: calc(100% - 200px) !important" placeholder="@(L("SearchPlaceholder"))..." autocomplete="off" />';
  156. }
  157. $("#Select-KeyWords").next("span.select2").remove();
  158. $("#Select-KeyWords").remove();
  159. $("#Search-btn").before(str);
  160. }
  161. //AddSearchEvents();
  162. }
  163. });
  164. </script>
  165. }