87,910
社区成员
发帖
与我相关
我的任务
分享
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<%@include file="/public/head.jspf"%>
<script type="text/javascript">
$(function(){
InitTreeData();
}) ;
function InitTreeData()
{
$('#tree').tree({
url:'<%=basePath%>trustlist.action',
checkbox:true,
parentField:'parentId',
lines:true,
animate:true,
onClick:function(node){
update();
},
onContextMenu: function(e, node){
e.preventDefault();
$('#tree').tree('select', node.target);
$('#mm').menu('show', {
left: e.pageX,
top: e.pageY
});
}
});
}
function remove()
{
var nodes = $('#tree').tree('getChecked');
var ids = '';
for(var i=0; i<nodes.length; i++){
if (ids != '') ids += ',';
ids += nodes[i].id;
//$('#tree').tree('remove',nodes[i].target);
}
$.post("demo01.ashx",{"ids":ids,"type":"del"},function(data){
InitTreeData();
});
}
function update()
{
var node = $('#tree').tree('getSelected');
if (node){
$('#p').panel({
title:'组织结构修改',
href:'<%=basePath %>getDeptByID.action?id='+node.id,
fit:true
});
}
}
function append()
{
var node = $('#tree').tree('getSelected');
$('#tree').tree('append',{
parent: (node?node.target:null),
data:
[
{
text:'new1',// -->txt-->DB
id:'1',
checked:true
}
]
});
}
</script>
</head>
<body class="easyui-layout">
<div id="mm" class="easyui-menu" style="width: 120px;">
<div onclick="append()" iconcls="icon-add">
添加节点</div>
<div onclick="remove()" iconcls="icon-remove">
删除节点</div>
<div onclick="update()" iconcls="icon-edit">修改节点</div>
</div>
<div data-options="region:'center',border:false" >
<div id="p">
</div>
</div>
<div data-options="region:'west',border:false,split:true" style="width:200px;overflow: hidden; ">
<div class="easyui-panel" title="组织机构"
style="padding:10px;"
data-options="fit:true,border:false">
<ul id="tree">
</ul>
<br/>
<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-add'">添加机构</a>
</div>
</div>
</body>
</html>