7f4c73ba6d55480df1ada71f2ae57ddef3d91247.svn-base 3.43 KB
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>要素代码表管理</title>
	<meta name="decorator" content="default"/>
	<%@include file="/WEB-INF/views/include/treetable.jsp" %>
	<script type="text/javascript">
		$(document).ready(function() {
			var tpl = $("#treeTableTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g,"");
			var data = ${fns:toJson(list)}, ids = [], rootIds = [];
			for (var i=0; i<data.length; i++){
				ids.push(data[i].id);
			}
			ids = ',' + ids.join(',') + ',';
			for (var i=0; i<data.length; i++){
				if (ids.indexOf(','+data[i].parentId+',') == -1){
					if ((','+rootIds.join(',')+',').indexOf(','+data[i].parentId+',') == -1){
						rootIds.push(data[i].parentId);
					}
				}
			}
			for (var i=0; i<rootIds.length; i++){
				addRow("#treeTableList", tpl, data, rootIds[i], true);
			}
			$("#treeTable").treeTable({expandLevel : 5});
		});
		function addRow(list, tpl, data, pid, root){
			for (var i=0; i<data.length; i++){
				var row = data[i];
				if ((${fns:jsGetVal('row.parentId')}) == pid){
					$(list).append(Mustache.render(tpl, {
						dict: {
						blank123:0}, pid: (root?0:pid), row: row
					}));
					addRow(list, tpl, data, row.id);
				}
			}
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/reg/base/regBaseElementCode/">要素代码表列表</a></li>
		<shiro:hasPermission name="reg:base:regBaseElementCode:edit"><li><a href="${ctx}/reg/base/regBaseElementCode/form">要素代码表添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="regBaseElementCode" action="${ctx}/reg/base/regBaseElementCode/" method="post" class="breadcrumb form-search">
		<ul class="ul-form">
			<li><label>要素代码:</label>
				<form:input path="name" htmlEscape="false" maxlength="10" class="input-medium"/>
			</li>
			<li><label>要素名称:</label>
				<form:input path="elementName" htmlEscape="false" maxlength="50" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="treeTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>要素代码</th>
				<th>要素名称</th>
				<th>要素类型</th>
				<th>更新时间</th>
				<th>备注信息</th>
				<shiro:hasPermission name="reg:base:regBaseElementCode:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody id="treeTableList"></tbody>
	</table>
	<script type="text/template" id="treeTableTpl">
		<tr id="{{row.id}}" pId="{{pid}}">
			<td><a href="${ctx}/reg/base/regBaseElementCode/form?id={{row.id}}">
				{{row.name}}
			</a></td>
			<td>
				{{row.elementName}}
			</td>
			<td>
				{{row.elementType}}
			</td>
			<td>
				{{row.updateDate}}
			</td>
			<td>
				{{row.remarks}}
			</td>
			<shiro:hasPermission name="reg:base:regBaseElementCode:edit"><td>
   				<a href="${ctx}/reg/base/regBaseElementCode/form?id={{row.id}}">修改</a>
				<a href="${ctx}/reg/base/regBaseElementCode/delete?id={{row.id}}" onclick="return confirmx('确认要删除该要素代码表及所有子要素代码表吗?', this.href)">删除</a>
				<a href="${ctx}/reg/base/regBaseElementCode/form?parent.id={{row.id}}">添加下级要素代码表</a> 
			</td></shiro:hasPermission>
		</tr>
	</script>
</body>
</html>