<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>字典管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
	    	return false;
	    }
	</script>
	<style>
		body{
			background-color:transparent;
			filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
			color:#ffffff;
			background-color:rgba(255,255,255,0);
			height:100%;
		}
	</style>
</head>
<body>
<div class="wrapper wrapper-content">
	<sys:message content="${message}"/>
	<div class="layui-row">
		<div class="full-width fl">
			<div class="contentShadow layui-row" id="queryDiv">
			<form:form id="searchForm" modelAttribute="dict" action="${ctx}/sys/dict/" method="post" class="form-inline">
				<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
				<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
				<table:sortColumn id="orderBy" name="orderBy" value="${page.orderBy}" callback="sortOrRefresh();"/><!-- 支持排序 -->

				<div class="commonQuery">
					<div class="layui-item query athird">
						<label class="layui-form-label">类型：</label>
						<div class="layui-input-block with-icon">
							<form:select id="type" path="type" class="form-control simple-select"><form:option value="" label=""/><form:options items="${typeList}" htmlEscape="false"/></form:select>
						</div>
					</div>
					<div class="layui-item query athird">
						<label class="layui-form-label">描述：</label>
						<div class="layui-input-block">
							<form:input path="description" htmlEscape="false" maxlength="50" class="form-control"/>
						</div>
					</div>
					<div class="layui-item athird">
						<div class="input-group">
							<button id="searchReset" class="fixed-btn searchReset fr" onclick="resetSearch()">重置</button>
							<button id="searchQuery" class="fixed-btn searchQuery fr" onclick="search()">查询</button>
						</div>
					</div>
					<div style="    clear:both;"></div>
				</div>
			</form:form>
			</div>
		</div>

		<div class="full-width fl">
			<div class="contentShadow layui-form contentDetails">
				<div class="nav-btns">
					<shiro:hasPermission name="sys:dict:add">
						<table:addRow url="${ctx}/sys/dict/form" title="字典"></table:addRow><!-- 增加按钮 -->
					</shiro:hasPermission>
					<shiro:hasPermission name="sys:dict:edit">
						<table:editRow url="${ctx}/sys/dict/form" id="contentTable"  title="字典"></table:editRow><!-- 编辑按钮 -->
					</shiro:hasPermission>
					<shiro:hasPermission name="sys:dict:del">
						<table:delRow url="${ctx}/sys/dict/deleteAll" id="contentTable"></table:delRow><!-- 删除按钮 -->
					</shiro:hasPermission>
					<button class="nav-btn nav-btn-refresh" data-toggle="tooltip" data-placement="left" onclick="sortOrRefresh()" title="刷新"><i class="glyphicon glyphicon-repeat"></i>&nbsp;刷新</button>
					<div style="clear: both;"></div>
				</div>
	

	
				<table id="contentTable" class="table table-striped table-bordered  table-hover table-condensed  dataTables-example dataTable no-footer">
					<thead>
						<tr>
							<th width="40" > <input type="checkbox" class="i-checks"></th>
							<th width="100" style="text-align: center;" class="sort-column value">键值</th>
							<th style="text-align: center;">标签</th>
							<th style="text-align: center;" class="sort-column type">类型</th>
							<th style="text-align: center;" class="sort-column description">描述</th>
							<th width="100" style="text-align: center;" class="sort-column sort">排序</th>
							<th width="250" style="text-align: center;">操作</th>
						</tr>
					</thead>
					<tbody>
					<c:forEach items="${page.list}" var="dict">
						<tr>
							<td> <input type="checkbox" id="${dict.id}" class="i-checks"></td>
							<td>${dict.value}</td>
							<td><a class="attention-info" href="javascript:void(0)" onclick="openDialogView('查看字典', '${ctx}/sys/dict/form?id=${dict.id}&view=1','95%','95%')">${dict.label}</a></td>
							<td><a href="javascript:" onclick="$('#type').val('${dict.type}');$('#searchForm').submit();return false;">${dict.type}</a></td>
							<td>${dict.description}</td>
							<td>${dict.sort}</td>
							<td class="op-td text-center">
								<div class="op-btn-box">
								<shiro:hasPermission name="sys:dict:view">
									<a href="javascript:void(0)" onclick="openDialogView('查看字典', '${ctx}/sys/dict/form?id=${dict.id}&view=1','95%','95%')" class="op-btn op-btn-view" ><i class="fa fa-search-plus"></i> 查看</a>
								</shiro:hasPermission>
								<shiro:hasPermission name="sys:dict:edit">
									<a href="javascript:void(0)" onclick="openDialog('修改字典', '${ctx}/sys/dict/form?id=${dict.id}','95%','95%')" class="op-btn op-btn-edit" ><i class="fa fa-edit"></i> 修改</a>
								</shiro:hasPermission>
								<shiro:hasPermission name="sys:dict:del">
									<a href="${ctx}/sys/dict/delete?id=${dict.id}&type=${dict.type}" onclick="return confirmx('确认要删除该字典吗？', this.href)"   class="op-btn op-btn-delete"><i class="fa fa-trash"></i> 删除</a>
								</shiro:hasPermission>
								<shiro:hasPermission name="sys:dict:add">
									<a href="javascript:void(0)" onclick="openDialog('添加键值', '<c:url value='${fns:getAdminPath()}/sys/dict/form?type=${dict.type}&sort=${dict.sort+10}'><c:param name='description' value='${dict.description}'/></c:url>','95%','95%')" class="op-btn op-btn-revert" ><i class="fa fa-plus"></i> 添加键值</a>
								</shiro:hasPermission>
								</div>
							</td>
						</tr>
					</c:forEach>
					</tbody>
				</table>
				<!-- 分页代码 -->
				<table:page page="${page}"></table:page>
				<div style="clear: both;"></div>
			</div>
		</div>
	</div>
</div>
<script>
    $("a").on("click",addLinkVisied);
    resizeListWindow1();
    $(window).resize(function(){
        resizeListWindow1();
    });
</script>
</body>
</html>