123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>单选框</title>
- <!--框架必需start-->
- <script type="text/javascript" src="../../libs/js/jquery.js"></script>
- <script type="text/javascript" src="../../libs/js/language/cn.js"></script>
- <script type="text/javascript" src="../../libs/js/framework.js"></script>
- <link href="../../libs/css/import_basic.css" rel="stylesheet" type="text/css"/>
- <link rel="stylesheet" type="text/css" id="skin" prePath="../../" scrollerY="false"/>
- <link rel="stylesheet" type="text/css" id="customSkin"/>
- <!--框架必需end-->
- <!--布局控件start-->
- <script type="text/javascript" src="../../libs/js/nav/layout.js"></script>
- <!--布局控件end-->
- <!--数据表格start-->
- <script src="../../libs/js/table/quiGrid.js" type="text/javascript"></script>
- <!--数据表格end-->
- <style>
- .l-layout-drophandle-right{
- background-image: url("../../libs/images/formEle/spliter_bg_v.jpg");
- background-repeat: repeat-y;
- width: 10px;
- }
- </style>
- <script type="text/javascript">
- //数据表格使用
- var g;
- var g2;
- var sexData={"list":[{"value":"1","key":"男"},{"value":"0","key":"女"}]};
- var educationData={"list":[{"value":"1","key":"专科"},{"value":"2","key":"本科"},{"value":"3","key":"硕士"},{"value":"4","key":"博士"}]};
- function initComplete(){
-
- $("#layout1").layout({ rightWidth: 500,onEndResize:function(){
- g.resetWidth();
- g2.resetWidth();
- }});
-
- g = $("#maingrid").quiGrid({
- columns: [
- { display: '姓名', name: 'userName', align: 'center', width: "30%",isSort:false},
- { display: '性别', name: 'userSex', align: 'center' , width: "30%",isSort:false,render:function (item){
- for (var i = 0; i < sexData["list"].length; i++)
- {
- if (sexData["list"][i]['value'] == item.userSex)
- return sexData["list"][i]['key']
- }
- return item.userSex;
- }},
- { display: '学历', name: 'userEducation', align: 'center' , width: "40%",isSort:false,render:function (item){
- for (var i = 0; i < educationData["list"].length; i++)
- {
- if (educationData["list"][i]['value'] == item.userEducation)
- return educationData["list"][i]['key']
- }
- return item.userEducation;
- }},
- { display: '选择', isAllowHide: false, align: 'left', width:50,isSort:false,
- render: function (rowdata, rowindex, value, column){
- return '<div class="padding_top4 padding_left5">'
- + '<span class="img_btn_right hand" title="选择" onclick="selectItem(' + rowdata.userId + ','+rowindex + ')"></span>'
- + '</div>';
- }
- }
- ], pageSize: 10, rownumbers:true, checkbox:false,percentWidthMode:true,sortName:"userId",sortOrder:"desc",
- height: '100%', width:'100%',showPageInfo:false
- });
- g2 = $("#maingrid2").quiGrid({
- columns: [
- { display: '反选', isAllowHide: false, align: 'left', width:50,isSort:false,
- render: function (rowdata, rowindex, value, column){
- return '<div class="padding_top4 padding_left5">'
- + '<span class="img_btn_left hand" title="反选" onclick="deSelectItem(' + rowdata.userId + ','+rowindex + ')"></span>'
- + '</div>';
- }
- },
- { display: '姓名', name: 'userName', align: 'center', width: "30%",isSort:false},
- { display: '性别', name: 'userSex', align: 'center' , width: "30%",isSort:false},
- { display: '学历', name: 'userEducation', align: 'center' , width: "40%",isSort:false}
-
- ], pageSize: 10, rownumbers:true, checkbox:false,percentWidthMode:true,sortName:"userId",sortOrder:"desc",
- height: '100%', width:'100%',showPageInfo:false
- });
- }
- function selectItem(rowid,rowindex){
- var rowData=g.getRow(rowindex);
- selectHandler(rowData,rowid)
- }
- function deSelectItem(rowid,rowindex){
- var rowData=g2.getRow(rowindex);
- deSelectHandler(rowData,rowid)
- }
- function selectHandler(rowData,rowid){
- g.deleteRow(rowData);
-
- $.ajax({
- url:"../../userAction.do?method=save",
- type:"POST",
- data:{
- "userinfor.organization.orgId":15,
- "userinfor.userId":rowData.userId,
- "userinfor.userName":rowData.userName,
- "userinfor.userLoginName":rowData.userLoginName,
- "userinfor.userPassword":rowData.userPassword,
- "userinfor.userSex":rowData.userSex,
- "userinfor.userEducation":rowData.userEducation
- },
- error:function(){
- },
- success: function(data){
- //页号重置为1
- g2.setNewPage(1);
- g2.loadData();
-
- $.post("../../userdbAction.do?method=deleteUser",
- {"ids":rowid},
- function(result){
- //刷新表格
- g.loadData();
- },"json");
- }
- });
-
-
-
- var $hi = $('<div class="itemMinEffect"></div>');
- $hi.css({
- "width":$("#centerCon").width(),
- "height":32,
- "left":0,
- top:currentMouseY-10+"px",
- opacity:0.1
- }).animate({
- width:$("#centerCon").width(),
- height:0,
- left:$("body").width()-100+"px",
- top:currentMouseY-10+"px",
- opacity:0
- },200,function(){
- $hi.remove();
- })
- $("body").append($hi);
- }
- function deSelectHandler(rowData,rowid){
- g2.deleteRow(rowData);
-
- var userSex;
- for (var i = 0; i < sexData["list"].length; i++)
- {
- if (sexData["list"][i]['key'] == rowData.userSex)
- userSex= sexData["list"][i]['value']
- }
- var userEducation;
- for (var j = 0; j < educationData["list"].length; j++)
- {
- if (educationData["list"][j]['key'] == rowData.userEducation)
- userEducation= educationData["list"][j]['value']
- }
- var postData={
- userName:rowData.userName,
- userLoginName:rowData.userLoginName,
- userPassword:rowData.userPassword,
- userSex:userSex,
- userAge:18,
- userId:rowData.userId,
- userEducation:userEducation
- }
- $.post("../../userdbAction.do?method=saveUser",rowToBO(postData),function(result){
- //页号重置为1
- g.setNewPage(1);
- g.loadData();
-
- $.post("../../userAction.do?method=deleteUser",
- {"ids":rowid},
- function(result){
- g2.loadData();
- },"json");
- },"json");
-
-
-
-
- var $hi = $('<div class="itemMinEffect"></div>');
- $hi.css({
- "width":$("#rightCon").width(),
- "height":32,
- "left":currentMouseX+"px",
- top:currentMouseY-10+"px",
- opacity:0.1
- }).animate({
- width:$("#rightCon").width(),
- height:0,
- left:100+"px",
- top:currentMouseY-10+"px",
- opacity:0
- },200,function(){
- $hi.remove();
- })
- $("body").append($hi);
- }
-
-
- //将row JSON对象转化为bo对象
- function rowToBO(row) {
- 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;
- return params;
- }
-
- function selectAll(){
- var rows = g.getSelectedRows();
- for(var i=0;i<rows.length;i++){
- selectHandler(rows[i],rows[i].userId);
- }
- }
- function deSelectAll(){
- var rows = g2.getSelectedRows();
- for(var i=0;i<rows.length;i++){
- deSelectHandler(rows[i],rows[i].userId);
- }
- }
- </script>
- </head>
- <body>
- <div id="layout1">
- <div id="centerCon" position="center" style="padding-right:5px;" panelTitle="未选择列表">
- <div id="maingrid"></div>
- </div>
- <div id="rightCon" position="right" style="padding-right:8px;padding-left:4px;" panelTitle="已选择列表">
- <div id="maingrid2"></div>
- </div>
- </div>
- </body>
- </html>
|