<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/layui/css/layui.css"
	  media="all">
<link rel="stylesheet" href="/com/com.css" media="all">
<script src="/jquery/jquery.min-1.12.3.js" charset="utf-8"></script>
<script src="/com/com.js" charset="utf-8"></script>
<link rel="stylesheet"
	href="/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">

<script type="text/javascript"
	src="/ztree/js/jquery.ztree.core.js"></script>

<meta charset="utf-8">
<title>layui</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<style type="text/css">
.leftPart {
	float: left;
	width: 250px;
}

.rightPart {
	postion: absuloted;
	margin-left: 200px;
}

#treeDemo {
	border: 1px solid #e4e4e4;
	background: #fff;
	width: 600px;
	height: 800px;
	overflow-y: scroll;
	overflow-x: auto;
}
</style>
</head>
<body>

	<div style="height: 5px;"></div>

	<div class="zTreeDemoBackground">
		<ul id="treeDemo" class="ztree"></ul>

	</div>

	<%-- <div class="rightPart">
		<div class="demoTable">
			搜索工号或姓名：
			<div class="layui-inline">
				<input class="layui-input" name="qname" id="qname" plete="off">
			</div>
			<button class="layui-btn" data-type="reload" id="searchdata">搜索</button>
		</div>
		<table class="layui-hide" id="LAY_table_user" lay-filter="user"></table>
		<div style="text-align: right; padding: 10px" class="submitselect">

			<input type="text" hidden="true" value="${id}" id = "syscodeId"></input>
			<button class="layui-btn layui-btn-lg savedata_"
				data-type="submit_data">确定</button>
		</div>
	</div> --%>


	<script src="/layui/layui.all.js" charset="utf-8"></script>
	<script>
var setting = {
		data : {
			key : {
				title : "t"
			},
			simpleData : {
				enable : true
			}
		},
		callback : {
			beforeClick : beforeClick,
			onClick : onClick
		}
	};

	
	var log, className = "dark";
	function beforeClick(treeId, treeNode, clickFlag) {
		className = (className === "dark" ? "" : "dark");
		return (treeNode.click != false);
	}
	var departmentId = "";
	function onClick(event, treeId, treeNode, clickFlag) {
		parent.setOrg(treeNode);

	}
	function getTime() {
		var now = new Date(), h = now.getHours(), m = now.getMinutes(), s = now
				.getSeconds();
		return (h + ":" + m + ":" + s);
	}
	



layui.use(['table','form'], function(){
	
	var form = layui.form;
	
	AjaxTool.XPost("/common/department", {}, function(data) {
		var treeData = data.data;
		
		var treeObj = $.fn.zTree.init($("#treeDemo"), setting, treeData);
		treeObj.expandAll(true);
		
		//layer.msg(JSON.stringify(data),{icon:1});
	}, function(err) {
		layer.msg("err", {
			icon : 2
		});
	});
	
	
	
  var table = layui.table;

  

  
  $('.demoTable .layui-btn,.savedata_').on('click', function(){
    var type = $(this).data('type');
    active[type] ? active[type].call(this) : '';
  });

});
</script>

</body>
</html>