<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>案例管理</title>
	<meta name="decorator" content="default"/>
	<%@include file="/webpage/include/treeview.jsp" %>
	<%
		Object sign = request.getAttribute("sign");
	%>
	<script type="text/javascript">
		function refresh(){//刷新
			
			window.location="${ctx}/caseinfo/caseInfo/index";
		}
	</script>
	<style>
		body{
			background-color:transparent;
			filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#26FFFFFF, endColorstr=#26FFFFFF);
			color:#ffffff;
			background-color:rgba(255,255,255,0);
			height:100%;
		}
	</style>
</head>
<body class="gray-bg">
	
	<div class="wrapper wrapper-content full-width" id="divId">
	<sys:message content="${message}"/>
		<div id="content" class="pr full-height full-width">
			<div id="left"  class="contentShadow fl contents">
				<div class="ztreeContainer">
					<div id="ztree" class="ztree leftBox-content"></div>
				</div>
			</div>
			<div id="right"  class="fl contents">
				<div class="layui-row contentShadow full-height tran-bg">
					<iframe id="officeContent" name="officeContent" src="${ctx}/caseinfo/caseInfo/list?sign=<%=sign%>" width="100%" height="100%" frameborder="0"></iframe>
				</div>
			</div>
		</div>
	</div>
	<script>
        // function resizeWindow()
        // {
            // var winH = $("#divId").height();
            // var winW = $("#divId").width();
            // var h = winH - 8;
			//$("#left").attr("style","height:" + h +"px");
            // $("#right").attr("style","width:"+ (winW - 220 - 8)  +"px");
            // $(".ztreeContainer").attr("style","max-height:" + (h - 32 - 2) + "px");
            // $(".ztreeContainer .ztree").attr("style","min-width:" + (220 -32 - 2) + "px");

            // var updiv= $("#queryDiv").height();
            // $(".contentDetails").css('height',(winH - updiv - 25) +'px');//这里的div，选择你的那个div
        // }
        // resizeWindow();
        // $(window).resize(function(){
        //     resizeWindow();
        // });
	</script>

	<script type="text/javascript">
        var sign = '<%=sign%>';
        console.log(sign);

        function addDiyDom(treeId, treeNode) {
            var spaceWidth = 15;
            var switchObj = $("#" + treeNode.tId + "_switch"),
                icoObj = $("#" + treeNode.tId + "_ico");
            switchObj.remove();
            icoObj.before(switchObj);

            if (treeNode.level > 0) {
                var spaceStr = "<span style='display: inline-block;width:" + (spaceWidth * treeNode.level)+ "px'></span>";
                switchObj.before(spaceStr);
            }
        }

		var setting = {data:{simpleData:{enable:true,idKey:"id",pIdKey:"pId",rootPId:'0'}},
			callback:{onClick:function(event, treeId, treeNode){
					var id = treeNode.id == '0' ? '' :treeNode.id;
					$('#officeContent').attr("src","${ctx}/caseinfo/caseInfo/list?caseCategory.id="+id+"&caseCategory.name="+encodeURI(treeNode.name));
				}
			}
			,view:{
                showLine: false,
                showIcon: false,
                addDiyDom: addDiyDom
			}
		};
		
		function refreshTree(){
			$.getJSON("${ctx}/casecategory/caseCategory/treeData",function(data){
				$.fn.zTree.init($("#ztree"), setting, data);//.expandAll(true);
			});
		}
		refreshTree();
        // var width = $('#divId').width();
        // var leftWidth = width*0.1; // 左侧窗口大小
		// var htmlObj = $("html"), mainObj = $("#main");
		// var frameObj = $("#left, #openClose, #right, #right iframe");
		// function wSize(){
		// 	var strs = getWindowSize().toString().split(",");
		// 	htmlObj.css({"overflow-x":"hidden", "overflow-y":"hidden"});
		// 	mainObj.css("width","auto");
		// 	frameObj.height(strs[0] - 120);
         //    $("#content").width(width);
         //    $("#left").width(width*0.12);
         //    $("#ztree").width(width*0.12);
         //    $("#ztree").height('86%');
         //    $("#right").width(width*0.80);
         //    $("#officeContent").width(width*0.80);
		// }
	</script>
	<%--<script src="${ctxStatic}/common/wsize.min.js" type="text/javascript"></script>--%>
</body>
</html>