|
|
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
|
|
|
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
|
|
|
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
|
|
|
<%
|
|
|
String path = request.getContextPath();
|
|
|
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
|
|
|
|
|
|
%>
|
|
|
<head>
|
|
|
<meta charset="UTF-8">
|
|
|
<title>人事系统</title>
|
|
|
|
|
|
<link rel="stylesheet" href="<%=basePath%>/css/xadmin.css">
|
|
|
<script src="<%=basePath%>/layui-v2.6.6/layui/layui.js" charset="utf-8"></script>
|
|
|
<script type="text/javascript" src="<%=basePath%>/js/xadmin.js"></script>
|
|
|
<!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
|
|
|
<!--[if lt IE 9]>
|
|
|
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
|
|
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
|
|
<![endif]-->
|
|
|
</head>
|
|
|
<body>
|
|
|
<div class="layui-fluid">
|
|
|
<div class="layui-row">
|
|
|
<form class="layui-form" name="dataForm" id="dataForm">
|
|
|
<div class="layui-form-item">
|
|
|
<label for="rname" class="layui-form-label">
|
|
|
<span class="x-red">*</span>角色名称:
|
|
|
</label>
|
|
|
<div class="layui-input-inline">
|
|
|
<input type="text" id="rname" name="rname" required="" lay-verify="required|rname" autocomplete="off" class="layui-input">
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
<div class="layui-form-item layui-form-text">
|
|
|
<label for="rremark" class="layui-form-label">备注</label>
|
|
|
<div class="layui-input-block" style="width: 75%">
|
|
|
<textarea placeholder="请输入内容" id="rremark" name="rremark" class="layui-textarea"></textarea>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div style="margin-left: 40%">
|
|
|
<input type="button" lay-filter="submit" class="layui-btn" id ="submit" lay-submit="" value="添加"/>
|
|
|
<input type="button" class="layui-btn" id ="gb" value="关闭"/>
|
|
|
</div>
|
|
|
</form>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<script>layui.use(['form', 'layer'],
|
|
|
function() {
|
|
|
$ = layui.jquery;
|
|
|
var form = layui.form,
|
|
|
layer = layui.layer;
|
|
|
|
|
|
//自定义验证规则
|
|
|
form.verify({
|
|
|
rname: function(value){
|
|
|
if(value.length <= 0){
|
|
|
return '角色名称不能为空';
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
//监听提交
|
|
|
form.on("submit(submit)", function (data) {
|
|
|
/*var data = $("#dataForm").serialize();*/
|
|
|
$.ajax({
|
|
|
"url":"<%=request.getContextPath()%>/role/add.do",
|
|
|
"data":data.field,
|
|
|
"type":"post",
|
|
|
"dataType":"json",
|
|
|
"success":function(res){
|
|
|
//后台操作成功
|
|
|
if(res.code ==0){
|
|
|
layer.alert("添加成功!", {
|
|
|
icon: 6
|
|
|
},
|
|
|
function() {
|
|
|
//关闭当前frame
|
|
|
xadmin.close();
|
|
|
// 可以对父窗口进行刷新
|
|
|
xadmin.father_reload();
|
|
|
});
|
|
|
}else{
|
|
|
layer.alert(res.msg+",请联系系统管理人员!", {icon: 5});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
//监听关闭
|
|
|
$("#gb").on('click',function(){
|
|
|
xadmin.del_tab();
|
|
|
})
|
|
|
|
|
|
});
|
|
|
|
|
|
</script>
|
|
|
<script>
|
|
|
|
|
|
</script>
|
|
|
</body>
|
|
|
|
|
|
</html>
|