index.html 7.3 KB

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