authRole.html 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
  3. <head>
  4. <th:block th:include="include :: header('用户分配角色')" />
  5. </head>
  6. <body>
  7. <div class="main-content">
  8. <form id="form-user-add" class="form-horizontal">
  9. <input type="hidden" id="userId" name="userId" th:value="${user.userId}">
  10. <h4 class="form-header h4">基本信息</h4>
  11. <div class="row">
  12. <div class="col-sm-6">
  13. <div class="form-group">
  14. <label class="col-sm-4 control-label is-required">用户名称:</label>
  15. <div class="col-sm-8">
  16. <input name="userName" class="form-control" type="text" disabled th:value="${user.userName}">
  17. </div>
  18. </div>
  19. </div>
  20. <div class="col-sm-6">
  21. <div class="form-group">
  22. <label class="col-sm-4 control-label is-required">登录账号:</label>
  23. <div class="col-sm-8">
  24. <input name="loginName" class="form-control" type="text" disabled th:value="${user.loginName}">
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. <h4 class="form-header h4">分配角色</h4>
  30. <div class="row">
  31. <div class="col-sm-12">
  32. <div class="col-sm-12 select-table table-striped">
  33. <table id="bootstrap-table"></table>
  34. </div>
  35. </div>
  36. </div>
  37. </form>
  38. </div>
  39. <div class="row">
  40. <div class="col-sm-offset-5 col-sm-10">
  41. <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
  42. <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
  43. </div>
  44. </div>
  45. <th:block th:include="include :: footer" />
  46. <script th:inline="javascript">
  47. var prefix = ctx + "system/user/authRole";
  48. var roles = [[${roles}]]
  49. $(function() {
  50. var options = {
  51. data: roles,
  52. sidePagination: "client",
  53. sortName: "roleSort",
  54. showSearch: false,
  55. showRefresh: false,
  56. showToggle: false,
  57. showColumns: false,
  58. clickToSelect: true,
  59. maintainSelected: true,
  60. columns: [{
  61. checkbox: true,
  62. formatter:function (value, row, index) {
  63. if($.common.isEmpty(value)) {
  64. return { checked: row.flag };
  65. } else {
  66. return { checked: value }
  67. }
  68. }
  69. },
  70. {
  71. field: 'roleId',
  72. title: '角色编号'
  73. },
  74. {
  75. field: 'roleSort',
  76. title: '排序',
  77. sortable: true,
  78. visible: false
  79. },
  80. {
  81. field: 'roleName',
  82. title: '角色名称'
  83. },
  84. {
  85. field: 'roleKey',
  86. title: '权限字符',
  87. sortable: true
  88. },
  89. {
  90. field: 'createTime',
  91. title: '创建时间',
  92. sortable: true
  93. }]
  94. };
  95. $.table.init(options);
  96. });
  97. /* 添加角色-提交 */
  98. function submitHandler(index, layero){
  99. var rows = $.table.selectFirstColumns();
  100. var data = { "userId": $("#userId").val(), "roleIds": rows.join() };
  101. $.operate.saveTab(prefix + "/insertAuthRole", data);
  102. }
  103. </script>
  104. </body>
  105. </html>