2018-06-03 22:26:41 +08:00

130 lines
4.0 KiB
Plaintext

<%@page import="com.amarsoft.are.util.json.JSONEncoder"%>
<%@ page language="java" contentType="text/html; charset=GBK"%>
<%@ include file="/Frame/resources/include/include_begin.jspf"%>
<%@ page import="com.tenwa.flow.util.SelectUser" %>
<script type="text/javascript" src="<%=sWebRootPath%>/Frame/page/js/widget/htmltree.js"></script>
<%
String pid="8" ;
String curOrgId="";
if(CurUser.hasRole("299")){
curOrgId=session.getAttribute("managerPlatFormOrgId").toString();
}else{
curOrgId=CurUser.getOrgID();
}
if(curOrgId.length()>13){
curOrgId=curOrgId.substring(0,13);
}
curOrgId=curOrgId.substring(0,curOrgId.length()-4);
pid=curOrgId;
String selectType=CurPage.getParameter("selectType");
String flowno=CurPage.getParameter("flowno");
ObjectTree tree = new ObjectTree("多选参半案例");
SelectUser selectUser=new SelectUser(pid,Sqlca,"","",CurUser,selectType,flowno);
selectUser.initTreeNode(tree);
System.out.println("==ObjectTree的JSON结构=============================================");
System.out.println(JSONEncoder.encode(tree));
System.out.println("===============================================");
%>
<body>
<table style="width:100%">
<tr>
<td><div id="test" style="width:400px;height:420px;overflow:auto;"></div></td>
<td><div style="width:40px;display:inline;">
<%out.print(new Button("选择", "", "showChecked()").getHtmlText());%><br>
</div>
</td>
<td>
<select name='selectInfo' id="id_selectInfo" size='10' style='width:300px;height:420px;' multiple>
</select>
</td>
</tr>
<tr>
<td width="30%" align="right">
<%=new Button("&nbsp;确&nbsp;定&nbsp;","确定","getSelectData()","","").getHtmlText()%>
</td>
<td width="40%" align="center">
<%=new Button("&nbsp;返&nbsp;回&nbsp;","返回"," parent.AsDialog.ClosePage()","","").getHtmlText()%>
</td>
<td width="30%" align="left">
</td>
</tr>
</table>
<div>
</div>
</body>
<script type="text/javascript">
var tree = new HtmlTree(document.getElementById("test"), <%=JSONEncoder.encode(tree)%>);
tree.initDefQuickKeys();
tree.nearCss("<style>.htmltreesearch {top:5px;left:480px;right:auto;bottom:auto;}</style>");
tree.expand(true);
function showChecked(){
var nodes = tree.getRoot().getChecked(false);
var cflag=true;
var sSelectType="<%=selectType%>";
var options=$("#id_selectInfo option");
if(nodes.length==0){alert("请选择左边的树");return false;}
for(var i = 0; i < nodes.length; i++){
cflag=true;
if(options.length>0){
for(var j=0;j<options.length;j++){
if(nodes[i].getAttribute("id")==options[j].value){
cflag=false;
}
}
}
if(cflag){
if(sSelectType=="指定人员"){
if(nodes[i].getAttribute("id").indexOf("U")>0){
$("#id_selectInfo").append("<option value='"+nodes[i].getAttribute("id")+"'>"+nodes[i].getText()+"</option>");
}}
else{
$("#id_selectInfo").append("<option value='"+nodes[i].getAttribute("id")+"'>"+nodes[i].getText()+"</option>");
}
}
}
}
function initSelectData(){
var selectData="<%=CurPage.getParameter("selectParam")%>";
var vData=selectData.split(",");
var options=$("#id_selectInfo option");
var cflag=true;
for(var i=0;i<vData.length-1;i=i+2){
cflag=true;
if(options.length>0){
for(var j=0;j<options.length;j=j+2){
if(vData[i]==options[j].value){
cflag=false;
}
}
}
if(cflag){
$("#id_selectInfo").append("<option value='"+vData[i]+"'>"+vData[i+1]+"</option>");
}
}
}
$(function(){ initSelectData()});
function getSelectData(){
var cdate=[];
var options=$("#id_selectInfo option")
if(options.length==0){
alert("请选择人员");
}else{
for(var i=0;i<options.length;i++){
cdate.push(options[i].value);
cdate.push(options[i].text);
}
parent.AsDialog.ClosePage(cdate.join(","));
}
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>