index.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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/SyresourceForm.jsp',
  11. buttons : [ {
  12. text : '添加',
  13. handler : function() {
  14. dialog.find('iframe').get(0).contentWindow.submitForm(dialog, grid, parent.$, parent.mainMenu);
  15. }
  16. } ]
  17. });
  18. };
  19. var showFun = function(id) {
  20. var dialog = parent.sy.modalDialog({
  21. title : '查看资源信息',
  22. url : sy.contextPath + '/securityJsp/base/SyresourceForm.jsp?id=' + id
  23. });
  24. };
  25. var editFun = function(id) {
  26. var dialog = parent.sy.modalDialog({
  27. title : '编辑资源信息',
  28. url : sy.contextPath + '/securityJsp/base/SyresourceForm.jsp?id=' + id,
  29. buttons : [ {
  30. text : '编辑',
  31. handler : function() {
  32. dialog.find('iframe').get(0).contentWindow.submitForm(dialog, grid, parent.$, parent.mainMenu);
  33. }
  34. } ]
  35. });
  36. };
  37. var removeFun = function(id) {
  38. parent.$.messager.confirm('询问', '您确定要删除此记录?', function(r) {
  39. if (r) {
  40. $.post(sy.contextPath + '/base/syresource!delete.action', {
  41. id : id
  42. }, function() {
  43. grid.treegrid('reload');
  44. parent.mainMenu.tree('reload');
  45. }, 'json');
  46. }
  47. });
  48. };
  49. var redoFun = function() {
  50. var node = grid.treegrid('getSelected');
  51. if (node) {
  52. grid.treegrid('expandAll', node.id);
  53. } else {
  54. grid.treegrid('expandAll');
  55. }
  56. };
  57. var undoFun = function() {
  58. var node = grid.treegrid('getSelected');
  59. if (node) {
  60. grid.treegrid('collapseAll', node.id);
  61. } else {
  62. grid.treegrid('collapseAll');
  63. }
  64. };
  65. $(function() {
  66. grid = $('#grid').treegrid({
  67. title : '',
  68. url : sy.contextPath + '/base/syresource!treeGrid.action',
  69. idField : 'id',
  70. treeField : 'name',
  71. parentField : 'pid',
  72. rownumbers : true,
  73. pagination : false,
  74. sortName : 'seq',
  75. sortOrder : 'asc',
  76. frozenColumns : [ [ {
  77. width : '200',
  78. title : '资源名称',
  79. field : 'name'
  80. } ] ],
  81. columns : [ [ {
  82. width : '200',
  83. title : '图标名称',
  84. field : 'iconCls'
  85. }, {
  86. width : '200',
  87. title : '资源路径',
  88. field : 'url',
  89. formatter : function(value, row) {
  90. if(value){
  91. return sy.formatString('<span title="{0}">{1}</span>', value, value);
  92. }
  93. }
  94. }, {
  95. width : '60',
  96. title : '资源类型',
  97. field : 'syresourcetype',
  98. formatter : function(value, row) {
  99. return value.name;
  100. }
  101. }, {
  102. width : '150',
  103. title : '创建时间',
  104. field : 'createdatetime',
  105. hidden : true
  106. }, {
  107. width : '150',
  108. title : '修改时间',
  109. field : 'updatedatetime',
  110. hidden : true
  111. }, {
  112. width : '200',
  113. title : '资源描述',
  114. field : 'description',
  115. formatter : function(value, row) {
  116. if(value){
  117. return sy.formatString('<span title="{0}">{1}</span>', value, value);
  118. }
  119. }
  120. }, {
  121. width : '80',
  122. title : '排序',
  123. field : 'seq',
  124. hidden : true
  125. }, {
  126. width : '80',
  127. title : '目标',
  128. field : 'target'
  129. }, {
  130. title : '操作',
  131. field : 'action',
  132. width : '60',
  133. formatter : function(value, row) {
  134. var str = '';
  135. {%if current_user.have_permission("/base/syresource!getById") %}
  136. str += sy.formatString('<img class="iconImg ext-icon-note" title="查看" onclick="showFun(\'{0}\');"/>', row.id);
  137. {%endif%}
  138. {%if current_user.have_permission("/base/syresource!update") %}
  139. str += sy.formatString('<img class="iconImg ext-icon-note_edit" title="编辑" onclick="editFun(\'{0}\');"/>', row.id);
  140. {%endif%}
  141. {%if current_user.have_permission("/base/syresource!delete") %}
  142. str += sy.formatString('<img class="iconImg ext-icon-note_delete" title="删除" onclick="removeFun(\'{0}\');"/>', row.id);
  143. {%endif%}
  144. return str;
  145. }
  146. } ] ],
  147. toolbar : '#toolbar',
  148. onBeforeLoad : function(row, param) {
  149. parent.$.messager.progress({
  150. text : '数据加载中....'
  151. });
  152. },
  153. onLoadSuccess : function(row, data) {
  154. $('.iconImg').attr('src', sy.pixel_0);
  155. parent.$.messager.progress('close');
  156. }
  157. });
  158. });
  159. </script>
  160. {% endblock %}
  161. {% block body %}
  162. <body class="easyui-layout" data-options="fit:true,border:false">
  163. <div id="toolbar" style="display: none;">
  164. <table>
  165. <tr>
  166. {%if current_user.have_permission("/base/syresource!save") %}
  167. <td><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-note_add',plain:true" onclick="addFun();">添加</a></td>
  168. {%endif%}
  169. <td><div class="datagrid-btn-separator"></div></td>
  170. <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>
  171. <td><div class="datagrid-btn-separator"></div></td>
  172. <td><a onclick="grid.treegrid('reload');" href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:true,iconCls:'ext-icon-arrow_refresh'">刷新</a></td>
  173. </tr>
  174. </table>
  175. </div>
  176. <div data-options="region:'center',fit:true,border:false">
  177. <table id="grid" data-options="fit:true,border:false"></table>
  178. </div>
  179. {% endblock %}