Index.cshtml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. @using Hospital.Core.Dict
  2. @using Webdiyer.WebControls.Mvc
  3. @using Hospital.Model.Models
  4. @model PagedList<Hospital.Model.Models.Q_Roles>
  5. @{
  6. ViewBag.Title = "角色管理";
  7. }
  8. @section head
  9. {
  10. <link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui/bootstrap/easyui.css">
  11. }
  12. <div class="page-header">
  13. <h3>
  14. @if (ViewBag.Logo != null)
  15. {
  16. <img src="@ViewBag.Logo" id="logoImg" style="margin:0px 5px 5px 0px;" />
  17. }
  18. <i class="fa fa-sitemap"></i> @ViewBag.Title
  19. <a href="@Url.Action("Index","MAdmin")" class='backbutton'><i class="icon-white fa fa-arrow-circle-left"></i>返回</a>
  20. </h3>
  21. </div>
  22. <div class="list-toolbar clearfix">
  23. @using (Html.BeginForm("Index", "Roles", FormMethod.Get, new { @class = "form-horizontal", @id = "report-list-filter" }))
  24. {
  25. <ul class="unstyled">
  26. <li>
  27. @Html.Label("角色名称")
  28. @Html.TextBox("rolename", Request.QueryString["rolename"], new { @style = "width:200px;" })
  29. </li>
  30. <li>
  31. <label>&nbsp;</label>
  32. <div class="btn-group">
  33. <button class="btn btn-primary" type="submit" style="margin:0px;"><i class="fa fa-filter"></i> 筛选</button>
  34. <button class="btn show-tooltip" type="reset" title="清除筛选结果,显示全部。" style="margin:0px;"><i class="icon-remove mg-r-0"></i></button>
  35. </div>
  36. </li>
  37. </ul>
  38. }
  39. </div>
  40. <div class="btn-toolbar">
  41. <a class="btn btn-primary" href="@Url.Action("Create")"><i class="fa fa-plus-circle fa-fw"></i>新建角色</a>
  42. </div>
  43. @if (Model != null && Model.Any())
  44. {
  45. <table class="table table-hover table-striped">
  46. <thead>
  47. <tr>
  48. <th>序号</th>
  49. <th>角色名称</th>
  50. <th>角色描述</th>
  51. <th>操作</th>
  52. </tr>
  53. </thead>
  54. <tbody>
  55. @{
  56. var xuhao = 1;
  57. }
  58. @foreach (var item in Model)
  59. {
  60. <tr id="item-@item.ID">
  61. <td>@xuhao</td>
  62. <td>@item.RolesName</td>
  63. <td>@item.RolesDescription</td>
  64. <td>
  65. @if(item.ID !=1){
  66. <div class="btn-group">
  67. <a class="btn btn-mini btn-primary" href="@Url.Action("Edit", "Roles", new { @id = @item.ID, @returnUrl = HttpUtility.UrlEncode(Request.RawUrl) })"><i class="fa fa-edit"></i> 编辑</a>
  68. <a class="btn btn-mini btn-info delete" data-id="@item.ID"><i class="fa fa-remove"></i> 删除</a>
  69. </div>
  70. }
  71. else
  72. {
  73. <a class="btn btn-mini btn-warning"><i class="fa fa-warning"></i> 该角色不可编辑</a>
  74. }
  75. </td>
  76. </tr>
  77. xuhao = xuhao + 1;
  78. }
  79. </tbody>
  80. </table>
  81. <div class="pagination">
  82. <p class="status">共 @Model.TotalItemCount 条记录,页 @Model.CurrentPageIndex / @Model.TotalPageCount</p>
  83. @Html.Pager(Model, new PagerOptions
  84. {
  85. PageIndexParameterName = "page",
  86. ContainerTagName = "ul",
  87. PagerItemWrapperFormatString = "<li>{0}</li>",
  88. CurrentPagerItemWrapperFormatString = "<li class='active'><span>{0}</span></li>",
  89. SeparatorHtml = "",
  90. GoToPageSectionWrapperFormatString = "<li class='goto'><span>{0}</span></li>",
  91. ShowPageIndexBox = true,
  92. NumericPagerItemCount = 5
  93. })
  94. </div>
  95. <div class="form-actions">
  96. <input type="hidden" id="page" value="@Request.Params["page"]"/>
  97. </div>
  98. }
  99. else
  100. {
  101. <div class="alert alert-block">
  102. <i class="fa fa-info-circle"></i><strong>没有相关数据。</strong>
  103. </div>
  104. }
  105. <div class="hide">
  106. <div id="comment-remove-confirm-dialog" title="确认">
  107. <p>
  108. 确定要删除这个角色吗?如果要删除,那么拥有这个角色的用户将失去这个角色。
  109. </p>
  110. </div>
  111. </div>
  112. @section scripts {
  113. <script src="~/Scripts/jquery.easyui.min.js"></script>
  114. <script type="text/javascript">
  115. var global = {
  116. urls: {
  117. deleteRole: '@Url.Action("Delete")'
  118. }
  119. }
  120. $(".delete").click(function () {
  121. var my = $(this);
  122. var id = $(this).data("id");
  123. $("#comment-remove-confirm-dialog").dialog({
  124. title: "提示",
  125. width: 600,
  126. resizable: false,
  127. modal: true,
  128. buttons: {
  129. "确定": function () {
  130. $.post(global.urls.deleteRole, { id: id }).done(function (data) {
  131. if (data == true) {
  132. my.closest("tr").remove();
  133. }
  134. });
  135. $(this).dialog("close");
  136. },
  137. "取消": function () {
  138. $(this).dialog("close");
  139. }
  140. }
  141. });
  142. });
  143. </script>
  144. }