index.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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/SyorganizationForm.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/SyorganizationForm.jsp?id=' + id
  23. });
  24. };
  25. var editFun = function(id) {
  26. var dialog = parent.sy.modalDialog({
  27. title : '编辑机构信息',
  28. url : sy.contextPath + '/securityJsp/base/SyorganizationForm.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/syorganization!delete.action', {
  41. id : id
  42. }, function() {
  43. grid.treegrid('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/SyorganizationGrant.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. var redoFun = function() {
  61. var node = grid.treegrid('getSelected');
  62. if (node) {
  63. grid.treegrid('expandAll', node.id);
  64. } else {
  65. grid.treegrid('expandAll');
  66. }
  67. };
  68. var undoFun = function() {
  69. var node = grid.treegrid('getSelected');
  70. if (node) {
  71. grid.treegrid('collapseAll', node.id);
  72. } else {
  73. grid.treegrid('collapseAll');
  74. }
  75. };
  76. $(function() {
  77. grid = $('#grid').treegrid({
  78. title : '',
  79. url : sy.contextPath + '/base/syorganization!treeGrid.action',
  80. idField : 'id',
  81. treeField : 'name',
  82. parentField : 'pid',
  83. rownumbers : true,
  84. pagination : false,
  85. sortName : 'seq',
  86. sortOrder : 'asc',
  87. frozenColumns : [ [ {
  88. width : '200',
  89. title : '机构名称',
  90. field : 'name'
  91. } ] ],
  92. columns : [ [ {
  93. width : '150',
  94. title : '图标名称',
  95. field : 'iconCls'
  96. }, {
  97. width : '150',
  98. title : '机构编码',
  99. field : 'code'
  100. }, {
  101. width : '200',
  102. title : '机构地址',
  103. field : 'address'
  104. }, {
  105. width : '150',
  106. title : '创建时间',
  107. field : 'createdatetime',
  108. hidden : true
  109. }, {
  110. width : '150',
  111. title : '修改时间',
  112. field : 'updatedatetime',
  113. hidden : true
  114. }, {
  115. width : '60',
  116. title : '排序',
  117. field : 'seq',
  118. hidden : true
  119. }, {
  120. title : '操作',
  121. field : 'action',
  122. width : '80',
  123. formatter : function(value, row) {
  124. var str = '';
  125. {%if (current_user.have_permission("/base/syorganization!getById")) %}
  126. str += sy.formatString('<img class="iconImg ext-icon-note" title="查看" onclick="showFun(\'{0}\');"/>', row.id);
  127. {%endif%}
  128. {%if (current_user.have_permission("/base/syorganization!update"))%}
  129. str += sy.formatString('<img class="iconImg ext-icon-note_edit" title="编辑" onclick="editFun(\'{0}\');"/>', row.id);
  130. {%endif%}
  131. {%if (current_user.have_permission("/base/syorganization!grant")) %}
  132. str += sy.formatString('<img class="iconImg ext-icon-group_key" title="授权" onclick="grantFun(\'{0}\');"/>', row.id);
  133. {%endif%}
  134. {%if (current_user.have_permission("/base/syorganization!delete")) %}
  135. str += sy.formatString('<img class="iconImg ext-icon-note_delete" title="删除" onclick="removeFun(\'{0}\');"/>', row.id);
  136. {%endif%}
  137. return str;
  138. }
  139. } ] ],
  140. toolbar : '#toolbar',
  141. onBeforeLoad : function(row, param) {
  142. parent.$.messager.progress({
  143. text : '数据加载中....'
  144. });
  145. },
  146. onLoadSuccess : function(row, data) {
  147. $('.iconImg').attr('src', sy.pixel_0);
  148. parent.$.messager.progress('close');
  149. }
  150. });
  151. });
  152. </script>
  153. {% endblock %}
  154. {% block body %}
  155. <body class="easyui-layout" data-options="fit:true,border:false">
  156. <div id="toolbar" style="display: none;">
  157. <table>
  158. <tr>
  159. {%if current_user.have_permission("/base/syorganization!save") %}
  160. <td><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-note_add',plain:true" onclick="addFun();">添加</a></td>
  161. {%endif%}
  162. <td><div class="datagrid-btn-separator"></div></td>
  163. <td><a onclick="redoFun();" href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:true,iconCls:'ext-icon-resultset_next'">展开</a><a onclick="undoFun();" href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:true,iconCls:'ext-icon-resultset_previous'">折叠</a></td>
  164. <td><div class="datagrid-btn-separator"></div></td>
  165. <td><a onclick="grid.treegrid('reload');" href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:true,iconCls:'ext-icon-arrow_refresh'">刷新</a></td>
  166. </tr>
  167. </table>
  168. </div>
  169. <div data-options="region:'center',fit:true,border:false">
  170. <table id="grid" data-options="fit:true,border:false"></table>
  171. </div>
  172. </body>
  173. {% endblock %}