var validator_config = {
|
message: '输入框内容不能为空',
|
feedbackIcons: {
|
valid: 'glyphicon glyphicon-ok',
|
invalid: 'glyphicon glyphicon-remove',
|
validating: 'glyphicon glyphicon-refresh'
|
},
|
fields:{
|
name:{
|
validators:{
|
notEmpty: {
|
message: '用户组名不能为空',
|
},
|
remote: {
|
url: SITE_URL+'/role/role/checkRoleName',
|
message: '用户组名已经存在,无法再次创建',
|
type: 'POST'
|
}
|
}
|
},
|
}
|
|
|
}
|
|
//栏目点击
|
$('.module').click(function(){
|
if($(this).is(":checked")){
|
$(this).parent().parent().find('.module').attr("checked", "checked");
|
}
|
else{
|
$(this).parent().parent().find('.module').removeAttr("checked");
|
}
|
});
|
|
|
$('#validateform').bootstrapValidator(validator_config).on('success.form.bv', function(e) {
|
e.preventDefault();
|
|
$("#dosubmit").attr("disabled","disabled");
|
$.scojs_message('请稍候...', $.scojs_message.TYPE_WAIT);
|
$.ajax({
|
type: "POST",
|
url: SITE_URL+"/role/role/add",
|
data: $("#validateform").serialize(),
|
success:function(response){
|
var dataObj=jQuery.parseJSON(response);
|
if(dataObj.code == 200)
|
{
|
$.scojs_message('操作成功,3秒后将返回列表页...', $.scojs_message.TYPE_OK);
|
setTimeout(function(){window.location.href = SITE_URL+'/role/role/list';}, 1800);
|
}else
|
{
|
$.scojs_message(dataObj.content, $.scojs_message.TYPE_ERROR);
|
$("#dosubmit").removeAttr("disabled");
|
}
|
},
|
error: function (request, status, error) {
|
$.scojs_message(request.responseText, $.scojs_message.TYPE_ERROR);
|
$("#dosubmit").removeAttr("disabled");
|
}
|
});
|
|
}).on('error.form.bv',function(e){ $.scojs_message('登录中遇到错误,请按照提示修改', $.scojs_message.TYPE_ERROR);$("#dosubmit").removeAttr("disabled");});
|