<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>     
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">                      
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black"> 
<meta name="format-detection" content="telephone=no">
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> 
<meta name="renderer" content="webkit">
<!-- 移动设备 viewport -->                                     
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0">   
<jsp:include page="../../../common.jsp" />
<title>编辑</title>
</head>
<div class="layui-fluid">
	<form action="" class="layui-form" lay-filter="form">
		<input autocomplete="off" class="layui-input layui-hide" name="id" value="${entity.id}" type="text">
		<div class="layui-form-item">
			<label class="layui-form-label">角色名称</label>
			<div class="layui-input-block">
				<input autocomplete="off" class="layui-input" lay-verify="required" name="name" placeholder="角色名称" value="${entity.name}" type="text">
			</div>
		</div>

		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-filter="demo1" lay-submit type="submit">保存</button>
			</div>
		</div>
	</form>
</div>

<script>
	layui.use(['form'], function () {
		let form = layui.form;
		$ = layui.$;
		form.on("submit(demo1)", function (d) {
			$.ajax({
				url: ctx + '/roleInfo/save'
				, type: 'POST'
				, data: d.field
				, success: function (data) {
					if (data.code === 200) {
						parent.layer.msg("保存成功")
						let index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
						parent.layer.close(index);
						parent.tabReload();
					} else {
						parent.layer.msg("保存失败")
					}
				}
			})

			return false;
		})
	})
</script>
</html>

