0353124b87c611425603cc972ef259d19b62fcab.svn-base 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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-right{
  26. background-image: url("<%=path%>/libs/images/formEle/spliter_bg_v.jpg");
  27. background-repeat: repeat-y;
  28. width: 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({ rightWidth: 500,onEndResize:function(){
  39. g.resetWidth();
  40. g2.resetWidth();
  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_right hand" title="选择" onclick="selectItem(' + rowdata.userId + ','+rowindex + ')"></span>'
  65. + '</div>';
  66. }
  67. }
  68. ], url: '<%=path%>/getUserdbs.action', pageSize: 10, rownumbers:true, checkbox:false,percentWidthMode:true,sortName:"userId",sortOrder:"desc",
  69. height: '100%', width:'100%',showPageInfo:false
  70. });
  71. g2 = $("#maingrid2").quiGrid({
  72. columns: [
  73. { display: '反选', isAllowHide: false, align: 'left', width:50,isSort:false,
  74. render: function (rowdata, rowindex, value, column){
  75. return '<div class="padding_top4 padding_left5">'
  76. + '<span class="img_btn_left hand" title="反选" onclick="deSelectItem(' + rowdata.userId + ','+rowindex + ')"></span>'
  77. + '</div>';
  78. }
  79. },
  80. { display: '姓名', name: 'userName', align: 'center', width: "30%",isSort:false},
  81. { display: '性别', name: 'userSex', align: 'center' , width: "30%",isSort:false},
  82. { display: '学历', name: 'userEducation', align: 'center' , width: "40%",isSort:false}
  83. ], url: '<%=path%>/getUsersOfPager.action?parentId=15', pageSize: 10, rownumbers:true, checkbox:false,percentWidthMode:true,sortName:"userId",sortOrder:"desc",
  84. height: '100%', width:'100%',showPageInfo:false
  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":$("#centerCon").width(),
  126. "height":32,
  127. "left":0,
  128. top:currentMouseY-10+"px",
  129. opacity:0.1
  130. }).animate({
  131. width:$("#centerCon").width(),
  132. height:0,
  133. left:$("body").width()-100+"px",
  134. top:currentMouseY-10+"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":$("#rightCon").width(),
  177. "height":32,
  178. "left":currentMouseX+"px",
  179. top:currentMouseY-10+"px",
  180. opacity:0.1
  181. }).animate({
  182. width:$("#rightCon").width(),
  183. height:0,
  184. left:100+"px",
  185. top:currentMouseY-10+"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 id="centerCon" position="center" style="padding-right:5px;" panelTitle="未选择列表">
  214. <div id="maingrid"></div>
  215. </div>
  216. <div id="rightCon" position="right" style="padding-right:8px;padding-left:4px;" panelTitle="已选择列表">
  217. <div id="maingrid2"></div>
  218. </div>
  219. </div>
  220. </body>
  221. </html>