Index.cshtml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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
  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 class="ibox-tools rboor">
  18. <a class="btn btn-primary btn-xs p310" id="insert" action="add"><i class="im-plus"></i> 创建新角色</a>
  19. <a class="btn btn-primary btn-xs p310" id="modify" action="edit"><i class="im-pencil2"></i> 编辑</a>
  20. <a class="btn btn-primary btn-xs p310" id="delete" action="remove"><i class="im-remove4"></i> 删除</a>
  21. <a class="btn btn-primary btn-xs p310" id="permission" action="allocation"><i class="im-road"></i> 分配权限</a>
  22. </div>
  23. </div>
  24. <div class="ibox-content">
  25. <!-- search star -->
  26. @using (Ajax.BeginForm("Index", null, new AjaxOptions() { }, new { @id = "form1", @class = "form-horizontal", @method = "get" }))
  27. {
  28. <div class="form-horizontal clearfix">
  29. <div class="col-lg-4 col-sm-4" >
  30. <div class="form-group">
  31. <div class="col-lg-12 col-sm-12 input-group">
  32. @Html.TextBox("Search", null, new { @class = "input-sm form-control", @placeholder = "请输入查询关键词" })
  33. <span class="input-group-btn">
  34. <button type="button" onclick="submit()" class="btn btn-sm btn-primary"> 搜索</button>
  35. </span>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. <!-- search end -->
  41. <div id="example_wrapper" class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  42. <table id="example" class="table table-striped table-bordered table-hover dataTables-example dataTable" cellspacing="0" width="100%">
  43. <thead>
  44. <tr>
  45. <th class="tn" style="width: 40px !important"><input name="checkall" id="checkall" type="checkbox" value=""></th>
  46. <th style="width: 150px !important">角色名称</th>
  47. <th>角色备注</th>
  48. <th style="width: 100px !important">系统预定义</th>
  49. <th style="width: 100px !important">创建者</th>
  50. <th style="width: 135px !important">创建时间</th>
  51. </tr>
  52. </thead>
  53. <tbody>
  54. @{foreach (var item in Model.List)
  55. {
  56. <tr>
  57. <td class="tn"><input name="checkbox_name" type="checkbox" value="@item.ID"></td>
  58. <td style="text-align:left">
  59. <a href="javascript:modify('@item.ID')" listaction="detail"> @item.ROLENAME</a>
  60. </td>
  61. <td>@item.ROLEDESC</td>
  62. <td>@item.ISCUSTOM</td>
  63. <td>@item.USERNAME</td>
  64. <td>@item.CREATEDATE</td>
  65. </tr>
  66. }
  67. }
  68. </tbody>
  69. </table>
  70. <!-- page -->
  71. <div class="bottom">
  72. <div class="dataTables_info" id="example_info" role="status" aria-live="polite">显示第 @Model.BeginPage 至 @Model.EndPage 项结果,共 @Model.Count 项</div>
  73. <div class="dataTables_length" id="example_length">
  74. <label>
  75. 显示
  76. <select name="example_length" onchange="submit()" aria-controls="example" class="form-control input-sm">
  77. <option value="10" @(Model.PageSize == 10 ? "selected" : "")>10</option>
  78. <option value="25" @(Model.PageSize == 25 ? "selected" : "")>25</option>
  79. <option value="50" @(Model.PageSize == 50 ? "selected" : "")>50</option>
  80. <option value="100" @(Model.PageSize == 100 ? "selected" : "")>100</option>
  81. </select> 项结果
  82. </label>
  83. </div>
  84. @CommonHtmlHelper.PaginationPager(Model.Index, Model.PageSize, Model.Count, 7, Model.Url)
  85. <div class="clear"></div>
  86. </div>
  87. <!-- page -->
  88. </div>
  89. }
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. <!-- table end -->
  95. @section scripts{
  96. <script type="text/javascript">
  97. //点击修改
  98. function modify(n) {
  99. dig.addModel('添加/编辑角色', '/Sys/Role/Detail/' + n, 700, 300, function () {
  100. if (this.returnValue == 'yes') {
  101. location.reload();
  102. }
  103. });
  104. }
  105. $(function(){
  106. //添加
  107. $('#insert').click(function () {
  108. dig.addModel('添加/编辑角色', '/Sys/Role/Detail', 700, 300, function () {
  109. if (this.returnValue == 'yes') {
  110. location.reload();
  111. }
  112. });
  113. });
  114. //修改
  115. $('#modify').click(function () {
  116. var vals = '';
  117. var num = 0;
  118. $('input[name="checkbox_name"]:checked').each(function () {
  119. vals = $(this).val();
  120. num++;
  121. });
  122. if (!vals) {
  123. dig.alertError("提示", "对不起,请选中您要操作的记录!");
  124. return;
  125. }
  126. if (num > 1) {
  127. dig.alertError("提示", "对不起,每次只能修改一条记录!");
  128. return;
  129. }
  130. dig.addModel('添加/编辑角色', '/Sys/Role/Detail/' + vals, 700, 300, function () {
  131. if (this.returnValue == 'yes') {
  132. location.reload();
  133. }
  134. });
  135. });
  136. //分配权限
  137. $('#permission').click(function () {
  138. var vals = '';
  139. var num = 0;
  140. $('input[name="checkbox_name"]:checked').each(function () {
  141. vals = $(this).val();
  142. num++;
  143. });
  144. if (!vals) {
  145. dig.alertError("提示", "对不起,请选中您要操作的记录!");
  146. return;
  147. }
  148. if (num > 1) {
  149. dig.alertError("提示", "对不起,每次只能给一个角色分配权限!");
  150. return;
  151. }
  152. dig.addModel('分配权限', '/Sys/Permission/PerAllocation/?id=' + vals + '&tp=role', 780, 500, function () {
  153. if (this.returnValue == 'yes') {
  154. location.reload();
  155. }
  156. });
  157. });
  158. });
  159. </script>
  160. }