x-admin 菜单栏 数据组装

var data_list  = [
		       	{
		    		"id": 1,
		    		"parentid": -1,
		    		"title": "管理员",
		    		"icon": null,
		    		"spread": "true",
		    		"href": "#",
		    		"children": [
		    			{
		    				"id": 2,
		    				"parentid": 1,
		    				"title": "管理导航",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "admin.aspx",
		    				"children": []
		    			},
		    			{
		    				"id": 3,
		    				"parentid": 1,
		    				"title": "数据统计",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "echarts/echarts_list.aspx",
		    				"children": []
		    			},
		    			{
		    				"id": 4,
		    				"parentid": 1,
		    				"title": "账号操作",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "account_management.aspx",
		    				"children": []
		    			},
		    			{
		    				"id": 5,
		    				"parentid": 1,
		    				"title": "账号管理",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "echarts/echarts_list.aspx",
		    				"children": [
		    					{
		    						"id": 6,
		    						"parentid": 5,
		    						"title": "账号删除",
		    						"icon": null,
		    						"spread": "true",
		    						"href": "Delete_lists.aspx",
		    						"children": []
		    					},
		    					{
		    						"id": 7,
		    						"parentid": 5,
		    						"title": "等级管理",
		    						"icon": null,
		    						"spread": "true",
		    						"href": "Delete_lists.aspx",
		    						"children": []
		    					}
		    				]
		    			}
		    		]
		    	},
		    	{
		    		"id": 8,
		    		"parentid": -1,
		    		"title": "订单管理",
		    		"icon": null,
		    		"spread": "true",
		    		"href": "#",
		    		"children": [
		    			{
		    				"id": 9,
		    				"parentid": 8,
		    				"title": "新建订单",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "create.aspx",
		    				"children": []
		    			},
		    			{
		    				"id": 10,
		    				"parentid": 8,
		    				"title": "订单列表",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "Order_list/Order_list.aspx",
		    				"children": []
		    			}
		    		]
		    	},
		    	{
		    		"id": 11,
		    		"parentid": -1,
		    		"title": "生产管理",
		    		"icon": null,
		    		"spread": "true",
		    		"href": "#",
		    		"children": [
		    			{
		    				"id": 12,
		    				"parentid": 11,
		    				"title": "生产录入",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "production_list.aspx",
		    				"children": []
		    			},
		    			{
		    				"id": 13,
		    				"parentid": 11,
		    				"title": "生产汇总",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "ProductionSummary.aspx",
		    				"children": []
		    			}
		    		]
		    	},
		    	{
		    		"id": 14,
		    		"parentid": -1,
		    		"title": "品质管理",
		    		"icon": null,
		    		"spread": "true",
		    		"href": "#",
		    		"children": [
		    			{
		    				"id": 15,
		    				"parentid": 14,
		    				"title": "品质不良录入",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "quality.aspx",
		    				"children": []
		    			},
		    			{
		    				"id": 16,
		    				"parentid": 14,
		    				"title": "不良列表",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "quality_bad.aspx",
		    				"children": []
		    			}
		    		]
		    	},
		    	{
		    		"id": 17,
		    		"parentid": -1,
		    		"title": "市场管理",
		    		"icon": null,
		    		"spread": "true",
		    		"href": "#",
		    		"children": [
		    			{
		    				"id": 18,
		    				"parentid": 17,
		    				"title": "出货管理",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "Shipments_list.aspx",
		    				"children": []
		    			},
		    			{
		    				"id": 19,
		    				"parentid": 17,
		    				"title": "已出报表",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "ShipmentReport.aspx",
		    				"children": []
		    			},
		    			{
		    				"id": 20,
		    				"parentid": 17,
		    				"title": "欠交列表",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "SubdueReport.aspx",
		    				"children": []
		    			}
		    		]
		    	},
		    	{
		    		"id": 21,
		    		"parentid": -1,
		    		"title": "仓储管理",
		    		"icon": null,
		    		"spread": "true",
		    		"href": "#",
		    		"children": [
		    			{
		    				"id": 22,
		    				"parentid": 21,
		    				"title": "仓储列表",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "Web_cangchu.aspx",
		    				"children": []
		    			}
		    		]
		    	},
		    	{
		    		"id": 23,
		    		"parentid": -1,
		    		"title": "图号信息管理",
		    		"icon": null,
		    		"spread": "true",
		    		"href": "#",
		    		"children": [
		    			{
		    				"id": 24,
		    				"parentid": 23,
		    				"title": "图号信息列表",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "thLists.aspx",
		    				"children": []
		    			}
		    		]
		    	},
		    	{
		    		"id": 25,
		    		"parentid": -1,
		    		"title": "密码管理",
		    		"icon": null,
		    		"spread": "true",
		    		"href": "#",
		    		"children": [
		    			{
		    				"id": 26,
		    				"parentid": 25,
		    				"title": "重置密码",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "reset.aspx",
		    				"children": []
		    			}
		    		]
		    	},
		    	{
		    		"id": 27,
		    		"parentid": -1,
		    		"title": "操作手册",
		    		"icon": null,
		    		"spread": "true",
		    		"href": "#",
		    		"children": [
		    			{
		    				"id": 28,
		    				"parentid": 27,
		    				"title": "操作手册",
		    				"icon": null,
		    				"spread": "true",
		    				"href": "manual.aspx",
		    				"children": []
		    			}
		    		]
		    	}
		    ];
		
		//组装成菜单栏
		var table1 = "";
		for( var a = 0; a < data_list.length; a++){
			table1+='<li>';
			table1+='<a href="javascript:;">';
			table1+='<i class="iconfont left-nav-li" lay-tips='+data_list[a].title+'>'+data_list[a].icon+'</i>';
			table1+='<cite>'+data_list[a].title+'</cite>';
			table1+='<i class="iconfont nav_right">&#xe697;</i>';
			table1+='</a>';
			var two_list = data_list[a].children; //二级菜单
			if(two_list != undefined){
				table1+='<ul class="sub-menu">';
				for(var b=0;b<two_list.length;b++){
					table1+='<li>';
					if(two_list[b].href != ""){ //通过href 判断当前权限是否是需要添加事件
						table1+='<a onclick="xadmin.add_tab('+two_list[b].title+','+two_list[b].href+')">';
					}else{
						table1+='<a>';
					}
					if(two_list[b].children != undefined){ //通过判断当前权限是否有下级菜单 添加
						table1+='<i class="iconfont">'+two_list[b].icon+'</i>';
						table1+='<cite>'+two_list[b].title+'</cite>';
						table1+='<i class="iconfont nav_right">&#xe697;</i>';
					}else{
						table1+='<i class="iconfont">&#xe6a7;</i>';
						table1+='<cite>'+two_list[b].title+'</cite>';
					}
					table1+='</a>';
					var three_list = two_list[b].children; //三级菜单
					if(three_list != undefined){
						table1+='<ul class="sub-menu">';
						for ( var c = 0; c < three_list.length; c++) {
							table1+='<li>';
							table1+='<a onclick="xadmin.add_tab('+three_list[c].title+','+three_list[c].href+')">';
							table1+='<i class="iconfont">&#xe6a7;</i>';
							table1+='<cite>'+three_list[c].title+'</cite>';
							table1+='</a>';
							table1+='</li>';
						}
						table1+='</ul>';
					}
					table1+'</li>';
				}
				table1+='</ul>';
			}
			table1+='</li>';
		}
		
		$("#nav").append(table1);

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码奴生来只知道前进~

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值