setRole.jsp 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@taglib prefix="p" uri="http://www.test.com/jsp/permission" %>
  3. <!doctype html>
  4. <html>
  5. <head>
  6. <%@ include file="../../common/head.jsp"%>
  7. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  8. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  9. <link href="../res/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" />
  10. <script src="../res/js/plugins/bootstrap-table/bootstrap-table.js"></script>
  11. <script src="../res/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js"></script>
  12. <script src="../res/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
  13. <script>
  14. var user_id = "${user.id}";
  15. function test(value,row,index){
  16. // return '<a href="#">' + row['id'] + '</a>';
  17. return '<a href="#">编辑 </a>|<a href="#">删除</a>';
  18. }
  19. // 预览事件
  20. function setUserRole(){
  21. var role_codes = [];
  22. $($('#tab_role').bootstrapTable('getSelections')).each(function() {
  23. role_codes.push(this.role_code);
  24. });
  25. $.post('setUserRole.cs', { roleCodes:role_codes.toString(), userId:user_id }, function(data){
  26. // var index = parent.layer.getFrameIndex(window.name);
  27. // parent.layer.close(index);
  28. closeCurrentDlg();
  29. });
  30. }
  31. function stateFormatter(value, row, index) {
  32. if (row.set === 1) {
  33. return {
  34. checked: true
  35. };
  36. }
  37. if (row.set === 0) {
  38. return {
  39. checked: false
  40. }
  41. }
  42. return value;
  43. }
  44. function doQuery(){
  45. $('#tab_role').bootstrapTable('refresh');
  46. }
  47. function query(params){
  48. var page = params.offset / params.limit + 1;
  49. var dataObj = new Object();
  50. //alert($("#search").val());
  51. dataObj.name=$("#name").val();
  52. /* dataObj.xmCode=$("#id1").val();
  53. dataObj.xmCode=$("#id2").val();
  54. dataObj.xmCode=$("#id3").val();
  55. dataObj.xmCode=$("#id4").val(); */
  56. return { page:page,
  57. pageSize:params.limit,
  58. search:JSON.stringify(dataObj),
  59. sort:params.sort,
  60. order:params.order,
  61. name:$("#name").val()
  62. };
  63. }
  64. </script>
  65. </head>
  66. <body class="gray-bg">
  67. <div class="wrapper wrapper-content animated fadeInRight">
  68. <div class="row row-lg">
  69. <div style="padding-bottom: 10px">
  70. <div class="form-inline">
  71. <div class="form-group">
  72. <label for="name" >角色名称:</label>
  73. <input type="text" placeholder="请输入角色名称" id="name" class="form-control" />
  74. </div>
  75. <button class="btn " type="button" onclick="doQuery()">查询</button>
  76. </div>
  77. </div>
  78. <!-- <div class="ibox " style=""> -->
  79. <!-- <div class="ibox-content"> -->
  80. <div class="row row-lg">
  81. <div class="col-sm-12">
  82. <table id="tab_role"
  83. data-toggle="table"
  84. data-url="getRoleList.cs?userId=${user.id }"
  85. data-method="get"
  86. data-data-type="json"
  87. data-query-params="query"
  88. data-mobile-responsive="true"
  89. >
  90. <thead>
  91. <tr>
  92. <th data-radio="true" data-click-to-select="true" data-formatter="stateFormatter"></th>
  93. <th data-field="role_id" data-visible="false">id</th>
  94. <th data-field="role_code">角色代码</th>
  95. <th data-field="role_name">名称</th>
  96. <th data-field="set" data-visible="false">标识</th>
  97. <!-- <th data-formatter="test">操作</th> -->
  98. </tr>
  99. </thead>
  100. </table>
  101. <button class="btn btn-primary" type="button" onclick="setUserRole()"><i class="fa fa-info"></i>&nbsp;确定</button>
  102. </div>
  103. </div>
  104. </div>
  105. <!-- </div> -->
  106. <!-- </div> -->
  107. </div>
  108. </body>
  109. </html>