12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160 |
- <%@page language="java" pageEncoding="UTF-8"%>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>组织机构管理</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <!--框架必需start-->
- <%@include file="../.././../../include.jsp"%>
- <!--引用资源文件,JS CSS-->
- <script type="text/javascript"
- src="<%=path%>/scripts/jquery/plugins/jquery.extension.util.js"></script>
- <script type="text/javascript"
- src="<%=path%>/scripts/freamwork/com/sinosoft/common/common.js"></script>
- <script type="text/javascript"
- src="<%=path%>/scripts/freamwork/com/sinosoft/common/utils/utils.js"></script>
- <script type="text/javascript"
- src="<%=path%>/scripts/freamwork/com/sinosoft/common/frameWork/frameWork.js"></script>
- <script type="text/javascript"
- src="<%=path%>/scripts/freamwork/com/sinosoft/common/utils/Request.js"></script>
- <script type="text/javascript"
- src="<%=path%>/scripts/freamwork/com/sinosoft/common/searchUtil.js"></script>
- <link
- href="<%=path%>/scripts/freamwork/com/sinosoft/common/searchUtil.css"
- rel="stylesheet" type="text/css" />
- <style type = "text/css">
- .tips {
- white-space: nowrap;
- width: 100%;
- overflow: hidden;
- text-overflow: ellipsis;
- dispaly:inline-block;
- }
- .hr3 {
- filter: alpha(opacity = 100, finishopacity = 0, style = 1);
- noshade: "noshade";
- height: 0.5px;
- border: none;
- /* border-top: 2px ridge #45D6D8; */
- border: 1px dotted #45D6D8;
- }
- #queryContent1 {
- position: absolute;
- min-height: 0px;
- max-height: 273px;
- max-width: 100%;
- background-color: #B2E0FF;
- z-index: 12;
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- }
- #queryContent1ul li:hover {
- cursor: pointer;
- background-color:gray;
- }
- </style>
- <script type="text/javascript">
- //图标
- var imgclass = "<%=request.getParameter("imgclass")%>";
- //选项卡界面地址
- var jsonaa = [{"src":"/nwyj/page/business/am/org/query/Org_In.jsp","text":"内部机构"},
- {"src":"/nwyj/page/business/am/org/query/Org_Out.jsp","text":"外部机构"}]
-
- var getParam = "";//点击选项卡需要传递的参数
- var org_type = "<%=request.getParameter("org_type")%>";
- org_type = org_type.split('?')[0];
- //登陆人的机构id
- var loginOrgId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- //登陆人单位name
- var loginOrgName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
- var role = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
- //取得用户真实名字
- var realName = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- var realName_ID = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var realName_phe = top.com.sinosoft.lz.system.user.LoginInfo.getMobile();
- /**************2017-03-17 唐群胜 获取登陆人的单位级别*****************/
- //alert("++++"+realName_ID+realName+realName_phe)
- function getDeptLevel(dpids){
- var dept_level = "";
- $.ajax({
- url : $.pathname()+ "/ws/planService/PlanService/getDeptLevel",
- type : 'post',
- timeout : 60000,
- data : {id:dpids},
- dataType : 'text',
- async: false,
- success : function(data){
- dept_level = data;
- }
- });
- return dept_level;
- }
- //树的初始化
- var setting;
- //定义选项卡
- var tab;
- //新增选项卡的下标
- var tabIndex = 0;
- //设置机构树的对象
- var zTree;
- //设置当前选中的机构节点 ,可以取机构所有信息。是否虚拟机构的字段0虚拟,1实体
- var selectedTreeNode={
- "id":loginOrgId,
- "name":loginOrgName
-
- };
- //定义初始化的根节点
- var rootNode;
- var frheight=$(parent.document.body).find("#frmright");
- $(function(){
-
- /* $("#tab1_index1").live("click",function(){//“机构人员信息”选项卡的点击事件
- //var $tab1 = $("#tab1_index1").children().children().children("td").eq(1).text();//
- var $tab1 = $("#tab1_index1").children().children().children(".tab_item2_mouseover").text();
- if($tab1 == "机构人员信息"){
- //alert($tab1)
- //var isParent = getParam.isParent;//应急指挥中心为true,应急办为false
- //alert("++++++"+isParent)
- parent.avtiveTab('tab1_index1');
- }
-
- });
- $("#tab1_index12").live("click",function(){//“历史人员信息”选项卡的点击事件
- //var $tab2 = $("#tab1_index12").children().children().children("td").eq(1).text();
- var $tab2 = $("#tab1_index12").children().children().children(".tab_item2_mouseover").text();
- if($tab2 == "历史人员信息"){
- //alert($tab2)
- //$("#tab1_index12").update();
- //location.reload();
- }
- }); */
-
- $("#zjjg").hide();
- $("#xgjg").hide();
- $("#scjg").hide();
- $("#shangyi").hide();
- $("#xiayi").hide();
- //判断按钮的显示,只有超级管理员才有权限使用
- var corp_roles = role.split(",");
- for ( var i = 0; i < corp_roles.length; i++) {
- if(corp_roles[i]=="R002105430200"){
- $("#zjjg").show();
- $("#xgjg").show();
- $("#scjg").show();
- $("#shangyi").show();
- $("#xiayi").show();
- }
- }
-
- //tabPosition(jsonaa,imgclass);
- //初始化布局组件
- initLayout();
- //初始化右侧的选项卡
- initTab();
- //树的设置
- setting = {
- view : {
- selectedMulti : false
- },
- edit: {
- enable: true,
- showRemoveBtn: false,
- showRenameBtn: false,
- drag: {
-
- minMoveSize: 5,
-
- prev: true,
- next: true,
- inner: false
- }
- },
- async : {
- enable : true,
- dataType : 'JSON',
- dataName : 'treeNodes',
- aysnc : false,
- url : getAsyncUrl,
- autoParam : [ "id", "name", "orgLevel" ],
- otherParam : ["deptId", loginOrgId,"deptLevel",getDeptLevel(loginOrgId)]
- },
- callback: {
- //响应右键
- //onRightClick: OnRightClick,
- //树的拖拽
- beforeDrag: beforeDrag2,
- beforeDrop: beforeDrop2,
- //鼠标按键松开后的事件回调函数
- onMouseUp: onMouseUp,
-
- onClick: onClick,
- onDrop: onDrop2
-
- }
- };
- //初始化树
- initTree();
-
- //绑定查询框事件
- $("#queryInput1").focus(function (){
- $("#queryInput1").on("keyup", function(event) {
- var e = event||window.event;
- if(e&&e.keyCode<106&&e.keyCode>64||e.keyCode=="13"){
-
-
- }
-
- var getValue = $("#queryInput1").val().trim();
- if(getValue!=""){
- inputTips(getValue);
- }
- });
- })
-
- //绑定点击查询显示框的其他位置隐藏div方法
- $("body:eq(0)").bind("click" ,function (event){
- var e = event || window.event;
- var elem = e.srcElement || e.target;
- var inOrgHOS = $("#queryContent1").is(":hidden");
- if(!inOrgHOS){
- while(elem)
- {
- if(elem.id == "queryContent1")
- {
- return;
- }
- elem = elem.parentNode;
- }
- //隐藏div的方法
- $("#queryContent1").hide();
- }
- });
-
- //鼠标移入右键菜单效果
- $("#rMenu >div").hover(function(){
- $(this).addClass("b-m-ifocus");
- },function(){
- $(this).removeClass("b-m-ifocus");
- });
-
- $searchOne = $("#searchOne");//查询图标绑定查询事件
- $searchOne.bind('click', function() {
- });
-
- });
- //初始化右侧选项卡
- function initTab(){
- //初始化右侧选项卡信息
- tab = new TabView( {
- containerId :'tab_menu',
- pageid :'page',
- cid :'tab1',
- position :"top"
- });
- //设置页签id编号
- tabIndex = tabIndex +1;
- //默认添加机构人员信息的选项卡界面
- tab.add({
- id :'tab1_index'+1,
- title :"应急机构图",
- //url :"/nwyj/page/business/am/org/query/Org_Collection.jsp?statisticId=" + loginOrgId+"&statisticName="+loginOrgName,
- url :"/nwyj/page/business/am/org/query/Org_AllInformation.jsp",
- isClosed :false
- });
- // 拖拽handle width
- $(".l-layout-drophandle-left").get(0).style.width=20 + 'px';
- }
- function changeTabUrl(flag,treeNode){
- var isParent = treeNode.isParent;//应急指挥中心为true,应急办为false
- if(flag){
- closeTab("tab1_index12")
- tab.update({
- id :'tab1_index'+1,
- title :"应急机构图",//treeNode.name+"统计信息",
- //url :"/nwyj/page/business/am/org/query/Org_Collection.jsp?statisticId=" + selectedTreeNode.id+"&statisticName="+selectedTreeNode.name,
- url :"/nwyj/page/business/am/org/query/Org_AllInformation.jsp",
- isClosed :false
- });
- }else{
- tab.update({
- id :'tab1_index1',
- title :"机构人员信息",
- url :"/nwyj/page/business/am/org/query/AllInformation.jsp?isParent="+isParent,
- isClosed :false
- });
-
- if(isParent){//应急指挥中心为
- tab.add({
- id :'tab1_index1'+2,
- title :"历史人员信息",
- url :"/nwyj/page/business/am/org/query/AllInformation_history.jsp?isParent="+isParent,
- isClosed :false
- });
- }else{//应急办
- tab.update({
- id :'tab1_index12',
- title :"历史人员信息",
- url :"/nwyj/page/business/am/org/query/AllInformation_history.jsp?isParent="+isParent,
- isClosed :false
- });
- }
-
- tab.activate("tab1_index1");
- /* var frame = document.getElementById("page_tab1_index1");
- frame.contentWindow.refreshInformation(treeNode,selectedTreeNode.id); */
-
- }
-
- }
- //鼠标按键松开后的事件回调函数 用于返回当前选中的
- function onMouseUp(event, treeId, treeNode){
- return selectedTreeNode = treeNode==null?selectedTreeNode:treeNode;
- }
- //新增成功后 调用新增机构的方法(用于显示树)
- function addNewVirtualOrg(parentNode,addNode,index){
- var newNodes = zTree.addNodes(parentNode,addNode);
-
- //选中新增的节点
- zTree.selectNode(newNodes[0]);
-
- selectedTreeNode = newNodes[0];
- top.Dialog.alert('新增成功');
- //关闭页签
- closeTab('tab1_index'+index);
- //刷新information界面
- var frame = document.getElementById("page_tab1_index1");
- frame.contentWindow.refreshInformation(newNodes[0],newNodes[0].id);
- }
- // 修改成功后 调用修改机构的方法(用于显示树)
- function updateVirtualOrg(newNode,oldNode,index){
- //更新节点的属性
- oldNode.name = newNode.name;
-
- zTree.updateNode(oldNode);
- //选中修改的节点
- zTree.selectNode(oldNode);
- top.Dialog.alert('修改成功');
- //关闭页签
- closeTab('tab1_index'+index);
- //刷新information界面
- var frame = document.getElementById("page_tab1_index1");
- frame.contentWindow.refreshInformation(oldNode,oldNode.id);
- }
- //标记点击的机构是实体机构还是应急机构 true=实体机构 false = 应急机构
- var orgFlag = true;
- //组织机构树的点击事件
- function onClick(event, treeId, treeNode, clickFlag){
- //记录当前点击的机构为实体机构还是应急机构
- var currentFlag = treeNode.isVirtual=="0"?true:false;
- //getParam = treeNode;//20180323
- //changeTabUrl(currentFlag,treeNode);//20180323
- //alert(treeNode.isParent)//true为应急指挥中心;false为应急办
- //alert(currentFlag)
- if(currentFlag == orgFlag && currentFlag==false){
- orgFlag= false
- //如果点击的是应急机构并且和之前点击的一样 那么 调用刷新页面的方法
- tab.activate("tab1_index1");
- var frame = document.getElementById("page_tab1_index1");
- frame.contentWindow.refreshInformation(treeNode,selectedTreeNode.id);
-
- changeTabUrl(currentFlag,treeNode);
-
- }else if(currentFlag == orgFlag && currentFlag==true){
- orgFlag= true;
- //如果点击的是实体机构并且和之前点击的一样 那么 调用刷新页面的方法
- tab.activate("tab1_index1");
- var frame = document.getElementById("page_tab1_index1");
- frame.contentWindow.refreshStatisticInfo(treeNode,selectedTreeNode.id);
-
- }else{
- orgFlag= currentFlag;
- changeTabUrl(currentFlag,treeNode);
-
- }
- /* tab.activate("tab1_index1");
- var frame = document.getElementById("page_tab1_index1");
- frame.contentWindow.refreshInformation(treeNode,selectedTreeNode.id); */
-
- if(treeNode.id!=gtreeId){
- sortNo="";
- sortNo1="";
- }
- /* if(treeNode.id!=gtreeId1){
- sortNo1="";
- } */
-
- }
- //拖拽前的判定 不能拖拽(根节点不能拖拽)返回false
- function beforeDrag2(treeId, treeNodes) {
-
- for (var i = 0, l = treeNodes.length; i < l; i++) {
- if(treeNodes[i].id ==loginOrgId) {
- return false;
- }
- }
- return true;
- }
- //拖拽放下前的判定 只能在同级拖动 (父id相同) 不能放下返回false
- function beforeDrop2(treeId, treeNodes, targetNode, moveType) {
- if(targetNode && targetNode.parentId == treeNodes[0].parentId){
-
- return true;
- }
- return false;
- }
- //拖拽完成后进行后台交互
- function onDrop2(event, treeId, treeNodes, targetNode, moveType, isCopy){
-
- if(targetNode){
- //后台交互
- $.ajax({
- url:$.pathname()+"/ws/InDepartmentService/InDepartmentService/updateSortNo",
- type:"post",
- dataType:"json",
- data:{"dragNodeId":treeNodes[0].id,
- "destNodeSortNo":targetNode.sortNo},
- success:function(data){
- if(data=="1"){
- //更新已变更的sortNo
- var treeObj = $.fn.zTree.getZTreeObj("myTree");
- var node = treeNodes[0];
- node.sortNo = (parseFloat(targetNode.sortNo) + 0.123401)+"";
- treeObj.updateNode(node);
- }
- }
- })
- }
- }
- //加载搜索框的提示信息
- function inputTips(inputValue) {
- var params = {
- "name":inputValue,
- "permissionId":loginOrgId
- }
- //清空ul
- $("#queryContent1").find("ul").empty();
- //查询字段
-
-
-
-
- $.ajax({
- url : $.pathname()
- + '/ws/InDepartmentService/InDepartmentService/queryOrgByName',
- data : params,
- dataType : 'json',
- type : 'post',
- success : function(result) {
- /* if (result.length > 0) {
- $("#queryContent1").show();
- } */
- $("#queryContent1").show();
- $("#queryContent1ul").empty();
- for (var i = 0; i < result.length; i++) {
- var item = result[i];
- if (i < 3) {
- //遍历加载字段
- $("#queryContent1")
- .find("ul")
- .append(
- "<li><div >"
- + item.name
- + "</div><div style='text-align:right;margin : 0px 0px 0px 5px;' title='"+item.path+"'>"
- + item.spath
- + "</div><hr class='hr3'/></li>");
- $("#queryContent1").find("ul").find("li")
- .last().data("id", item.id)
- .on("click", function() {
- findById($(this).data("id"));
- });
- continue;
- }
- if (i == 3) {
- $("#queryContent1")
- .find("ul").append(
- "<li><div id='gengduo'>查看更多</div></li>");
- //设置控件节点高度
- $("#gengduo").css({
- "font-size" : "12px",
- "line-height" : "1.4em",
- "text-align" : "center"
- });
- //绑定点击事件,
- $("#gengduo").on("click", function() {
- $("#gengduo").hide();
- moreOptions(result);
- });
-
- break;
- }
- }
- }
- });
-
-
- //绑定键盘上下键
- $("#queryContent1").on("keyup",function(event){
- var e = event||window.event;
- if(e&&e.keyCode=="40"){
- $("#queryContent1ul").find("li").focus();
- $("#queryContent1ul").find("li").focus(function(event){
- var e = event||window.event;
- if(e&&e.keyCode=="13"){
- findById($(this).data("id"));
- }
-
- });
-
- }
-
- })
-
-
-
- }
- //加载更多搜索选项
- function moreOptions(moreresult) {
- for (var i = 3; i < moreresult.length; i++) {
- var item = moreresult[i];
- $("#queryContent1").find("ul").append(
- "<li><div>" + item.name
- + "</div><div style='text-align:right;margin : 0px 0px 0px 5px;' title='"+item.path+"'>"
- + item.spath
- + "</div><hr class='hr3'/></li>");
- $("#queryContent1").find("ul").find("li").last()
- .data("id", item.id).on("click", function() {
- findById($(this).data("id"));
- });
- }
-
- }
- //根据id精准搜索
- function findById(id) {
- $
- .ajax({
- url : $.pathname()
- + '/ws/InDepartmentService/InDepartmentService/getHigherOrgIds',
- data : {
- 'id' : id,
- 'permissionId':loginOrgId
- },
- type : 'post',
- dataType : 'json',
- success : function(data) {
- doSome(data, id);
- }
- })
- $("#queryContent1").hide();
- }
-
-
- //找到给定id的机构信息
- function doSome(data, mid) {
- var zTree =$.fn.zTree.getZTreeObj("myTree") ;
- //判定是否能直接在前台找到想要搜寻的机构
- if (canFind(mid)) {
- zTree.selectNode(zTree.getNodesByParam("id", mid, null)[0]);
- return;
- }
- //不能搜寻到就找出已经加载的节点信息 然后异步加载树
- isAdd = true;
- for (var i = 0; i < data.length; i++) {
- var treeNodes = zTree.getNodesByParam("id", data[i], null)[0];
- //var p = i - 1;
- if (treeNodes != null) {
-
- var pnode = zTree.getNodesByParam("id", data[i], null)[0];
- targetOrg = mid;
- zTree.reAsyncChildNodes(pnode, "refresh", true);
- break;
- }
- }
- setTimeout(function() {
-
- zTree.selectNode(zTree.getNodesByParam("id", mid, null)[0]);
- }, 300);
- isAdd = false;
- }
- //是否能直接在已加载的机构中找寻到
- function canFind(mid) {
- var treeObj = $.fn.zTree.getZTreeObj("myTree");
- var treeNodes = treeObj.getNodesByParam("id", mid, null)[0];
- return treeNodes != null;
- }
- //初始化树
- function initTree(){
- if(org_type=="yj"){
- $.fn.zTree.init($("#myTree"), setting1);
- }else{
- $.fn.zTree.init($("#myTree"), setting);
- }
- zTree = $.fn.zTree.getZTreeObj("myTree");
- setTimeout(function(){
- //初始化后选中根节点(默认)
- var treeObj = $.fn.zTree.getZTreeObj("myTree");
- selectedTreeNode = treeObj.getNodeByParam("id",loginOrgId,null);
- rootNode = treeObj.getNodeByParam("id",loginOrgId,null);
- },600);
-
- }
- function getSelectTreeNode(){
- var treeObj = $.fn.zTree.getZTreeObj("myTree");
- selectedTreeNode = treeObj.getNodeByParam("id",loginOrgId,null);
- }
- //点击右键处理
- function OnRightClick(event, treeId, treeNode) {
- //在节点之外显示一种菜单
- if (!treeNode && event.target.tagName.toLowerCase() != "button" && $(event.target).parents("a").length == 0) {
- //在节点里面显示另一种菜单
- } else if(treeNode&&treeNode.isVirtual=="0") {
- zTree.selectNode(treeNode);
- showRMenu("entityNode", event.clientX, event.clientY);
- }else if(treeNode&&treeNode.isVirtual=="1"){
-
- zTree.selectNode(treeNode);
- showRMenu("virtualNode", event.clientX, event.clientY);
-
-
- }
- }
-
- //根据设置弹出不同的右键菜单
- function showRMenu(type, x, y) {
- $("#rMenu ul").show();
- if(type == "virtualNode") {//树节点外只保留添加和恢复
- $("#m_add").show();
- $("#m_edit").show();
- $("#m_delete").show();
-
- }else if(type == "entityNode") {//父节点保留添加和删除
- $("#m_add").show();
- $("#m_edit").hide();
- $("#m_delete").hide();
- }
-
- $("#rMenu").css({"top":y+"px", "left":x+"px", "visibility":"visible"});
-
- //点击菜单外时隐藏菜单
- $("body").bind("mousedown", onBodyMouseDown);
- }
-
- //点击菜单项时隐藏菜单
- function hideRMenu() {
- if ($("#rMenu")) $("#rMenu").css({"visibility": "hidden"});
- $("body").unbind("mousedown", onBodyMouseDown);
- }
-
- //点击菜单外时隐藏菜单
- function onBodyMouseDown(event){
- if (!(event.target.id == "rMenu" || $(event.target).parents("#rMenu").length > 0)) {
- $("#rMenu").css({"visibility" : "hidden"});
- }
- }
- //右键的新增 虚拟机构的方法(打开新的界面)
- function addVirtualOrg(){
-
-
- //获得点击的机构节点
- var pNode = selectedTreeNode==null?rootNode:selectedTreeNode;
- //if(pNode.corpId!=undefined){//应急处理,新添加的机构在树没刷新前在树内没有corpId
- var co_id = pNode.corpId;
- if(co_id!=loginOrgId){
- top.Dialog.alert("只能维护本级单位的信息");
- return;
- }
- //}
- var url="Add_VirtualOrg.jsp";
- var name ="新增应急机构【"+pNode.name+"】";
- addTab(url,name);
- hideRMenu();
- };
- //右键修改机构信息学
- function editOrgInfo(){
- //获得点击的机构节点
- var pNode = selectedTreeNode;
-
- var co_id = pNode.corpId;
-
- if(pNode.isVirtual=="0"){
- top.Dialog.alert("只能维护应急机构的信息");
- return;
- }
-
- //if(pNode.corpId!=undefined){
- if(co_id!=loginOrgId){
- top.Dialog.alert("只能维护本级单位的信息");
- return;
- }
- //}
- var url="Update_VirtualOrg.jsp?";
- var name ="修改【"+pNode.name+"】";
- addTab(url,name);
- hideRMenu();
- }
- //右键产出机构信息
- function deleteOrg(){
- top.Dialog.confirm("确定要删除吗?|删除", function() {
- //获得点击的机构节点
- var pNode = selectedTreeNode;
- if(pNode.isVirtual=="0"){
- top.Dialog.alert("只能删除应急机构的信息");
- return;
- }
- //if(pNode.corpId!=undefined){
- var co_id = pNode.corpId;
- if(co_id!=loginOrgId){
- top.Dialog.alert("只能删除本级单位的信息");
- return;
- }
- //}
- hideRMenu();
- $.ajax({
- url:$.pathname() + "/ws/InDepartmentService/InDepartmentService/deleteOrgById",
- data:{
- "id":pNode.id
- },
- dataType :"json",
- type :"post",
- success : function(data){
- //如果删除成功那么在树上删除该节点
- if(data==pNode.id){
- top.Dialog.alert("删除成功");
- zTree.removeNode(pNode);
- //选中根节点
- fNode = zTree.getNodeByParam("id",loginOrgId,null);
- selectedTreeNode = fNode;
- orgFlag = true;
- //getParam = selectedTreeNode;
- changeTabUrl(orgFlag,selectedTreeNode);
- //zTree.getNodeByParam("id",rootNode.id,null);
- //刷新information界面
- /* var frame = document.getElementById("page_tab1_index1");
- frame.contentWindow.refreshInformation(fNode,fNode.id); */
- }else{
-
- top.Dialog.alert("该机构下存在联系人或子机构");
- }
- }
- });
-
- });
- }
- //判定是否为搜索的变量
- var isAdd = false;
- //定义需要搜索的机构id
- var targetOrg;
- // 异步加载树时的请求url变更
- function getAsyncUrl(treeId, treeNode) {
- return isAdd ? $.pathname()
- + "/ws/InDepartmentService/InDepartmentService/newOrgInfoById?targetOrg="
- + targetOrg
- : $.pathname()
- + "/ws/InDepartmentService/InDepartmentService/getOrgInfoById";
- };
- //新增页签的方法
- function addTab(url,name){
- tabIndex = tabIndex +1;
- tab.add( {
- id :'tab1_index'+tabIndex,
- title :name,
- url :url,
- isClosed :true
- });
- return 'tab1_index'+tabIndex;
- }
- //刷新页签的方法
- function updateTab(url,name){
- //tabIndex = tabIndex +1;
- tab.update( {
- id :'tab1_index'+tabIndex,
- title :name,
- url :url,
- isClosed :true
- });
- return 'tab1_index'+tabIndex;
- }
- //关闭页签的方法
- function closeTab(id){
- tab.close(id);
- }
- //切换页签的方法
- function avtiveTab(id){
- tab.activate(id);
- if(id=="tab1_index1"){
- var frame = document.getElementById("page_tab1_index1");
- frame.contentWindow.refreshInformation(selectedTreeNode,selectedTreeNode.id);
-
- }
- }
- // 布局组件初始化
- function initLayout() {
- var layout = $("#layout1").layout({
- leftWidth : 320,
- centerWidth : 760,
- height: 850,
- space:15
- });
- layout.setRightCollapse(true);
- };
- // 重置页面高度
- function resetWindowSize(){
- $(parent.document.body).find("#frmright").height(950);
- $(window).resize(function(){
- $(parent.document.body).find("#frmright").height(950);
- });
- }
- //点击表格双视图,增加页面高度
- function resetWindowSize1200(){
- /* setTimeout(function(){
- $(parent.document.body).find("#frmright").height(1200);
- $(".l-layout-center").get(0).style.height=1200 + 'px';
- },2000) ; */
- $(parent.document.body).find("#frmright").height(1200);
- $(".l-layout-center").get(0).style.height=1200 + 'px';
- $(window).resize(function(){
- $(parent.document.body).find("#frmright").height(1200);
- });
- }
- var sortNo = "";
- var gtreeId = "";
- function moveup(){
- var pNode = selectedTreeNode==null?rootNode:selectedTreeNode;
- if(sortNo==""){
- sortNo = pNode.sortNo;
- }else{
- sortNo = parseInt(sortNo)-1;
- }
- gtreeId = pNode.id;
- $.ajax({
- url:$.pathname() + "/ws/InDepartmentService/InDepartmentService/getMoveUp",
- data:{
- "sortNo": sortNo,
- "id":pNode.id,
- "parent_id":pNode.parentId
- },
- dataType :"json",
- type :"post",
- success : function(data){
- if(data==pNode.id){
- $.fn.zTree.init($("#myTree"), setting);
- setTimeout(function(){
- zTree.selectNode(zTree.getNodesByParam("id", data, null)[0]);
- },200);
- }else{
- top.Dialog.alert("该机构没有排序字段");
- }
- }
- });
-
- }
- var sortNo1 = "";
- function movedown(){
- var pNode = selectedTreeNode==null?rootNode:selectedTreeNode;
- if(sortNo1==""){
- sortNo1 = pNode.sortNo;
- }else{
- sortNo1 = parseInt(sortNo1)+1;
- }
- gtreeId = pNode.id;
- $.ajax({
- url:$.pathname() + "/ws/InDepartmentService/InDepartmentService/getMoveDowndown",
- data:{
- "sortNo": sortNo1,
- "id":pNode.id,
- "parent_id":pNode.parentId
- },
- dataType :"json",
- type :"post",
- success : function(data){
- if(data==pNode.id){
- $.fn.zTree.init($("#myTree"), setting);
- setTimeout(function(){
- zTree.selectNode(zTree.getNodesByParam("id", data, null)[0]);
- },600);
- }else{
- top.Dialog.alert("该机构没有排序字段");
- }
- }
- });
-
- }
- var setting1 = {
- view : {
- selectedMulti : false
- },
- edit: {
- enable: true,
- showRemoveBtn: false,
- showRenameBtn: false,
- drag: {
- minMoveSize: 5,
- prev: true,
- next: true,
- inner: false
- }
- },
- async : {
- enable : true,
- dataType : 'JSON',
- dataName : 'treeNodes',
- aysnc : false,
- url : $.pathname() + "/ws/InDepartmentService/InDepartmentService/getOnlyOrgInfoById",
- autoParam : [ "id", "name", "orgLevel" ],
- otherParam : ["deptId", loginOrgId,"deptLevel",getDeptLevel(loginOrgId)]
- },
- callback: {
- //响应右键
- //onRightClick: OnRightClick,
- //树的拖拽
- beforeDrag: beforeDrag2,
- beforeDrop: beforeDrop2,
- //鼠标按键松开后的事件回调函数
- onMouseUp: onMouseUp,
- onClick: onClick,
- onDrop: onDrop2
- }
- };
-
-
- function qiehuan1(){
- $.fn.zTree.init($("#myTree"), setting1);
- }
- function qiehuan2(){
- $.fn.zTree.init($("#myTree"), setting);
- }
- </script>
- </head>
- <body>
- <div class="b-m-mpanel" style="width: 150px;visibility:hidden;" id="rMenu">
- <div class="b-m-item" id="m_add" onclick="addVirtualOrg();">
- <img align="middle" src="<%=path%>/scripts/qui/libs/icons/add.png"/><span>增加应急机构</span>
- </div>
- <div class="b-m-item" id="m_edit" onclick="editOrgInfo();">
- <img align="middle" src="<%=path%>/scripts/qui/libs/icons/edit.png"/><span>修改机构</span>
- </div>
- <div class="b-m-item" id="m_delete" onclick="deleteOrg();">
- <img align="middle" src="<%=path%>/scripts/qui/libs/icons/delete.png"/><span>删除机构</span>
- </div>
- </div>
- <div style="margin: 10px 0px 0px 0px">
- <div id="layout1" >
- <div position="left" >
- <div class="layout_content">
- <div name="组织结构" id="myBox1" >
- <fieldset style="max-height:690px;overflow : auto;border-color: #cdcaca;border-top: 1px;border-left: 1px;border-right: 1px">
- <table cellspacing="0">
- <tr>
- <td colspan="2"><span style="font-size: 14px;fontfont-family: 微软雅黑微软雅黑微软雅黑微软雅黑微软雅黑;font-weight: bold;">组织结构</span></td>
- </tr>
- <tr>
- <td><input type="text" id="queryInput1"
- maxlength="15" watermark="请输入单位名称查询"
- style="width:245px;margin:4px 0px 0px 0px;display:'';">
- <div id="queryContent1"
- style="width:245px; overflow : auto;display:none;">
- <ul id="queryContent1ul"></ul>
- </div>
- </td>
- <td><a id="searchOne"><img src="/nwyj/scripts/qui/libs/icons/toolbar_icons/zzjg_find.png" alt="" style="height: 29px;padding: 3px 0px 0px 0px"/></a></td>
- </tr>
- </table>
- <table>
- <tr>
- <td>
- <input type="button" id="zjjg" onclick="addVirtualOrg()" value="增加机构" style="color: white;background-color: #009999"/>
- <input type="button" id="xgjg" onclick="editOrgInfo()" value="修改机构" style="color: white;background-color: #5bba3c"/>
- <input type="button" id="scjg" onclick="deleteOrg()" value="删除机构" style="color: white;background-color: #f65050"/></br>
- <input type="button" id="shangyi" onclick="moveup()" value="上移机构" style="color: white;background-color: #679cbb"/>
- <input type="button" id="xiayi" onclick="movedown()" value="下移机构" style="color: white;background-color: #679cbb"/>
- <!-- <input type="button" id="qiehuan1" onclick="qiehuan1()" value="应急机构" style="color: white;background-color: #679cbb"/>
- <input type="button" id="qiehuan2" onclick="qiehuan2()" value="实体机构" style="color: white;background-color: #679cbb"/> -->
- </td>
- </tr>
- </table>
- </fieldset>
-
- <div style="overflow:auto;height:95%;border-color: #cdcaca;margin-top: 15px">
- <div style="max-height:450px;overflow : auto;">
- <ul id="myTree" class="ztree"></ul>
- </div>
- </div>
-
- </div>
- </div>
- <!-- /***************************图例**************************/ -->
- <div>
- <fieldset style="background-color:#f4f4f4;max-height:990px;overflow : auto;border-style:solid;border-width:0px;border-color: #cdcaca;margin: 20px 20px 0px 20px">
- <table>
- <tr>
- <td><span style="font-size:14px;font-family:微软雅黑;font-weight: bold;color:#424242">图例:</span> <img src="/nwyj/scripts/qui/libs/icons/home.gif" /> 应急机构 <img src="/nwyj/scripts/qui/libs/icons/home.png" /> 实体机构 </td>
- </tr>
- <tr>
- <td><span style="font-size:14px;font-family:微软雅黑;font-weight: bold;color:#424242">同步数据时间:</span><span style="font-size:12px;font-family:微软雅黑;color:#54994a">2016-07-21 15:08:31</span></td>
- </tr>
-
- </table>
- </fieldset>
- </div>
- </div>
-
- <div position="center">
- <div id="tab_menu"></div>
- <div id="page"
- style="height:800px"></div>
- </div>
- <!-- /***************************图例**************************/ -->
- <!-- <div>
- <div style="height:100px;width:300px;border:2px solid red;position:absolute;bottom:0px; z-index:9;">
- <fieldset style="background-color:#EDEDED;max-height:990px;overflow : auto;">
- <table>
- <tr>
- <td>图例:<img class="back" align="left" src="/nwyj/images/temp/yingji.png" /> 应急机构<img class="back" align="left" src="/nwyj/images/temp/shiti.png" />实体机构</td>
- <td></td>
- </tr>
- 放图例用
-
- </table>
- </fieldset>
- </div> -->
- </div>
- </div>
- </body>
- </html>
|