树形选择框(jsp页面样板)

<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/portal/share/common/head.jsp"%>
<%@page import="net.e_lian.bpm.core.user.action.WebUser"%>
<%@page import="net.e_lian.bpm.constans.Web"%>
<%
WebUser webUser = (WebUser) session.getAttribute(Web.SESSION_ATTRIBUTE_FRONT_USER);
String domainid=webUser.getDomainid();
String applicationid=request.getParameter("application");
String path=request.getContextPath();
 
%>
<HTML>
<HEAD>
<TITLE> 部门选择框</TITLE>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<script type="text/javascript" src="<s:url value='/portal/share/script/json/json2.js'/>"></script>
<!-- - -->
<link rel="stylesheet" href="<%=path%>/portal/gomeresource/zTree_v3/css/demo.css" type="text/css">
<link rel="stylesheet" href="<%=path%>/portal/gomeresource/zTree_v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
<link rel="stylesheet" href="<%=path%>/portal/gomeresource/LTSoft_Shell/css/ace.min.css" type="text/css">
<link rel="stylesheet" href="<%=path%>/portal/gomeresource/SoruceFile/bootstrap/bootstrap-3.1.1/css/bootstrap.min.css" type="text/css">

<script type="text/javascript" src="<%=path%>/portal/gomeresource/zTree_v3/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="<%=path%>/portal/gomeresource/zTree_v3/js/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript" src="<%=path%>/portal/gomeresource/zTree_v3/js/jquery.ztree.excheck-3.5.js"></script>
<!--
<script type="text/javascript" src="../../../js/jquery.ztree.exedit-3.5.js"></script>
-->
<style type="text/css">
<!--设置DIV块的边界为5px-->
div{margin:5px;border:0;padding:0;}
#Box1{
    width:200px;
    height:72px;
    background-color:#666;
}
#Box2{
    width:200px;
    height:72px;
    background-color:#F0F;
}
</style>
<SCRIPT type="text/javascript">
var contextPath = '<%=path%>';
var domainid='<%=domainid%>';
    var bmid=window.opener.document.getElementsByName('bmids')[0].id;//根据name获取父文本框id
    var bmids=window.opener.document.getElementById(bmid).value;
//var parentObj = args['parentObj'];
var setting = {
check: {
enable: true
},
data: {
simpleData: {
enable: true
}
},
callback: {
//onCheck:zTreeOnCheck//添加checkbox选择事件
},
async: {
enable: true,
//url : contextPath + '/portal/share/component/dialog/select.jsp',
url:contextPath + "/portal/department/departTree.action?domain=" + domainid + "&datetime=" + new Date().getTime()+"&dpid="+bmids,
autoParam:["id=tid"], 
       contentType:"application/x-www-form-urlencoded",  
type:'post'
}
};


$(document).ready(function(){
$.fn.zTree.init($("#treeDemo"), setting);
});
/* 设置值到目标文本框中 */
function resetTargetValue(){
 var gsid="";//所选公司id
 var gsname="";//所选公司名称
 var bmname="";//所选部门名称
 var bmid="";//所选部门id
       var username = "";//所选人员名称
       var userid="";//所选人员id
     var treeObj = $.fn.zTree.getZTreeObj("treeDemo");
         var nodes = treeObj.getCheckedNodes(true);
         
             for(var i=0;i<nodes.length;i++){
             
              if(nodes[i].type==0){
              if(nodes[i].gsbs=="是"){
              gsname+=nodes[i].name+","; 
              gsid+=nodes[i].id+","; 
              }else{
              bmname+=nodes[i].name+","; 
              bmid+=nodes[i].id+","; 
              }
               }else{
              username+=nodes[i].name+",";
              userid+=nodes[i].id+",";
              }
            }
         var bmids=window.opener.document.getElementsByName('S_department')[0].id;//根据name获取父文本框id
         window.opener.document.getElementById(bmids).value=bmname;//子窗口向父窗口文本框赋值  
         var bmid1=window.opener.document.getElementsByName('bmid')[0].id;//获取部门id文本框的id
         window.opener.document.getElementById(bmid1).value=bmid;//向部门id文本框赋值
         var userid1=window.opener.document.getElementsByName('userid')[0].id;//获取所选人员id文本框的id
         window.opener.document.getElementById(userid1).value=userid;//向所选人员id文本框赋值
         var username1=window.opener.document.getElementsByName('S_name')[0].id;//获取姓名文本框的id
         window.opener.document.getElementById(username1).value=username;//向姓名文本框赋值
         var gsid1=window.opener.document.getElementsByName('gsid')[0].id;//获取公司id文本框的id
     window.opener.document.getElementById(gsid1).value=gsid;//向公司id文本框赋值
     var gsname1=window.opener.document.getElementsByName('S_company')[0].id;//获取所选公司文本框的id
     window.opener.document.getElementById(gsname1).value=gsname;//向所选公司文本框赋值
         window.close();    
       
}
</SCRIPT>
</HEAD>


<BODY>


 <div >
<div id = "treeDemoDiv" name="treeDemoDiv" class="zTreeDemoBackground left">
<ul id="treeDemo" class="ztree" style="margin-top:10px;width: 258px;height:325px"></ul>
</div>
<div style="padding-top:3px">
<button id="doReturn" class="btn btn-info" type="button" οnclick="resetTargetValue()" style="margin-left:100px">确定</button>
</div>
</div>

</div>
</BODY>
</HTML>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值