SysLogs.cshtml 9.8 KB

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