The rendering tag menu formed by the ui tree initializes the display control (tree)

//Display the data in the data table as a tree structure
select * from t_b_area t start with t.source_type = 1 connect by t.parent_id = prior t.id.



//Entities of tree structure, use inner classes
/**
*
*/
package com.ces.zwww.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax .persistence.Entity;
import javax.persistence.Table;

import com.ces.xarch.core.entity.LongIDEntity;

@Entity
@Table(name = "T_B_AREA")
public class Area extends LongIDEntity {

/** serialVersionUID(long): .*/
private static final long serialVersionUID = -5967350210592855795L;

private String name;
private String mask;
private String remark;
private String address;

@Column(name="business_ip")
private String businessIp;

@Column(name="source_type")
private String sourceType;

@Column(name="parent_name")
private String parentName;

@Column(name="parent_id")
private Long parentId;

@Column(name="start_ip")
private String startIp;

@Column(name="end_ip")
private String endIp;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getMask() {
return mask;
}

public void setMask(String mask) {
this.mask = mask;
}

public String getRemark() {
return remark;
}

public void setRemark(String remark) {
this.remark = remark;
}

public String getAddress() {
return address;
}

public void setAddress(String address) {
this.address = address;
}

public String getBusinessIp() {
return businessIp;
}

public void setBusinessIp(String businessIp) {
this.businessIp = businessIp;
}

public String getSourceType() {
return sourceType;
}

public void setSourceType(String sourceType) {
this.sourceType = sourceType;
}

public String getParentName() {
return parentName;
}

public void setParentName(String parentName) {
this.parentName = parentName;
}

public Long getParentId() {
return parentId;
}

public void setParentId(Long parentId) {
this.parentId = parentId;
}

public String getStartIp() {
return startIp;
}

public void setStartIp(String startIp) {
this.startIp = startIp;
}

public String getEndIp() {
return endIp;
}

public void setEndIp(String endIp) {
this.endIp = endIp;
}

public class Tree {
private Long id;
private String name;
private String type;
private String mask;
private String busip;
private List<Tree> children;

public Tree(){

}

public Tree(Long id, String name, String type, String mask, String busip){
this.id = id;
this.name = name;
this.type = type;
this.mask = mask;
this.busip = busip;
this.children = new ArrayList<Area.Tree>();
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public String getMask() {
return mask;
}

public void setMask(String mask) {
this.mask = mask;
}

public String getBusip() {
return busip;
}

public void setBusip(String busip) {
this.busip = busip;
}

public List<Area.Tree> getChildren() {
return children;
}

public void setChildren(List<Area.Tree> children) {
this.children = children;
}

public void addChildren(Area.Tree tree) {
children.add(tree);
}
}
}





public List<Area.Tree> findByTree(){
List<Area.Tree> trees = new ArrayList<Area.Tree>();
List<Area> results = getDao().findByTree();
for (Area area : results) {
Area.Tree node = null;
if("1".equals(area.getSourceType())){
node = area.new Tree(area.getId(), area.getName(), area.getSourceType(), area.getMask(), area.getBusinessIp());
trees.add(node);
}else if("2".equals(area.getSourceType())){
node = getTreeNode(trees);
node.addChildren(area.new Tree(area.getId(), area.getName(), area.getSourceType(), area.getMask(), area.getBusinessIp()));
}else if("3".equals(area.getSourceType())){
node = getTreeNode(getTreeNode(trees).getChildren());
node.addChildren(area.new Tree(area.getId(), area.getName(), area.getSourceType(), area.getMask(), area.getBusinessIp()));
}
}
return trees;
}



<%
String data = IOUtil.ajaxContent(pageContext.getAttribute("basePath")+"/area!tree.json?parentId=0");
pageContext.setAttribute("ajaxdata", data);
%>

<!-- 左侧导航栏 -->
<uitag-core:sidebar collapse="false">
<uitag-core-sidebar:navitems>
<uitag-core-sidebar:navitem icon="fa-desktop" dropdown="true" title="资源分类" current="open" root="true">
<system:auth resKey="zwww.zygl.wlsb">
<uitag-core-sidebar:navitem icon="fa-caret-right" dropdown="true" tree="true" title="网络设备" url="wlsb/list.jsp" onclick="onSidebarClick(this)">
<cui:tree id="tree1" data="treedata" onClick="onTreeNodeClick"></cui:tree>
</uitag-core-sidebar:navitem>
</system:auth>
<system:auth resKey="zwww.zygl.aqsb">
<uitag-core-sidebar:navitem icon="fa-caret-right"dropdown="true" tree="true" title="安全设备" url="aqsb/list.jsp" onclick="onSidebarClick(this)">
<cui:tree id="tree2" data="treedata" onClick="onTreeNodeClick"></cui:tree>
</uitag-core-sidebar:navitem>
</system:auth>
<system:auth resKey="zwww.zygl.fwcc">
<uitag-core-sidebar:navitem icon="fa-caret-right" dropdown="true" tree="true" title="服务器及存储" url="fwqjcc/list.jsp" onclick="onSidebarClick(this)">
<cui:tree id="tree3" data="treedata" onClick="onTreeNodeClick"></cui:tree>
</uitag-core-sidebar:navitem>
</system:auth>
<system:auth resKey="zwww.zygl.jfjg">
<uitag-core-sidebar:navitem icon="fa-caret-right" dropdown="true" tree="true" title="机房机柜" url="jfjg/list.jsp" onclick="onSidebarClick(this)">
<cui:tree id="tree4" data="treedata" onClick="onTreeNodeClick"></cui:tree>
</uitag-core-sidebar:navitem>
</system:auth>
<system:auth resKey="zwww.zygl.gxll">
<uitag-core-sidebar:navitem icon="fa-caret-right" dropdown="true" tree="true" title="光纤链路" url="gxll/list.jsp" onclick="onSidebarClick(this)">
<cui:tree id="tree5" data="treedata" onClick="onTreeNodeClick"></cui:tree>
</uitag-core-sidebar:navitem>
</system:auth>
<system:auth resKey="zwww.zygl.yhjd">
<uitag-core-sidebar:navitem icon="fa-caret-right" dropdown="true" tree="true" title="用户节点" url="yhjd/list.jsp" onclick="onSidebarClick(this)">
<cui:tree id="tree6" data="treedata"onClick="onTreeNodeClick"></cui:tree>
</uitag-core-sidebar:navitem>
</system:auth>
<system:auth resKey="zwww.zygl.gcs">
<uitag-core-sidebar:navitem icon="fa-caret-right" dropdown="true" tree="true" title="工程师" url="gcs/list.jsp" onclick="onSidebarClick(this)">
<cui:tree id="tree7" data="treedata" onClick="onTreeNodeClick"></cui:tree>
</uitag-core-sidebar:navitem>
</system:auth>
</uitag-core-sidebar:navitem>
</uitag-core-sidebar:navitems>
</uitag-core:sidebar>

//传给url值之后进一步加入参数信息,让iframe加载url+parram
function onTreeNodeClick(event,treeid,node,flag){
var param = "?param=";
switch(node.type){
case "1":param += "{Q_EQ_area:'"+node.name+"'}";break;
case "2":param += "{Q_EQ_center:'"+node.name+"'}";break;
case "3":param += "{Q_EQ_street:'"+node.name+"'}";break;
default:param += "${param.param}";break;
}
$("#ListFrame").attr("src",url+param);
}11111111111111111111111111
//<system:auth resKey="zwww.zygl.yhjd">
//<uitag-core-sidebar:navitem
//icon="fa-caret-right"dropdown="true" tree="true"
//title="用户节点" url="yhjd/list.jsp"
//onclick="onSidebarClick(this)">
//<cui:tree //id="tree6"data="treedata" //onClick="onTreeNodeClick">//</cui:tree></uitag-core-//sidebar:navitem>
//</system:auth>

function onSidebarClick($this){//点击时将此菜单的url赋值
type = $this.title;
url = $($this).attr("url");
}

<script type="text/javascript">
var url,rowdata = {};
var type = '${param.type}';//From the layout menu
var area = '${param.area}';
var treedata = [{'id':'0','name': 'The whole city','open':true,'children':eval('(${ajaxdata})')}];
</script>
//From the layout first-level menu, click to enter this category Page menu
<!-- // modify by chanlong on 2014-12-01 09:56 -->
<layout:panel floats="left" width="auto">
<a href="${ctx}/views/ zwww/zygl/index.jsp?type=Network Equipment&area=citywide" class="navs-link"><span class="menus menu02"> </span></a>
</layout:panel>



/ /Page to be jumped after
<script type="text/javascript">
var postData = {'Q_EQ_devcType': 'wlsb'};
if("${param.param}"){
$.extend(postData, eval("(${param.param})"));//combine all parameters into json pairs here, To be used by the parameters after the jump page// of the small item menu
}
</script>

//Because our grid query uses postData as a parameter, so it is assembled like this, so that as long as search is called again, all the above menu parameters will be



fixed function search1() {
var nameip = $('# nameip').val();
var sblx = $('#sblx').combobox( "getValues" ).toString();
var sbzt = $("#sbzt").radiolist("getValue");
if ( nameip != "") {
postData['Q_LIKE_ip'] = nameip;
}
if (sblx != "") {
postData['Q_LIKE_resType'] = sblx;
}

if (sbzt != "all") {
postData['Q_LIKE_status '] = sbzt;
}else{//modify by Bao Jianmin, you need to delete the query item
delete postData['Q_LIKE_status'];
}
$('#list1').grid(' option', 'postData', postData);
$('#list1').grid('reload');
}



//Menu initialization display control

<script type="text/javascript">
$(function(){
clickSidebar();
});

// Automatically trigger the click event of the left tree node according to the parameters
function clickSidebar(){
if( type){
$("ul.submenu li a[title='"+type+"']").click();//Stimulate the click event of the menu that belongs to the parent menu in the current menu and matches the title of the title
//function onSidebarClick($this){//Assign the url of this menu when clicking
// type = $this.title;
// url = $($this).attr("url");
// }

}
if (area){
$("ul.submenu li a[title='"+type+"'] ~ ul.submenu").find("a[title='"+area+"']").click(); //First find the matching current first-level menu, and then match the title in the lower-level menu that matches the parameters on this basis, and trigger his click event

//function onTreeNodeClick(event, treeid, node, flag){
//var param = "?param=";
//switch(node.type){
//case "1":param
//+= "{Q_EQ_area:'"+node.name+"'}";break;
//case "2":param += "{Q_EQ_center:'"+node.name+"'}";break;
//case "3":param += "{Q_EQ_street:'"+node.name+"'}";break;
//default:param += "${param.param}";break;
//}
//$("#ListFrame").attr("src",url+param);
//}


//}
//}
</script>

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327077342&siteId=291194637