
var computerIp=null;var cst=1958;var oxe="DefaultF_";$(window).load(function(){computerIp=quj();$("#d"+cst+"_ComIp").html(computerIp);$("#d"+cst+"_ComIp_hid").val(computerIp);box();$("#btn_NewIp").unbind("click").bind("click",function(){czu()})});function box(){var d="/Designer/WebServices/System/User.asmx/GetIp";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:d,data:"{}",dataType:'json',success:function(a){a=hmy(a);if(!ymr($.trim(a))){var b=a.split(",");var c=$("#d"+cst+"_AllIp");c.html("");for(var i=0;i<b.length;i++){if(!ymr($.trim(b[i])))c.append("<option value=\""+$.trim(b[i])+"\" >"+$.trim(b[i])+"</option>")}}},beforeSend:function(a){},complete:function(a,b){},error:function(a){alert("获取系统Id失败，请重新登陆系统。详情："+JSON2.stringify(a))}});return}
function quj(){var c=null;var d="/Designer/WebServices/Comman/Comman.asmx/GetIp";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:d,data:"{}",async:false,dataType:'json',success:function(a){a=hmy(a);c=a},beforeSend:function(a){},complete:function(a,b){},error:function(a){}});return c}
function czu(){var a=yci(cst,oxe);var b=null;var c=col(cst,oxe);b=c.$form;if(b==null){art.VLdialog.alert("获取表单的HTML对象失败。请确认代码正确。",function(){},4,"提示");return null}
var d=sme(b,false,cst,oxe,true,cst,a,true);if(ymr(d)||d==false){return null}
var e=$("#d"+cst+"_Value").val();var f=bhm();if(!ymr($.trim(e))){if(f.length>0)f=f+",";f=f+e}
if($("#d"+cst+"_AllIp").find("option[value='"+e+"']").length>0){art.VLdialog.alert("此Ip已可以允许访问！",function(){},20,"提示");return false}
var g=$("#d"+cst+"_RestrictIp").attr("checked");oqf(g,f)}
function oqf(e,f){var g="/Designer/WebServices/System/User.asmx/UpdateIp";$.ajax({type:"POST",contentType:"application/json; charset=utf-8",url:g,data:"{RestrictIp:"+e+",Ips:\""+f+"\"}",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){var b=f.split(",");var c=$("#d"+cst+"_AllIp");var d=c.val();c.html("");for(var i=0;i<b.length;i++){if(!ymr($.trim(b[i])))c.append("<option value=\""+$.trim(b[i])+"\" "+(d==$.trim(b[i])?"selected ":"")+">"+$.trim(b[i])+"</option>")}
art.VLdialog.alert("操作成功！",function(){},20,"提示");return false}else{art.VLdialog.alert("操作失败。",function(){},8,"提示")}}});return}
function xgv(){var a=$("#d"+cst+"_AllIp");a.find("option:selected").remove();var b=$("#d"+cst+"_RestrictIp").attr("checked");var c=bhm(a);oqf(b,c)}
function jmg(){var a=$("#d"+cst+"_ComIp_hid").val();if(ymr(a)){alert("获取当前Ip失败！");return false}
var b=$("#d"+cst+"_AllIp");if(b.find("option[value='"+a+"']").length>0){alert("当前Ip已可以允许访问！");return false}
b.append("<option value=\""+a+"\">"+a+"</option>");var c=$("#d"+cst+"_RestrictIp").attr("checked");var d=bhm(b);oqf(c,d)}
function bhm(b){if(ymr(b)||b.length<1)b=$("#d"+cst+"_AllIp");var c=b.length;var d="";var e=b.children();e.each(function(){var a=$(this).val();if(!ymr(a)&&a!="0"&&a!="-1"){if(d.length>0)d=d+",";d=d+a}});return d}