<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<%@include file="/views/common.jsp"%>
<title>修改用户</title>
</head>
<body>
	<div class="layui-input-block layui-form" lay-filter="addUser"
		style="margin-top: 30px">
		<form class="layui-form " action="">
			<input type="hidden" name="roleId" id="roleId">
			<div class="layui-form-item">
				<label class="layui-form-label">角色名称</label>
				<div class="layui-input-inline">
					<input type="text" name="roleName" id="roleName" placeholder="角色名称" 
						class="layui-input" autocomplete="off">
				</div>
				<!-- <div class="layui-form-mid layui-word-aux">不可修改</div> -->
			</div>
			<div class="layui-form-item">
				<div class="layui-inline">
					<label class="layui-form-label">说明</label>
					<div class="layui-input-inline">
						<textarea rows="5" cols="20" name="remark" id="remark" placeholder="角色说明" autocomplete="off"></textarea>
					</div>
				</div>
			</div>
			
		<!-- 	<div class="layui-form-item">
				<label class="layui-form-label">状态</label>
				<div class="layui-input-block" >
					<input type="radio" name="isRegist" class="isRegist" value="1" title="启用" >
					<input type="radio" name="isRegist" class="isRegist" value="0" title="禁用">
				</div>
			</div> -->

			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" lay-submit="" lay-filter="enadd">确认修改</button>
				</div>
			</div>
		</form>
	</div>
	<script type="text/javascript">
		layui.use([ 'table', 'laydate', 'form','layer'], function() {
			var $ = layui.jquery;
			var table = layui.table;
			var laydate = layui.laydate;
			var form = layui.form;
			var layer = layui.layer;
			form.on('submit(enadd)',function(data){
				$.ajax({
					url:'${pageContext.request.contextPath}/updateRole',
					dataType : 'json',
					data:$(data.form).serialize(),
					type : 'post',
					success:function(data){
						if (data.code == 200) {
							layer.msg('修改成功！',{icon:6,offset:"auto",time:2000});//提示框
						}else  {
							layer.msg('修改失败！',{icon:5,offset:"auto",time:2000});//提示框
						}
						setTimeout(function(){
							var index = parent.layer.getFrameIndex(window.name);//获取窗口索引
							parent.layer.close(index);//关闭弹出层
							parent.layui.table.reload("roleTableAll"); //重新加载页面表格
						}, 2100);
					}
				})
				return false;
			});
		})
	</script>
</body>
</html>