// --FE402422C12F7B532B470BA12221B834
function add_account(showid, hideid, showid2) {
$("#" + showid).show();
$("#" + hideid).hide();
$("#" + showid2).show();
$("#d_account").val('');
$("#d_password").val('');
}
function resetuser() {
$("#d_userid").val("");
$("#d_username").val("");
$("#d_account").val("");
$("#d_password").val("");
};
// 修改
function update_user(userid, url) {
// 先要将值都赋给form1
$.ajax({
url : url,
type : 'post',
dataType : 'json',
data : {
userid : userid
},
success : function(data) {
var obj = jQuery.parseJSON(data);
$("#d_userid").val($.trim(obj.userid));
$("#d_username").val($.trim(obj.username));
$("#d_account").val($.trim(obj.account));
$("#d_password").val($.trim(obj.password));
$("#d_password1").val($.trim(obj.password));
$("#success").val($.trim(obj.success));
$("#save_user").hide();
$("#update_user").show();
$("#password_user").show();
}
});
};
// ---省级下拉事件
function change_city_user(province, city, country, policy, dept, url) {
var $province = $("#" + province);
var provinceid = $province.val();
// --清空市级
var $sel = $("#" + city);
$sel.empty();
$sel.append("");
if (null != country && '' != country) { // 清空区级
var $selq = $("#" + country);
$selq.empty();
$selq.append("");
}
if (null != policy && '' != policy) { // 清空派出所
var $selpolicy = $("#" + policy);
$selpolicy.empty();
$selpolicy.append("");
}
if (null != dept && '' != dept) { // 清空站点
var $seldept = $("#" + dept);
$seldept.empty();
$seldept.append("");
}
// ----查询市级列表
$.ajax({
url : url,
type : 'post',
dataType : 'json',
data : {
provinceid : provinceid
},
success : function(data) {
var obj = jQuery.parseJSON(data);
$.each(obj, function(i, item) {
// item.id item.name
$sel.append("");
});
}
});
}
// ---市级下拉事件
function change_country_user(city, country, policy, dept, url) {
var $city = $("#" + city);
var cityid = $city.val(); // --市级
if (null != country && '' != country) { // 清空区级
var $selcountry = $("#" + country);
$selcountry.empty();
$selcountry.append("");
}
if (null != policy && '' != policy) { // 清空派出所
var $selpolicy = $("#" + policy);
$selpolicy.empty();
$selpolicy.append("");
}
if (null != dept && '' != dept) { // 清空派出所
var $seldept = $("#" + dept);
$seldept.empty();
$seldept.append("");
}
// ----查询区级列表
$.ajax({
url : url,
type : 'post',
dataType : 'json',
data : {
id : cityid
},
success : function(data) {
var obj = jQuery.parseJSON(data);
$.each(obj, function(i, item) {
$selcountry.append("");
});
}
});
}
// ---站点下拉事件--设置帐号省+市+区代码
function change_country_account(city, country, url) {
var $city = $("#" + city);
var cityid = $city.val(); // --派出所下拉
var provincedm = $("#d_provinceid").find("option:selected").attr("dm");
var citydm = $("#d_cityid").find("option:selected").attr("dm");
var countrydm = $("#d_countryid").find("option:selected").attr("dm");
var account = countrydm;
$("#d_account").val(account);
}
$(document).ready(function() {
$.formValidator.initConfig({
formID : "form_user",
theme : 'ArrowSolidBox',
mode : 'AutoTip',
onError : function(msg) {
alert(msg)
},
inIframe : true
});
$("#d_username").formValidator({
empty : false,
onShow : "请输入用户名称",
onFocus : "不能够为空",
onCorrect : "成功"
}).inputValidator({
min : 1,
max : 100,
onError : "用户名称输入非法,请确认?"
}).functionValidator({});
$("#d_account").formValidator({
empty : false,
onShow : "请输入帐号",
onFocus : "不能够为空",
onCorrect : "成功"
}).inputValidator({
min : 1,
max : 20,
onError : "帐号输入非法,请确认?"
}).functionValidator({}).ajaxValidator({
dataType : "json",
type : 'post',
data : {account : $("#account").val()
},
async : true,
url : "nozs/nol/to_account",
success : function(data) {
if ("1" == data) {
return true;
};
return false;
},
buttons : $("#sqzc"),
error : function() {
alert("服务器没有返回数据,可能服务器忙,请重试");
},
onError : "组织机构代码已经被注册,请重新输入!",
onWait : "正在对输入进行合法性校验,请稍候..."
});
$("#d_password").formValidator({
empty : false,
onShow : "请输入密码",
onFocus : "不能够为空",
onCorrect : "成功"
}).inputValidator({
min : 1,
onError : "密码输入非法,请确认?"
}).functionValidator({});
$("#ztjs").change(function() {
var page = $("#ztjs").val();
location.href = "./queryUsers?page=" + page;
});
});
function reloadAutoTip() {
$.formValidator.reloadAutoTip();
}