
var IUser={};var cst=2291;var oxe="DefaultF_";var lsf=null;$(window).load(function(){chq();$("#btn_updateUserMsg").unbind("click").bind("click",function(){pjx()})});function chq(){var c="/WebServices/System/User.asmx/GetMyMsg";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:c,data:"{}",dataType:'json',success:function(a){a=hmy(a);if(!ymr(a)){lsf=a;a.Birthday=cwi(a.Birthday);pet(cst,oxe,2);lwg(cst,oxe,a,null,false,true);rmb();IUser.UserObj=a;if(lsf.UserName=="admin"){IUser.IsAdmin=true}else IUser.IsAdmin=false;$("#d2291_PWD").val("");$("#d2291_newPwd2").val("");if(IUser.IsAdmin){$("#d2291_UserName").attr("disabled","disabled").attr("readonly","readonly");$("#d2291_Email").val("")}else $("#d2291_UserName").removeAttr("disabled").removeAttr("readonly")}else pet(cst,oxe,1)},beforeSend:function(a){},complete:function(a,b){},error:function(a){}})}
function rmb(){var e="/WebServices/DataSource/DataSource.asmx/rmb";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:e,data:"{}",dataType:'json',success:function(a){a=hmy(a);if(!ymr(a)&&a.length>0){var b=$("#d"+cst+"_PositionId");var c=lsf.PositionId;var d=new nzy();for(var i=0;i<a.length;i++){d.append("<option value=\""+a[i].PositionId+"\">"+a[i].PositionName+"</option>\n")}
b.html(d.toString());b.val(c)}},beforeSend:function(a){},complete:function(a,b){},error:function(a){}})}
function pjx(){var c=yci(cst,oxe);var d=null;var e=col(cst,oxe);d=e.$form;if(d==null){art.VLdialog.alert("获取表单的HTML对象失败。请确认代码正确。",function(){},4,"提示");return}
var f=sme(d,false,cst,oxe,true,cst,c,true);if(ymr(f)||f==false){art.VLdialog.alert("获取表单数据失败。请确认输入是否正确。",function(){},4,"提示");return}
var g={UserId:-1,UserName:"",UpperName:"",RealName:"",DcxUserName:"",Email:"",Address:"",GroupId:-1,AccountId:-1,IsAccountCreator:false,CurSystemId:-1,EmployeeId:-1,DeptId:-1,PositionId:-1,SuperAdmin:false,CanLogin:false,IP:"",RestrictIp:false,VisitTime:-1,Online:false,PWD:"",LoginDate:new Date(),UserOrder:-1,Sex:"",Telephone:"",Status:"",RegistedDate:new Date(),Phone:"",Birthday:new Date(),Style:-1,IsNeedKey:false,Caste:-1,Http:"",IconPath:"",CreatorId:-1,Creator:"",CreateTime:new Date(),EditorId:-1,Editor:"",EditTime:new Date(),SelftHomePage:false,SelftNavMenu:false,SelftSearch:false,StyleId:-1,AcceptStrangerIM:false,Remark:"",DiskSize:-1,InviteCode:""};g=$.extend({},g,f);var h="/WebServices/System/User.asmx/SetMyMsg2";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:h,data:"{model:"+JSON2.stringify(g)+"}",dataType:'json',beforeSend:function(a){},complete:function(a,b){},error:function(a){var b=JSON2.stringify(a);if(b.length>600)b=b.substr(0,600);alert("操作失败。详情："+b);return false},success:function(a){a=hmy(a);if(a.IsOK){art.VLdialog.Succeed("保存成功！",function(){},20,"提示");if(IUser.IsAdmin)window.top.location.href="/System/SetSystemEmail.aspx?EntId=2293&MenuId=3420&gotoMainPage=1";else window.top.location.href="/main.html"}else art.VLdialog.alert("保存失败。原因："+a.ErrorMsg,function(){},8,"提示")}})}