Index.cshtml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. @{
  2. ViewBag.Title = "Index";
  3. Layout = "~/Views/Shared/_Layout.cshtml";
  4. }
  5. @using MES.Production.Service;
  6. @using Central.Control.Domain;
  7. @using Ant.Service.Common;
  8. @using Ant.Service.Common.Enums;
  9. @using CommonToolHelper;
  10. @model PageInfo<SYS_LOG>
  11. <!-- table star -->
  12. <div class="row col-lg-12">
  13. <div class="wrapper wrapper-content animated fadeInUp">
  14. <div class="ibox">
  15. <div class="ibox-title">
  16. <h5>系统日志管理</h5>
  17. </div>
  18. <div class="ibox-content">
  19. <!-- search star -->
  20. @using (Ajax.BeginForm("Index", null, new AjaxOptions() { }, new { @id = "form1", @class = "form-horizontal", @method = "get" }))
  21. {
  22. <div class="form-horizontal clearfix">
  23. <div class="col-lg-4 col-sm-3 pl0" style="width:55%;">
  24. <div class="form-group">
  25. <label class="control-label" style="width:50px; float:left;">级别:</label>
  26. <div class="col-lg-8 col-sm-7" style="width:120px !important;">
  27. <select id="Level" name="Level" class="input-sm form-control input-s-sm inline" onchange="submit()">
  28. <option value="">全部</option>
  29. <option value="INFO" @(ViewData["lev"] != null && ViewData["lev"].ToString() == "INFO" ? "selected" : "")>普通</option>
  30. <option value="WARN" @(ViewData["lev"] != null && ViewData["lev"].ToString() == "WARN" ? "selected" : "")>警告</option>
  31. <option value="ERROR" @(ViewData["lev"] != null && ViewData["lev"].ToString() == "ERROR" ? "selected" : "")>错误</option>
  32. <option value="FATAL" @(ViewData["lev"] != null && ViewData["lev"].ToString() == "FATAL" ? "selected" : "")>异常</option>
  33. </select>
  34. </div>
  35. <label class="control-label" style="width:50px; float:left;">动作:</label>
  36. <div class="col-lg-8 col-sm-7" style="width:120px !important;">
  37. <select id="actions" name="actions" class="input-sm form-control input-s-sm inline" onchange="submit()">
  38. <option value="">全部</option>
  39. @{
  40. var list = ViewData["logaction"] as Dictionary<string, string>;
  41. foreach (var item in list)
  42. {
  43. <option value="@item.Key" @(ViewData["sellog"] != null && ViewData["sellog"].ToString() == item.Key ? "selected" : "")>@item.Value</option>
  44. }
  45. }
  46. </select>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="col-lg-4 col-sm-4" style="float:right;">
  51. <div class="form-group">
  52. <div class="col-lg-12 col-sm-12 input-group">
  53. @Html.TextBox("Search", null, new { @class = "input-sm form-control", @placeholder = "请输入查询关键词" })
  54. <span class="input-group-btn">
  55. <button type="button" onclick="submit()" class="btn btn-sm btn-primary"> 搜索</button>
  56. </span>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <!-- search end -->
  62. <div id="example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  63. <table id="example" class="table table-striped table-bordered table-hover dataTables-example dataTable" cellspacing="0" width="100%">
  64. <thead>
  65. <tr>
  66. <th style="width: 170px !important">日期</th>
  67. <th style="width: 70px !important">级别</th>
  68. <th style="width: 100px !important">操作用户</th>
  69. <th style="width: 70px !important">动作</th>
  70. <th>消息</th>
  71. </tr>
  72. </thead>
  73. <tbody>
  74. @{foreach (var item in Model.List)
  75. {
  76. <tr>
  77. <td>
  78. <a href="javascript:Show(@item.ID)" title="点击显示详情">
  79. @item.DATES
  80. </a>
  81. </td>
  82. <td>
  83. @{
  84. var dic = Ant.Service.Common.Tools.BindEnums(typeof(Ant.Service.Common.Enums.enumLog4net));
  85. var level = dic.Where(p => p.Key == item.LEVELS).First().Value;
  86. }
  87. @level
  88. </td>
  89. <td title="@item.CLIENTUSER">@item.CLIENTUSER</td>
  90. <td>@{
  91. var dicl = Ant.Service.Common.Tools.BindEnums(typeof(Ant.Service.Common.Enums.enumOperator));
  92. var action = dicl.Where(p => p.Key == item.ACTION);
  93. }
  94. @(action.Any() ? action.First().Value : "")
  95. </td>
  96. <td>@item.MESSAGE</td>
  97. </tr>
  98. }
  99. }
  100. </tbody>
  101. </table>
  102. <!-- page -->
  103. <div class="bottom">
  104. <div class="dataTables_info" id="example_info" post="status" aria-live="polite">显示第 @Model.BeginPage 至 @Model.EndPage 项结果,共 @Model.Count 项</div>
  105. <div class="dataTables_length" id="example_length">
  106. <label>
  107. 显示
  108. <select name="example_length" onchange="submit()" aria-controls="example" class="form-control input-sm">
  109. <option value="10" @(Model.PageSize == 10 ? "selected" : "")>10</option>
  110. <option value="25" @(Model.PageSize == 25 ? "selected" : "")>25</option>
  111. <option value="50" @(Model.PageSize == 50 ? "selected" : "")>50</option>
  112. <option value="100" @(Model.PageSize == 100 ? "selected" : "")>100</option>
  113. </select> 项结果
  114. </label>
  115. </div>
  116. @CommonHtmlHelper.PaginationPager(Model.Index, Model.PageSize, Model.Count, 7, Model.Url)
  117. <div class="clear"></div>
  118. </div>
  119. <!-- page -->
  120. </div>
  121. }
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. <!-- table end -->
  127. @section scripts{
  128. <script type="text/javascript">
  129. //点击展示详情
  130. function Show(n) {
  131. dig.addModel('日志详情', '/Sys/Syslog/Detail/' + n, 600, 450, function () {
  132. });
  133. }
  134. </script>
  135. }