<div class="form-group">
<div class="row">
<label class="col-sm-2 control-label">配置权限</label>
<div class="col-sm-10">
<c:forEach var="m" items="${model }">
<c:forEach var="d" items="${m }">
<c:if test="${d.level == 0 }">//最高等级
<div class="col-sm-12" style="
<input type="checkbox" value="${d.id }" name="roleMenu" onclick="changeSubMenu(this)"><b>${d.name }</b>//选择 根目录 其子目录 全部选择
</div>
</c:if>
<c:if test="${d.level != 0 }">//根目录 对应的子目录
<div class="col-sm-12">
<input type="hidden" name="${d.superId }">
<input type="checkbox" value="${d.id }" name="roleMenu">${d.name }
</div>
</c:if>
</c:forEach>
</c:forEach>
</div>
</div>
</div>
function changeSubMenu(obj){
if(obj.checked){
$("input[type='hidden'][name='"+obj.value+"'] + input").prop("checked", "checked");
}else{
$("input[type='hidden'][name='"+obj.value+"'] + input").prop("checked", false);
}
}