<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>

<head>
	<title>系统角色管理</title>
	<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
	<link href="<c:url value='/scripts/lib/layui/layui.css'/>" rel="stylesheet" type="text/css" />
	<!-- bootstrap 3.0.2 -->
	<link href="<c:url value='/styles/lib/bootstrap.min.css'/>" rel="stylesheet" type="text/css" />
	<!-- font Awesome -->
	<link href="<c:url value='/styles/lib/font-awesome.min.css'/>" rel="stylesheet" type="text/css" />
	<!-- Ionicons -->
	<link href='<c:url value='/styles/lib/ionicons.min.css' />' rel="stylesheet" type="text/css" />
	<!-- DATA TABLES -->
	<link href="<c:url value='/styles/lib/datatables/dataTables.bootstrap.css' />" rel="stylesheet" type="text/css" />
	<!-- Theme style -->
	<link href="<c:url value='/styles/AdminLTE.css'/>" rel="stylesheet" type="text/css" />
	<link href="<c:url value='/scripts/zTree/css/zTreeStyle/zTreeStyle.css'/>" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="<c:url value='/scripts/lib/jquery-1.8.2.min.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/scripts/lib/layui/layui.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/scripts/zTree/js/jquery.ztree.core-3.5.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/scripts/zTree/js/jquery.ztree.excheck-3.5.js'/>"></script>
  <script type="text/javascript" src="<c:url value='/scripts/zTree/js/jquery.ztree.exedit-3.5.js'/>"></script>
  <script type="text/javascript" src="<c:url value='/scripts/admin/cjqt.js'/>"></script>

	<link href="<c:url value='/styles/vehicleClean/home.css'/>" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" href="<c:url value='/styles/admin/roleForm.css'/>" type="text/css" />
	<link href="<c:url value='/styles/notice/tradeAreaBanner.css'/>" rel="stylesheet" type="text/css" />
</head>

<body>
	<script type="text/javascript">
		$(document).keyup(function (event) {
			if (event.ctrlKey && event.keyCode == 122) {
				$('#syscode').show();
			}
		});
	</script>
	<input type="hidden" value="${ctx}" id="contextPath">
	<section class="content role-form app-func" style="margin-bottom:50px;">
		<div class="row">
			<div class="role-edit" style="float:left;">
				<div class="box box-warning" style="height:400px;">
					<div class="box-header">
						<h3 class="box-title">编辑角色基本信息 &nbsp;&nbsp; <strong font-color="red">${errormsg}</strong></h3>
					</div>
					<div class="box-body">
						<form:form action="${ctx}/admin/role/form" modelAttribute="role" method="post" id="conditionform">
							<form:hidden path="id" name="id" id="roleid" />
							<input type="hidden" name="actType" value="save">
							<input type="hidden" name="funcIds" id="funcIds">
							<!-- 当前功能id -->
							<input type="hidden" name="funcid" value="${funcid}">

							<div class="form-group" <c:if test="${id eq -1}">style="display: none;"</c:if>>
								<!-- <c:if test="${fn:length(orgs) > 1}">
									<label> -->
										<!-- <span style="color: red">*</span> -->
										<!-- 选择校区</label>
									<select name="orgId" id="orgId">
										<option value="">请选择校区</option>
										<c:forEach items="${orgs }" var="org">
											<c:choose>
												<c:when test="${org.id==orgId }">
													<option value="${org.id }" selected="selected">${org.name }</option>
												</c:when>
												<c:otherwise>
													<option value="${org.id }">${org.name }</option>
												</c:otherwise>
											</c:choose>
										</c:forEach>
									</select>
								</c:if> -->
								<!-- <c:if test="${fn:length(orgs) == 1}">
									<input type="hidden" id="orgId" name="orgId" value="${orgs[0].id}">
                </c:if> -->
                <c:if test="${fn:length(orgs) > 1}">
                    <div class=" part-wp">
                      <label>选择校区</label>
                      <c:if test="${empty orgId}">
                        <input class="default-select" name="orgId" id="orgId" autocomplete="off"  placeholder="请选择校区"/>
                      </c:if>
                      <c:if test="${not empty orgId}">
                        <c:forEach items="${orgs }" var="org">
                          <c:choose>
                            <c:when test="${org.id==orgId }">
                              <input class="default-select" name="orgId" id="orgId" autocomplete="off" placeholder="请选择校区" value="${org.name}" org__id="${org.id}"/>
                            </c:when>
                          </c:choose>
                        </c:forEach>
                      </c:if>
                      <span class="select_wrap _hide" style="width: 470px"></span>
                    </div>
                  </c:if>
                  <c:if test="${fn:length(orgs) == 1}">
                    <input type="hidden" name="orgId" id="orgId" value="${orgs[0].id}" org__id="${orgs[0].id}" class="single-orgid">
                  </c:if>
							</div>

							<div class="form-group">
								<label>
									<!-- <span style="color: red">*</span> -->
									名称</label>
								<form:input path="name" cssClass="form-control" aria-placeholder="请输入角色名称" />
							</div>
							<div class="form-group">
								<label>角色描述</label>
								<form:input path="description" cssClass="form-control" aria-placeholder="请输入角色描述" />
							</div>

							<div class="form-group">
								<label>初始化数据</label>
								<form:select path="ISINITIALIZATION" cssClass="form-control">
									<form:option value="0">否</form:option>
									<form:option value="1">是</form:option>
								</form:select>
							</div>
							<div class="form-group">
								<label>数据类型</label>
								<c:if test="${empty id}">
									<form:select path="FLOOR_REPAIR" cssClass="form-control">
										<form:option value="3">无</form:option>
										<form:option value="1">会议室楼层</form:option>
										<form:option value="2">全楼层</form:option>
										<form:option value="4" >维修类型</form:option>
									</form:select>
								</c:if>
								<c:if test="${not empty id}">
									<form:select path="FLOOR_REPAIR" cssClass="form-control" onfocus="this.defaultIndex=this.selectedIndex;" onchange="this.selectedIndex=this.defaultIndex;">
										<form:option value="3">无</form:option>
										<form:option value="1">会议室楼层</form:option>
										<form:option value="2">全楼层</form:option>
										<form:option value="4" >维修类型</form:option>
									</form:select>
								</c:if>
							</div>
							<div id='syscode' class="form-group" style="display: none">
								<label>系统编码</label>
								<form:input path="SYSCODE" cssClass="form-control" />
							</div>


							<!-- 
							<div class="form-group">
								<label>角色类型</label> 
								<form:select path="roleType" cssClass="form-control">
									<form:option value="1" >普通用户</form:option>
									<form:option value="0">系统管理员</form:option>
								</form:select>
							</div>
							 -->
						</form:form>
					</div>
				</div>
			</div>
			<ul id="tree1" class="ztree" style="display: none"></ul>
			<ul id="tree2" class="ztree" style="display: none"></ul>
			<div class="role-power">
				<div class="title">web后台功能权限</div>
				<div class="web-power tables" id="tableWeb">
					<table class="layui-hide" id="table_role_web" lay-filter="testWeb"></table>
				</div>
				<div class="title">app功能权限</div>
				<div class="wx-power tables" id="tableWx">
					<table class="layui-hide" id="table_user_wx" lay-filter="testWx"></table>
				</div>
			</div>
			<!-- <div class="col-md-7">
				<div class="box box-warning" style="height:460px;overflow:auto;">
					<div class="box-header">
						<h3 class="box-title">选择角色的功能</h3>
					</div>
					<div class="box-body">
						<ul id="tree" class="ztree">
						</ul>
					</div>
				</div>
			</div> -->
			<div align="absmiddle" class="btns">
				<a class="btn btn-red" href="#" id='btn-save'>保存</a>
				<a class="btn btn-white" href="<c:url value='/admin/role/list?funcid=${funcid}' />">返回</a>
			</div>
		</div>

	</section>
	<script type="text/javascript" src="<c:url value='/scripts/admin/roleform.js'/>"></script>
</body>

</html>