| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 | /** *角色管理 *  */$.namespace("gg.detail");gg.detail.init=function(){	gg.detail.initIstopSel('80%');	gg.detail.initSendSel('80%');	}gg.detail.back=function(){	location.href=$.app+"/gg/main";}gg.detail.save=function(){	 $.ajax({         url:$.app+"/gg/save",         data:$("#addform").serialize(),         type:"post",         dataType:"json",         success:function(data){//ajax返回的数据	           if (data.success) {		           	$.alert({		       		    title: '提示',		       		    content: '操作成功',		       		    confirm: function(){		       		    	location.href=$.app+'/gg/main';		       		    }		           	});	           }else {		           	$.alert({		       		    title: '提示',		       		    content: data.message,		       		    confirm: function(){		       		    			       		    }		           	});	           }	     }    }); }gg.detail.submit=function(){	 $.ajax({        url:$.app+"/gg/submit",        data:$("#addform").serialize(),        type:"post",        dataType:"json",        success:function(data){//ajax返回的数据	           if (data.success) {		           	$.alert({		       		    title: '提示',		       		    content: '操作成功',		       		    confirm: function(){		       		    	location.href=$.app+'/gg/main';		       		    }		           	});	           }else {		           	$.alert({		       		    title: '提示',		       		    content: data.message,		       		    confirm: function(){		       		    			       		    }		           	});	           }	     }   }); }gg.detail.initIstopSel=function(width){	var str = "";	str+="<select   class='selectpicker' name='istopid' id='istopid' >";	str+="<option></option>";	if(gg.detail.istopDate){		var x=$.parseJSON(gg.detail.istopDate);		for(var i=0;i<x.length;i++){			var select = x[i];			if(gg.detail.istop == select.id){				str+=" <option selected value='"+select.id+"' >"+select.text+"</option>";			}else{				str+=" <option value='"+select.id+"' >"+select.text+"</option>";			}					}	}	str+="</select>";	$("#istopSel").empty();	$("#istopSel").append(str);	$('.selectpicker').selectpicker({		width:width	});}gg.detail.initSendSel=function(width){	var str = "";	str+="<select   class='selectpicker' name='sendid' id='sendid' >";	str+="<option></option>";	if(gg.detail.sendDate){		var x=$.parseJSON(gg.detail.sendDate);		for(var i=0;i<x.length;i++){			var select = x[i];			if(gg.detail.send == select.id){				str+=" <option selected value='"+select.id+"' >"+select.text+"</option>";			}else{				str+=" <option value='"+select.id+"' >"+select.text+"</option>";			}					}	}	str+="</select>";	$("#sendSel").empty();	$("#sendSel").append(str);	$('.selectpicker').selectpicker({		width:width	});}gg.detail.audit=function(auditpass,id){	var shyj="";	var audit;	if(auditpass=="Y"){		audit=true;		shyj="同意";	}else{		audit=false;		shyj="不同意";	}	var jyrdel = null;	var rydel = null;	if($('#jyrdel').val()!=null){		jyrdel = $('#jyrdel').val().join(",");	}	if($('#rydel').val()!=null){		rydel = $('#rydel').val().join(",");	}	$.post($.app + "/gg/audit", {		id:id,        shyj:shyj,        flag:audit,        jyrdel:jyrdel,        rydel:rydel    }, function(data) {    	if (data.success) {           	$.alert({       		    title: '提示',       		    content: '操作成功',       		    confirm: function(){       		    	location.href=$.app+'/gg/main';       		    }           	});       }else {           	$.alert({       		    title: '提示',       		    content: data.message,       		    confirm: function(){       		    	       		    }           	});       }    	    }, "json");};gg.detail.initJyrSelect=function(divid,divid2){	 $.post($.app + "/gg/selectJyr", {        }, function(data) {	  var str="";	  str+="<select multiple='multiple' style='width:95%;height:160px' name='jyradd'  id='jyradd'>";	  if(data){		  for(var i=0;i<data.length;i++){			  var jyr = data[i];			  str+=" <option value='"+jyr.id+"' >"+jyr.gkjyr+"</option>";		  }	  }	  str+="</select>";	  $("#"+divid).empty();	  $("#"+divid).append(str);	  	  var str2="";	  str2+="<select multiple='multiple' style='width:95%;height:160px' name='jyrdel'  id='jyrdel'>";	  str+="</select>";	  $("#"+divid2).empty();	  $("#"+divid2).append(str2);	  	  $('#add').click(function(){		  $('#jyradd option:selected').appendTo('#jyrdel');		  	  });	  $('#del').click(function(){		  $('#jyrdel option:selected').appendTo('#jyradd');		 	  });	  $('#addAll').click(function(){		  $('#jyradd option').appendTo('#jyrdel');	  });	  $('#delAll').click(function(){		  $('#jyrdel option').appendTo('#jyradd');	  });	   	         }, "json");};gg.detail.initRySelect=function(divid,divid2){	 $.post($.app + "/gg/selectRy", {      }, function(data) {	  var str="";	  str+="<select multiple='multiple' style='width:95%;height:160px' name='ryadd'  id='ryadd'>";	  if(data){		  for(var i=0;i<data.length;i++){			  var ry = data[i];			  str+=" <option value='"+ry.id+"' >"+ry.xm+"</option>";		  }	  }	  str+="</select>";	  $("#"+divid).empty();	  $("#"+divid).append(str);	  	  var str2="";	  str2+="<select multiple='multiple' style='width:95%;height:160px' name='rydel'  id='rydel'>";	  str+="</select>";	  $("#"+divid2).empty();	  $("#"+divid2).append(str2);	  	  $('#add2').click(function(){		  $('#ryadd option:selected').appendTo('#rydel');		  	  });	  $('#del2').click(function(){		  $('#rydel option:selected').appendTo('#ryadd');		 	  });	  $('#addAll2').click(function(){		  $('#ryadd option').appendTo('#rydel');	  });	  $('#delAll2').click(function(){		  $('#rydel option').appendTo('#ryadd');	  });	  	       }, "json");};
 |