index.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. {% extends "base.html" %}
  2. {% block title %}
  3. {% endblock %}
  4. {% block head %}
  5. <script type="text/javascript">
  6. var exportFun = function () {
  7. var data = sy.serializeObject($('#searchForm'));
  8. //data.sort = 't.syuser.name';
  9. $.download(sy.contextPath + '/base/syuser!export.action', data);
  10. };
  11. var grid;
  12. var addFun = function() {
  13. var dialog = parent.sy.modalDialog({
  14. title : '添加用户信息',
  15. url : sy.contextPath + '/securityJsp/base/SyuserForm.jsp',
  16. buttons : [ {
  17. text : '添加',
  18. handler : function() {
  19. dialog.find('iframe').get(0).contentWindow.submitForm(dialog, grid, parent.$);
  20. }
  21. } ]
  22. });
  23. };
  24. var showFun = function(id) {
  25. var dialog = parent.sy.modalDialog({
  26. title : '查看用户信息',
  27. url : sy.contextPath + '/securityJsp/base/SyuserForm.jsp?id=' + id
  28. });
  29. };
  30. var editFun = function(id) {
  31. var dialog = parent.sy.modalDialog({
  32. title : '编辑用户信息',
  33. url : sy.contextPath + '/securityJsp/base/SyuserForm.jsp?id=' + id,
  34. buttons : [ {
  35. text : '编辑',
  36. handler : function() {
  37. dialog.find('iframe').get(0).contentWindow.submitForm(dialog, grid, parent.$);
  38. }
  39. } ]
  40. });
  41. };
  42. var removeFun = function(id) {
  43. parent.$.messager.confirm('询问', '您确定要删除此记录?', function(r) {
  44. if (r) {
  45. $.post(sy.contextPath + '/base/syuser!delete.action', {
  46. id : id
  47. }, function() {
  48. grid.datagrid('reload');
  49. }, 'json');
  50. }
  51. });
  52. };
  53. var grantRoleFun = function(id) {
  54. var dialog = parent.sy.modalDialog({
  55. title : '修改角色',
  56. url : sy.contextPath + '/securityJsp/base/SyuserRoleGrant.jsp?id=' + id,
  57. buttons : [ {
  58. text : '修改',
  59. handler : function() {
  60. dialog.find('iframe').get(0).contentWindow.submitForm(dialog, grid, parent.$);
  61. }
  62. } ]
  63. });
  64. };
  65. var grantOrganizationFun = function(id) {
  66. var dialog = parent.sy.modalDialog({
  67. title : '修改机构',
  68. url : sy.contextPath + '/securityJsp/base/SyuserOrganizationGrant.jsp?id=' + id,
  69. buttons : [ {
  70. text : '修改',
  71. handler : function() {
  72. dialog.find('iframe').get(0).contentWindow.submitForm(dialog, grid, parent.$);
  73. }
  74. } ]
  75. });
  76. };
  77. $(function() {
  78. grid = $('#grid').datagrid({
  79. title : '',
  80. url : sy.contextPath + '/base/syuser!grid.action',
  81. striped : true,
  82. rownumbers : true,
  83. pagination : true,
  84. singleSelect : true,
  85. idField : 'id',
  86. sortName : 'createdatetime',
  87. sortOrder : 'desc',
  88. pageSize : 50,
  89. pageList : [ 10, 20, 30, 40, 50, 100, 200, 300, 400, 500 ],
  90. frozenColumns : [ [ {
  91. width : '100',
  92. title : '登录名',
  93. field : 'loginname',
  94. sortable : true
  95. }, {
  96. width : '80',
  97. title : '姓名',
  98. field : 'name',
  99. sortable : true
  100. } ] ],
  101. columns : [ [ {
  102. width : '150',
  103. title : '创建时间',
  104. field : 'createdatetime',
  105. sortable : true
  106. }, {
  107. width : '150',
  108. title : '修改时间',
  109. field : 'updatedatetime',
  110. sortable : true
  111. }, {
  112. width : '50',
  113. title : '性别',
  114. field : 'sex',
  115. sortable : true,
  116. formatter : function(value, row, index) {
  117. switch (value) {
  118. case '0':
  119. return '女';
  120. case '1':
  121. return '男';
  122. }
  123. }
  124. }, {
  125. width : '50',
  126. title : '年龄',
  127. field : 'age',
  128. hidden : true
  129. }/*, {
  130. width : '250',
  131. title : '照片',
  132. field : 'photo',
  133. formatter : function(value, row) {
  134. if(value){
  135. return sy.formatString('<span title="{0}">{1}</span>', value, value);
  136. }
  137. }
  138. }*/, {
  139. title : '操作',
  140. field : 'action',
  141. width : '90',
  142. formatter : function(value, row) {
  143. var str = '';
  144. {%if current_user.have_permission("/base/syuser!getById") %}
  145. str += sy.formatString('<img class="iconImg ext-icon-note" title="查看" onclick="showFun(\'{0}\');"/>', row.id);
  146. {%endif%}
  147. {%if current_user.have_permission("/base/syuser!update") %}
  148. str += sy.formatString('<img class="iconImg ext-icon-note_edit" title="编辑" onclick="editFun(\'{0}\');"/>', row.id);
  149. {%endif%}
  150. {%if current_user.have_permission("/base/syuser!grantRole") %}
  151. str += sy.formatString('<img class="iconImg ext-icon-user" title="用户角色" onclick="grantRoleFun(\'{0}\');"/>', row.id);
  152. {%endif%}
  153. {%if current_user.have_permission("/base/syuser!grantOrganization") %}
  154. str += sy.formatString('<img class="iconImg ext-icon-group" title="用户机构" onclick="grantOrganizationFun(\'{0}\');"/>', row.id);
  155. {%endif%}
  156. {%if current_user.have_permission("/base/syuser!delete") %}
  157. str += sy.formatString('<img class="iconImg ext-icon-note_delete" title="删除" onclick="removeFun(\'{0}\');"/>', row.id);
  158. {%endif%}
  159. return str;
  160. }
  161. } ] ],
  162. toolbar : '#toolbar',
  163. onBeforeLoad : function(param) {
  164. parent.$.messager.progress({
  165. text : '数据加载中....'
  166. });
  167. },
  168. onLoadSuccess : function(data) {
  169. $('.iconImg').attr('src', sy.pixel_0);
  170. parent.$.messager.progress('close');
  171. }
  172. });
  173. });
  174. </script>
  175. {% endblock %}
  176. {% block body %}
  177. <body class="easyui-layout" data-options="fit:true,border:false">
  178. <div id="toolbar" style="display: none;">
  179. <table>
  180. <tr>
  181. <td>
  182. <form id="searchForm">
  183. <table>
  184. <tr>
  185. <td>登录名</td>
  186. <td><input name="loginname" style="width: 80px;" /></td>
  187. <td>姓名</td>
  188. <td><input name="name" style="width: 80px;" /></td>
  189. <td>性别</td>
  190. <td><select name="sex" class="easyui-combobox" data-options="panelHeight:'auto',editable:false"><option value="">请选择</option>
  191. <option value="1">男</option>
  192. <option value="0">女</option></select></td>
  193. <td>创建时间</td>
  194. <td><input name="createdatetime1" class="Wdate" onclick="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})" readonly="readonly" style="width: 120px;" />-<input name="createdatetime2" class="Wdate" onclick="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})" readonly="readonly" style="width: 120px;" /></td>
  195. <td><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-zoom',plain:true" onclick="grid.datagrid('load',sy.serializeObject($('#searchForm')));">过滤</a><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-zoom_out',plain:true" onclick="$('#searchForm input').val('');grid.datagrid('load',{});">重置过滤</a></td>
  196. </tr>
  197. </table>
  198. </form>
  199. </td>
  200. </tr>
  201. <tr>
  202. <td>
  203. <table>
  204. <tr>
  205. {%if current_user.have_permission("/base/syuser!save") %}
  206. <td><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-note_add',plain:true" onclick="addFun();">添加</a></td>
  207. {%endif%}
  208. <td><div class="datagrid-btn-separator"></div></td>
  209. <!-- <td><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-table_add',plain:true" onclick="">导入</a></td> -->
  210. <td><a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'ext-icon-table_go',plain:true" onclick="exportFun()">导出</a></td>
  211. </tr>
  212. </table>
  213. </td>
  214. </tr>
  215. </table>
  216. </div>
  217. <div data-options="region:'center',fit:true,border:false">
  218. <table id="grid" data-options="fit:true,border:false"></table>
  219. </div>
  220. </body>
  221. {% endblock %}