busshow.js var busdatashow = { rootJson : [], tree : null, deptId : "deptleftTree", deptPanelId : "ucap_deptTree", columnId : "_dept_column", columnWidth : 150, initdata : function() { var buttonItems=[ {text: '重命名',handler:function(){onDeptItemClick("rename")}},'-', {text: '删除部门',handler: function(){onDeptItemClick("delete")}} ]; var toolbar=[ {text: '文件',menu :{items: [{text: '新建部门',handler:function(){onDeptItemClick("new")} }]}}, {text: '编辑', menu :{items: buttonItems}}, {text: '查看',menu :{items: [{text: '展开',id:"deptExpand", handler: onDeptItemClick}, {text: '折叠',id:"deptCollapse", handler: onDeptItemClick}, {text: '全部展开',id:"deptExpandAll", handler: onDeptItemClick}, {text: '全部折叠',id:"deptCollapseAll", handler: onDeptItemClick} ]}}, '-', {text: '关闭',handler: function(){onDeptItemClick("delete")}} ]; var height = ucapSession.middleHeight; if (height < 300) height=500; //var toolbar = []; var height = ucapSession.middleHeight; if (height < 300) height = 700; var panel = new Ext.Panel({ id : "ucap_deptTree", applyTo : "deptTree", plain : true, layout : 'border', height : height, tbar : toolbar, autoWidth : true, items : [{ title : "区划树", id : this.columnId, region : 'west', html : '<div id="' + this.deptId + '">正在加载树信息,请稍候......</div>', width : this.columnWidth, autoScroll : true, collapsible : true, height : height, split : true }, { region : "center", contentEl : "deptHtml", autoWidth : true, buttonAlign : "right" }] }); ucapCommonFun.autoMenuHeight(); var belongToAppId = typeof(ucapManagerTree) != "undefined" ? ucapManagerTree.curBelongToAppId : false; busdatashow.createTree(""); }, createTree : function() { if ($(this.deptId)) $(this.deptId).innerHTML = ""; var root=new Ext.tree.AsyncTreeNode({ id : "root", expanded : true, text:'福建省', children:[ { expanded : true, text:'党委系统', leaf:false, children:[ { text:'事业单位', leaf:false, children:[{ text:'福建省发展战略研究会', leaf:false, children:[{ text:'内设机构', leaf:true },{ text:'事业单位', leaf:true }] } ] } ] },{ expanded : true, text:'政府系统', leaf:false, children:[{ text:'事业单位', leaf:true } ] },{ expanded : true, text:'人大系统', leaf:false, children:[{ text:'事业单位', leaf:true } ] },{ expanded : true, text:'政协系统', leaf:false, children:[{ text:'事业单位', leaf:true } ] },{ expanded : true, text:'民主党派系统', leaf:false, children:[{ text:'事业单位', leaf:true } ] },{ expanded : true, text:'福州市', leaf:false, children:[{ text:'党委系统', leaf:true },{ text:'鼓楼区', leaf:true } ] },{ expanded : true, text:'厦门市', leaf:false, children:[{ text:'党委系统', leaf:true },{ text:'思明区', leaf:true } ] } ] }); var tree = new Ext.tree.TreePanel({ renderTo : this.deptId, root : root, animate : true, rootVisible : true, autoScroll : true, containerScroll : true, loader:new Ext.tree.TreeLoader(), autoHeight:true }); //this.tree = tree; tree.setRootNode(root); root.select(); busdatashow.setUserDeptRank(root); //busdatashow.setIndex(root); tree.on("click", function(node) { busdatashow.setUserDeptRank(node); }); tree.on('contextmenu', menuShow); function menuShow(node) { node.select(); treeRightMenu.show(node.ui.getAnchor()); }; var treeRightMenu = new Ext.menu.Menu({ id : 'treeMenuContext', items : [ { text : '【新增单位】', icon : "", handler : function() { onDeptItemClick("new"); } },{ text : '【删除单位】', icon : "", handler : function() { onDeptItemClick("delete"); } },{ text : '【单位重命名】', icon : "", handler : function() { onDeptItemClick("rename"); } },{ text : '【机构变更】', icon : "", handler : function() { onDeptItemClick("bg"); } },{ text : '【机构撤销】', icon : "", handler : function() { onDeptItemClick("cx"); } },{ text : '【机构合并】', icon : "", handler : function() { onDeptItemClick("hb"); } },{ text : '【机构划转】', icon : "", handler : function() { alert(111); } },{ text : '【机构转制】', icon : "", handler : function() { alert(111); } },{ text : '【机构分设】', icon : "", handler : function() { alert(111); } } ] }); }, setUserDeptRank : function(node) { var nodeName = node.text; var viewId = "E11A985A2FEFDBD65EAC053153557BE2"; var divUrl = "&div=1"; //用div弹出及在iframe中打开文档不要头部及底部 //alert(nodeName); if(nodeName=="福建省发展战略研究会"){ //alert(1); document.getElementById("userview1").style.display = "none"; var url = appPath + "sys/jsp/document.jsp?unid=&type=03&formId=7405CD2733B92BBDD2FAB7C8433A2648&viewMId=E11A985A2FEFDBD65EAC053153557BE2&openST="; url+=divUrl; //ucapCommonFun.ucapOpenDoc(url,0,"1"); //document.getElementsByName("orgfr")[0].src = url; Ext.getDom("orgfr").src = url; }else{ //alert(2); document.getElementById("userview1").style.display = ""; initView(viewId,"userview1","","","","",0); } }, setIndex : function(node) { var url = appPath + "sys/jsp/user/jgdw/orgindex.jsp"; document.getElementsByName("orgfr")[0].src = url; }, /** * 弹出窗口进行单位的新建或保存 */ newEditDept:function(id){ var idtype = id; var title = "新建单位"; var html = ""; /*if (typeof unid == "undefined" || unid==this.newRootId){ title = "新建部门"; unid=""; this.isNewFlag = true; } else { title = "编辑部门"; }*/ if(idtype == "new"){ html="sys/jsp/user/jgdw/org.jsp"; }else if(idtype == "bg"){ html="sys/jsp/user/jgdw/orgbg.jsp"; }else if(idtype == "cx"){ html="sys/jsp/user/jgdw/orgcx.jsp"; }else if(idtype == "hb"){ html="sys/jsp/user/jgdw/orghb.jsp"; }else if(idtype == "delete"){ html="sys/jsp/user/jgdw/orgdelete.jsp"; } var button=[ {text:"录入台账", handler:function(){ var url = appPath+"sys/jsp/document.jsp?unid=&type=01&formId=3F0E3B01398449D4DF828AF1D86F23A4&viewMId=5B2637CAE4DD4B908E189CB491B5C3EA&openST=&viewMId=850B164D6BB5888BCF8782D278593672&openST=&fformUnid=6565EF4A47B6BD8CB38664FD88E2C7A3&funid=8D4CF50817D14BB999DDD0F00F70ABEC&"; window.open(url); }}, {text:"保存", handler:function(){}}, {text:"取消", handler:function(){orgshow.editDeptWin.close()}} ]; this.editDeptWin = new Ext.Window({ title:ucapSession.win.winImg+title, width:500, closable:true, //关闭 modal: true, height:200, bodyStyle:ucapSession.win.winBodyStyle, autoLoad:{url:ucapSession.appPath+html,scripts:true,nocache: true}, buttons:button }); this.editDeptWin.show(); } } var onDeptItemClick=function(btn){ var id = btn.id || btn; switch (id) { case "new":{ busdatashow.newEditDept(id); break; } case "newWin":{ window.open(window.location,"_blank"); break; } case "bg":{ busdatashow.newEditDept(id); break; } case "cx":{ busdatashow.newEditDept(id); break; } case "hb":{ busdatashow.newEditDept(id); break; } case "delete":{ //Ext.Msg.confirm("删除提示","您确认要删除"); busdatashow.newEditDept(id); break; } case "deptExpandAll": ucapDept.getSelectNode().expand(true); break; case "deptExpand": ucapDept.getSelectNode().expand(); break; case "deptCollapseAll": ucapDept.getSelectNode().collapse(true); break; case "deptCollapse": ucapDept.getSelectNode().collapse(); break; case "rename": Ext.Msg.prompt("改名对话框","请输入新的名称:",function(id,msg){ if (id=="ok"){ if (msg==""){ Ext.Msg.alert("改名提示","单位名称不能为空!"); return; } ucapDept.renameValue = msg; ucapDept.saveDept(msg); } },this); break; default : alert(btn.id+"功能未实现!"); } } busdatashow.jsp <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <%@include file="/sys/jsp/session.jsp"%> <body> <div id="deptTreeHtml"> <mce:script type="text/javascript"><!-- Ext.onReady(function(){ busdatashow.initdata(); }); // --></mce:script> <div id="deptTree"></div> <div id="deptHtml"> <div id="userview1"></div> <div id="userview"> <iframe id="orgfr" height="100%" width="100%" src="" > </iframe> </div> </div> </div> </body>