/**
*角色管理
*
*/
$.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+="";
$("#istopSel").empty();
$("#istopSel").append(str);
$('.selectpicker').selectpicker({
width:width
});
}
gg.detail.initSendSel=function(width){
var str = "";
str+="";
$("#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+="";
$("#"+divid).empty();
$("#"+divid).append(str);
var str2="";
str2+="";
$("#"+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+="";
$("#"+divid).empty();
$("#"+divid).append(str);
var str2="";
str2+="";
$("#"+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");
};