7ebf0bb53b857e3c6fb01bca14c2e5f1cbb5bfad.svn-base 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%
  3. String path = request.getContextPath();
  4. %>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  9. <title>单选框</title>
  10. <!--框架必需start-->
  11. <script type="text/javascript" src="<%=path%>/libs/js/jquery.js"></script>
  12. <script type="text/javascript" src="<%=path%>/libs/js/language/cn.js"></script>
  13. <script type="text/javascript" src="<%=path%>/libs/js/framework.js"></script>
  14. <link href="<%=path%>/libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
  15. <link rel="stylesheet" type="text/css" id="skin" prePath="<%=path%>/" scrollerY="false"/>
  16. <link rel="stylesheet" type="text/css" id="customSkin"/>
  17. <!--框架必需end-->
  18. <!--布局控件start-->
  19. <script type="text/javascript" src="<%=path%>/libs/js/nav/layout.js"></script>
  20. <!--布局控件end-->
  21. <!--数据表格start-->
  22. <script src="<%=path%>/libs/js/table/quiGrid.js" type="text/javascript"></script>
  23. <!--数据表格end-->
  24. <style>
  25. .l-layout-drophandle-top{
  26. background-image: url("<%=path%>/libs/images/formEle/spliter_bg_h.jpg");
  27. background-repeat: repeat-x;
  28. height: 10px;
  29. }
  30. </style>
  31. <script type="text/javascript">
  32. //数据表格使用
  33. var g;
  34. var g2;
  35. var sexData={"list":[{"value":"1","key":"男"},{"value":"0","key":"女"}]};
  36. var educationData={"list":[{"value":"1","key":"专科"},{"value":"2","key":"本科"},{"value":"3","key":"硕士"},{"value":"4","key":"博士"}]};
  37. function initComplete(){
  38. $("#layout1").layout({ topHeight: 300 ,onEndResize:function(){
  39. g.resetHeight();
  40. g2.resetHeight();
  41. }});
  42. g = $("#maingrid").quiGrid({
  43. columns: [
  44. { display: '姓名', name: 'userName', align: 'center', width: "30%",isSort:false},
  45. { display: '性别', name: 'userSex', align: 'center' , width: "30%",isSort:false,render:function (item){
  46. for (var i = 0; i < sexData["list"].length; i++)
  47. {
  48. if (sexData["list"][i]['value'] == item.userSex)
  49. return sexData["list"][i]['key']
  50. }
  51. return item.userSex;
  52. }},
  53. { display: '学历', name: 'userEducation', align: 'center' , width: "40%",isSort:false,render:function (item){
  54. for (var i = 0; i < educationData["list"].length; i++)
  55. {
  56. if (educationData["list"][i]['value'] == item.userEducation)
  57. return educationData["list"][i]['key']
  58. }
  59. return item.userEducation;
  60. }},
  61. { display: '选择', isAllowHide: false, align: 'left', width:50,isSort:false,
  62. render: function (rowdata, rowindex, value, column){
  63. return '<div class="padding_top4 padding_left5">'
  64. + '<span class="img_btn_down2 hand" title="选择" onclick="selectItem(' + rowdata.userId + ','+rowindex + ')"></span>'
  65. + '</div>';
  66. }
  67. }
  68. ], url: '<%=path%>/getUserdbs.action', pageSize: 5, rownumbers:true, checkbox:false,percentWidthMode:true,sortName:"userId",sortOrder:"desc",
  69. height: '100%', width:'100%',title:"未选择列表",InWindow:false
  70. });
  71. g2 = $("#maingrid2").quiGrid({
  72. columns: [
  73. { display: '姓名', name: 'userName', align: 'center', width: "30%",isSort:false},
  74. { display: '性别', name: 'userSex', align: 'center' , width: "30%",isSort:false},
  75. { display: '学历', name: 'userEducation', align: 'center' , width: "40%",isSort:false},
  76. { display: '反选', isAllowHide: false, align: 'left', width:50,isSort:false,
  77. render: function (rowdata, rowindex, value, column){
  78. return '<div class="padding_top4 padding_left5">'
  79. + '<span class="img_btn_up2 hand" title="反选" onclick="deSelectItem(' + rowdata.userId + ','+rowindex + ')"></span>'
  80. + '</div>';
  81. }
  82. }
  83. ], url: '<%=path%>/getUsersOfPager.action?parentId=15', pageSize: 5, rownumbers:true, checkbox:false,percentWidthMode:true,sortName:"userId",sortOrder:"desc",
  84. height: '100%', width:'100%',title:"已选择列表"
  85. });
  86. }
  87. function selectItem(rowid,rowindex){
  88. var rowData=g.getRow(rowindex);
  89. selectHandler(rowData,rowid)
  90. }
  91. function deSelectItem(rowid,rowindex){
  92. var rowData=g2.getRow(rowindex);
  93. deSelectHandler(rowData,rowid)
  94. }
  95. function selectHandler(rowData,rowid){
  96. g.deleteRow(rowData);
  97. $.ajax({
  98. url:"<%=path%>/saveUser.action",
  99. type:"POST",
  100. data:{
  101. "userinfor.organization.orgId":15,
  102. "userinfor.userId":rowData.userId,
  103. "userinfor.userName":rowData.userName,
  104. "userinfor.userLoginName":rowData.userLoginName,
  105. "userinfor.userPassword":rowData.userPassword,
  106. "userinfor.userSex":rowData.userSex,
  107. "userinfor.userEducation":rowData.userEducation
  108. },
  109. error:function(){
  110. },
  111. success: function(data){
  112. //页号重置为1
  113. g2.setNewPage(1);
  114. g2.loadData();
  115. $.post("<%=path%>/deleteUserdb.action",
  116. {"ids":rowid},
  117. function(result){
  118. //刷新表格
  119. g.loadData();
  120. },"json");
  121. }
  122. });
  123. var $hi = $('<div class="itemMinEffect"></div>');
  124. $hi.css({
  125. "width":$("#topCon").width(),
  126. "height":32,
  127. "left":0,
  128. top:currentMouseY-10+"px",
  129. opacity:0.1
  130. }).animate({
  131. width:$("#topCon").width(),
  132. height:0,
  133. left:0,
  134. top:$("body").height()-100+"px",
  135. opacity:0
  136. },200,function(){
  137. $hi.remove();
  138. })
  139. $("body").append($hi);
  140. }
  141. function deSelectHandler(rowData,rowid){
  142. g2.deleteRow(rowData);
  143. var userSex;
  144. for (var i = 0; i < sexData["list"].length; i++)
  145. {
  146. if (sexData["list"][i]['key'] == rowData.userSex)
  147. userSex= sexData["list"][i]['value']
  148. }
  149. var userEducation;
  150. for (var j = 0; j < educationData["list"].length; j++)
  151. {
  152. if (educationData["list"][j]['key'] == rowData.userEducation)
  153. userEducation= educationData["list"][j]['value']
  154. }
  155. var postData={
  156. userName:rowData.userName,
  157. userLoginName:rowData.userLoginName,
  158. userPassword:rowData.userPassword,
  159. userSex:userSex,
  160. userAge:18,
  161. userId:rowData.userId,
  162. userEducation:userEducation
  163. }
  164. $.post("<%=path%>/saveUserdb.action",rowToBO(postData),function(result){
  165. //页号重置为1
  166. g.setNewPage(1);
  167. g.loadData();
  168. $.post("<%=path%>/deleteUser.action",
  169. {"ids":rowid},
  170. function(result){
  171. g2.loadData();
  172. },"json");
  173. },"json");
  174. var $hi = $('<div class="itemMinEffect"></div>');
  175. $hi.css({
  176. "width":$("#centerCon").width(),
  177. "height":32,
  178. "left":0,
  179. top:currentMouseY-10+"px",
  180. opacity:0.1
  181. }).animate({
  182. width:$("#centerCon").width(),
  183. height:0,
  184. left:0,
  185. top:100+"px",
  186. opacity:0
  187. },200,function(){
  188. $hi.remove();
  189. })
  190. $("body").append($hi);
  191. }
  192. //将row JSON对象转化为bo对象
  193. function rowToBO(row) {
  194. var params = '&userinfor.userName='+row.userName+'&userinfor.userSex='+row.userSex+'&userinfor.userAge='+Math.ceil(row.userAge)+'&userinfor.userDepartment='+row.userDepartment+'&userinfor.userAssistance='+row.userAssistance+'&userinfor.userDuty='+row.userDuty+'&userinfor.userEmployTime='+row.userEmployTime+'&userinfor.userPassword='+row.userPassword+'&userinfor.userEducation='+row.userEducation+'&userinfor.userLoginName='+row.userLoginName;
  195. return params;
  196. }
  197. function selectAll(){
  198. var rows = g.getSelectedRows();
  199. for(var i=0;i<rows.length;i++){
  200. selectHandler(rows[i],rows[i].userId);
  201. }
  202. }
  203. function deSelectAll(){
  204. var rows = g2.getSelectedRows();
  205. for(var i=0;i<rows.length;i++){
  206. deSelectHandler(rows[i],rows[i].userId);
  207. }
  208. }
  209. </script>
  210. </head>
  211. <body>
  212. <div id="layout1">
  213. <div position="top" id="topCon" style="padding-right:4px;">
  214. <div id="maingrid"></div>
  215. </div>
  216. <div position="center" id="centerCon" style="padding-right:8px;padding-top:5px;">
  217. <div id="maingrid2"></div>
  218. </div>
  219. </div>
  220. </body>
  221. </html>