index.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. {% extends "base.html" %}
  2. {% block title %}
  3. {% endblock %}
  4. {% block head %}
  5. <script type="text/javascript">
  6. var grid;
  7. var addFun = function() {
  8. var dialog = parent.sy.modalDialog({
  9. title : '添加角色信息',
  10. url : sy.contextPath + '/securityJsp/base/SyroleForm.jsp',
  11. buttons : [ {
  12. text : '添加',
  13. handler : function() {
  14. dialog.find('iframe').get(0).contentWindow.submitForm(dialog, grid, parent.$);
  15. }
  16. } ]
  17. });
  18. };
  19. var showFun = function(id) {
  20. var dialog = parent.sy.modalDialog({
  21. title : '查看角色信息',
  22. url : sy.contextPath + '/securityJsp/base/SyroleForm.jsp?id=' + id
  23. });
  24. };
  25. var editFun = function(id) {
  26. var dialog = parent.sy.modalDialog({
  27. title : '编辑角色信息',
  28. url : sy.contextPath + '/securityJsp/base/SyroleForm.jsp?id=' + id,
  29. buttons : [ {
  30. text : '编辑',
  31. handler : function() {
  32. dialog.find('iframe').get(0).contentWindow.submitForm(dialog, grid, parent.$);
  33. }
  34. } ]
  35. });
  36. };
  37. var removeFun = function(id) {
  38. parent.$.messager.confirm('询问', '您确定要删除此记录?', function(r) {
  39. if (r) {
  40. $.post(sy.contextPath + '/base/syrole!delete.action', {
  41. id : id
  42. }, function() {
  43. grid.datagrid('reload');
  44. }, 'json');
  45. }
  46. });
  47. };
  48. var grantFun = function(id) {
  49. var dialog = parent.sy.modalDialog({
  50. title : '角色授权',
  51. url : sy.contextPath + '/securityJsp/base/SyroleGrant.jsp?id=' + id,
  52. buttons : [ {
  53. text : '授权',
  54. handler : function() {
  55. dialog.find('iframe').get(0).contentWindow.submitForm(dialog, grid, parent.$);
  56. }
  57. } ]
  58. });
  59. };
  60. $(function() {
  61. grid = $('#grid').datagrid({
  62. title : '',
  63. url : sy.contextPath + '/base/syrole!grid.action',
  64. striped : true,
  65. rownumbers : true,
  66. pagination : true,
  67. singleSelect : true,
  68. idField : 'id',
  69. sortName : 'seq',
  70. sortOrder : 'asc',
  71. frozenColumns : [ [ {
  72. width : '100',
  73. title : '角色名称',
  74. field : 'name',
  75. sortable : true
  76. } ] ],
  77. columns : [ [ {
  78. width : '150',
  79. title : '创建时间',
  80. field : 'createdatetime',
  81. sortable : true
  82. }, {
  83. width : '150',
  84. title : '修改时间',
  85. field : 'updatedatetime',
  86. sortable : true
  87. }, {
  88. width : '300',
  89. title : '资源描述',
  90. field : 'description'
  91. }, {
  92. width : '60',
  93. title : '排序',
  94. field : 'seq',
  95. hidden : true,
  96. sortable : true
  97. }, {
  98. title : '操作',
  99. field : 'action',
  100. width : '80',
  101. formatter : function(value, row) {
  102. var str = '';
  103. {%if current_user.have_permission("/base/syrole!getById") %}
  104. str += sy.formatString('<img class="iconImg ext-icon-note" title="查看" onclick="showFun(\'{0}\');"/>', row.id);
  105. {% endif %}
  106. {%if current_user.have_permission("/base/syrole!update") %}
  107. str += sy.formatString('<img class="iconImg ext-icon-note_edit" title="编辑" onclick="editFun(\'{0}\');"/>', row.id);
  108. {% endif %}
  109. {%if current_user.have_permission("/base/syrole!grant") %}
  110. str += sy.formatString('<img class="iconImg ext-icon-key" title="授权" onclick="grantFun(\'{0}\');"/>', row.id);
  111. {% endif %}
  112. {%if current_user.have_permission("/base/syrole!delete") %}
  113. str += sy.formatString('<img class="iconImg ext-icon-note_delete" title="删除" onclick="removeFun(\'{0}\');"/>', row.id);
  114. {% endif %}
  115. return str;
  116. }
  117. } ] ],
  118. toolbar : '#toolbar',
  119. onBeforeLoad : function(param) {
  120. parent.$.messager.progress({
  121. text : '数据加载中....'
  122. });
  123. },
  124. onLoadSuccess : function(data) {
  125. $('.iconImg').attr('src', sy.pixel_0);
  126. parent.$.messager.progress('close');
  127. }
  128. });
  129. });
  130. </script>
  131. {% endblock %}
  132. {% block body %}
  133. <body class="easyui-layout" data-options="fit:true,border:false">
  134. <div id="toolbar" style="display: none;">
  135. <table>
  136. <tr>
  137. {%if current_user.have_permission("/base/syrole!save") %}
  138. <td><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-note_add',plain:true" onclick="addFun();">添加</a></td>
  139. {%endif%}
  140. <td><div class="datagrid-btn-separator"></div></td>
  141. <td><input id="searchBox" class="easyui-searchbox" style="width: 150px" data-options="searcher:function(value,name){grid.datagrid('load',{'QUERY_t#name_S_LK':value});},prompt:'搜索角色名称'"></input></td>
  142. <td><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-zoom_out',plain:true" onclick="$('#searchBox').searchbox('setValue','');grid.datagrid('load',{});">清空查询</a></td>
  143. </tr>
  144. </table>
  145. </div>
  146. <div data-options="region:'center',fit:true,border:false">
  147. <table id="grid" data-options="fit:true,border:false"></table>
  148. </div>
  149. </body>
  150. {% endblock %}