123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836 |
- //部门id
- var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- // 取得用户真实姓名
- var realname = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
- // 获取用户的Id
- var userId = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- // 部门名称
- var deptName = top.com.sinosoft.lz.system.user.LoginInfo.getDeptnames();
- // 父部门id
- var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
- // 部门Id
- var sup_userInfo_deptId = top.com.sinosoft.lz.system.user.LoginInfo
- .getDeptids();
- var sup_roleIds = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
- //判定是否为超级管理员
- var isSuperAdmin = false;
- //alert(sup_roleIds);
- var setting, setting2;
- var sup_classId = "";
- var sup_org_name = "";
- var sup_fd_objectId = "";
- var inParentNote = "";
- var sup_org_isVirtual = "";
- var inTreeNode = "";
- var sup_orgType ="";
- function ArrContains(arr, obj) {
- var i = arr.length;
- while (i--) {
- if (arr[i] == obj) {
- return true;
- }
- }
- return false;
- }
- // 初始化函数
- function initComplete() {
- //处理登录用户权限
- //var role = sup_roleIds.spilt(",");
- isSuperAdmin = sup_roleIds.indexOf("R002105430200")>-1;
-
-
- //isSuperAdmin = sup_roleIds=="R002105430200";
-
- // 内部组织机构setting信息
- setting = {
- view : {
- // 鼠标移入的事件
- addHoverDom : addHoverDom,
- // 鼠标移走的事件
- removeHoverDom : removeHoverDom,
- selectedMulti : false
- },
- async : {
- enable : true,
- dataType : 'JSON',
- dataName : 'treeNodes',
- url : $.pathname()
- + "/ws/orgInDeptService/OrgInDeptService/getDeptRootById",
- autoParam : [ "id", "name" ],
- otherParam : [ "deptId", sup_userInfo_deptId ]
- },
- edit : {
- enable : true,
- // renameTitle : "修改内部机构",
- removeTitle : "删除内部机构",
- // 显示删除按钮
- showRemoveBtn : setRemoveBtn,
- // 显示编辑按钮
- showRenameBtn : setRenameBtn
- },
- data : {
- simpleData : {
- enable : true
- }
- },
- callback : {
- onClick : nodeClick,
- // 不允许拖拽--内部机构
- beforeDrag : beforeDrag,
- // 修改前确认--内部机构
- // beforeEditName: beforeEditName,
- // 修改完时的处理--内部机构
- // beforeRename: beforeRename,
- // 修改成功后处理--内部机构
- // onRename: onRename,
- // 删除前确认--内部机构
- beforeRemove : beforeRemove
- }
- };
- // 外部组织机构树的setting信息
- setting2 = {
- view : {
- addHoverDom : addHoverDom2,
- removeHoverDom : removeHoverDom2,
- selectedMulti : false
- },
- edit : {
- enable : true,
- // renameTitle:"修改外部机构",
- removeTitle : "删除外部机构",
- // 显示编辑按钮
- showRenameBtn : setRenameBtn2,
- // 显示删除按钮
- showRemoveBtn : setRemoveBtn2
- },
- callback : {
- // 不允许拖拽--外部机构
- beforeDrag : beforeDrag,
- // 修改前确认--外部机构
- // beforeEditName: beforeEditName2,
- // 修改完时的处理--外部机构
- // beforeRename: beforeRename2,
- // 修改成功后处理--外部机构
- // onRename: onRename2,
- // 删除前确认--外部机构
- beforeRemove : beforeRemove2,
- onClick : out_nodeClick
- }
- };
- initTree();
- initLayout();
- initTree2(sup_userInfo_deptId);
- }
- // 鼠标移入树节点的操作--内部组织机构
- function addHoverDom(treeId, treeNode) {
- if (treeNode.editNameFlag || $("#addInBtn_" + treeNode.id).length > 0
- || $("#viewInBtn_" + treeNode.id).length > 0
- || $("#editInBtn_" + treeNode.id).length > 0) {
- return;
- }
- ;
- var sObj = $("#" + treeNode.tId + "_span");
- // 新增按钮
- var addStr = "<span class='zbutton add' id='addInBtn_" + treeNode.id
- + "' title='添加虚拟机构' onfocus='this.blur();'></span>";
- // 查看详情按钮
- var detailStr = "<span class='zbutton ico_docu' id='viewInBtn_"
- + treeNode.id + "' title='查看虚拟机构' onfocus='this.blur();'></span>";
- // 修改按钮
- var editInStr = "<span class='zbutton edit' id='editInBtn_" + treeNode.id
- + "' title='修改虚拟机构' onfocus='this.blur();'></span>";
-
- if(isSuperAdmin){
-
- sObj.append(addStr);
-
- };
- if(isSuperAdmin){
- if (treeNode.isV == "1") {
- sObj.append(editInStr);
- };
- };
- sObj.append(detailStr);
- var addBtn = $("#addInBtn_" + treeNode.id);
- var editBtn = $("#editInBtn_" + treeNode.id);
- var viewBtn = $("#viewInBtn_" + treeNode.id);
- // 绑定新增按钮
- if (addBtn) {
- addBtn.bind("click", function() {
- addVirtualOrg(treeNode);
- });
- }
- // 绑定查看详情按钮
- if (viewBtn) {
- // 点击查看详情界面
- viewVirtualOrg(treeNode);
- }
- // 绑定修改按钮
- if (editBtn) {
- editBtn.bind("click", function() {
- top.Dialog.confirm("确认修改" + treeNode.name + "信息吗?", function() {
- editInOrg(treeNode);
- });
- });
- }
- };
- // 查看虚拟机构详情--内部虚拟机构
- function viewVirtualOrg(treeNode) {
- var viewBtn = $("#viewInBtn_" + treeNode.id);
- viewBtn.bind("click", function() {
- // alert("调用查看详情界面");
- // 判定iframe选项卡的情况-->跳转界面
- // 判定当前的iframe选项卡的序号如果为人员切换tab,如果为组织机构不切换tab
- var selectedTabIndex = getTabValue();
- if (selectedTabIndex == 0) {
- changeUrl("in-org-info.html" );
- } else if (selectedTabIndex == 1) {
- changeIdxHandler();
- changeUrl("in-org-info.html");
- }
- });
- }
- // 修改内部机构
- function editInOrg(treeNode) {
- var selectedTabIndex = getTabValue();
- if (selectedTabIndex == 0) {
- // alert("跳转到modify+?");
- changeUrl("in-org-modify.html?type=edit?fd_id=" + treeNode.id);
- } else if (selectedTabIndex == 1) {
- changeIdxHandler();
- // alert("跳转到modify+?");
- changeUrl("in-org-modify.html?type=edit?fd_id=" + treeNode.id);
- }
- }
- // 新增虚拟机构按钮事件--内部机构
- function addVirtualOrg(treeNode) {
-
-
- top.Dialog.confirm("确认在" + treeNode.name + "下增加机构吗?", function() {
- var selectedTabIndex = getTabValue();
- if (selectedTabIndex == 0) {
- // 跳转到新增外部组织机构界面
- changeUrl("in-org-modify.html?type=add?fd_id=" + treeNode.id);
-
- } else if (selectedTabIndex == 1) {
- // 切换选项卡
- changeIdxHandler();
- // 跳转到新增外部组织机构界面
- changeUrl("in-org-modify.html?type=add?fd_id=" + treeNode.id);
- }
-
-
- });
-
- }
- // 鼠标移入节点时,调用的事件--外部机构
- function addHoverDom2(treeId, treeNode) {
- if (treeNode.editNameFlag || $("#addoutBtn_" + treeNode.id).length > 0
- || $("#viewOutBtn_" + treeNode.id).length > 0
- || $("#editOutBtn_" + treeNode.id).length > 0) {
- return;
- }
- var sObj = $("#" + treeNode.tId + "_span");
- // 查看详情按钮
- var detailStr = "<span class='zbutton ico_docu' id='viewOutBtn_"
- + treeNode.id + "' title='查看外部机构' onfocus='this.blur();'></span>";
- // 给根子部门添加查看详情按钮
- if (!treeNode.isParent || treeNode.id != sup_userInfo_deptId) {
- sObj.append(detailStr);
- }
- // 新增按钮
- var addStr = "<span class='zbutton add' id='addoutBtn_" + treeNode.id
- + "' title='添加外部机构' onfocus='this.blur();'></span>";
- // 给根部门添加新增按钮
- if(isSuperAdmin){
- if (treeNode.isParent || treeNode.id == sup_userInfo_deptId) {
- sObj.append(addStr);
- }
-
- };
- // 修改按钮
- var editStr = "<span class='zbutton edit' id='editOutBtn_" + treeNode.id
- + "' title='修改外部机构' onfocus='this.blur();'></span>";
- // 给部门添加修改按钮
- if(isSuperAdmin){
- if (!treeNode.isParent || treeNode.id != sup_userInfo_deptId) {
- sObj.append(editStr);
- }
-
- };
- var addBtn = $("#addoutBtn_" + treeNode.id);
- var viewBtn = $("#viewOutBtn_" + treeNode.id);
- var editBtn = $("#editOutBtn_" + treeNode.id);
- // 绑定新增事件
- if (addBtn) {
- addBtn.bind("click", function() {
- top.Dialog.confirm("确认在" + treeNode.name + "下增加机构吗?", function() {
- addOutOrg(treeNode);
- });
- });
- // 绑定修改事件
- if (editBtn) {
- editBtn.bind("click", function() {
- top.Dialog.confirm("确认修改" + treeNode.name + "信息吗?", function() {
- editOutOrg(treeNode);
- });
- });
- }
- if (viewBtn) {
- // 点击查看详情界面
- viewOutOrg(treeNode);
- }
- };
- }
- // 鼠标移出节点事件--内部机构
- function removeHoverDom(treeId, treeNode) {
- $("#addInBtn_" + treeNode.id).unbind().remove();
- $("#viewInBtn_" + treeNode.id).unbind().remove();
- $("#editInBtn_" + treeNode.id).unbind().remove();
- };
- // 鼠标移出节点事件--外部机构
- function removeHoverDom2(treeId, treeNode) {
- $("#addoutBtn_" + treeNode.id).unbind().remove();
- $("#viewOutBtn_" + treeNode.id).unbind().remove();
- $("#editOutBtn_" + treeNode.id).unbind().remove();
- // $("#detailoutBtn_" + treeNode.id).unbind().remove();
- };
- // 单击组织机构树事件--内部机构树
- function nodeClick(event, treeId, treeNode) {
- /*sup_classId = treeNode.classId;
- sup_org_name = treeNode.name;
- sup_fd_objectId = treeNode.objectId;
- inParentNote = treeNode.getParentNode() == null ? "" : treeNode
- .getParentNode();
- inTreeNode = treeNode;
- sup_org_isVirtual = treeNode.isV;*/
- // 封装的切换界面 inChangeIframeByClick()
- inChangeIframeByClick(treeNode);
- }
- // 单击树事件-外部机构
- function out_nodeClick(event, treeId, treeNode) {
- if(treeNode.id!=sup_userInfo_deptId){
- /*
- sup_classId = treeNode.classId;
- sup_org_name = treeNode.name;
- sup_fd_objectId = treeNode.objectId;
- sup_orgType= treeNode.orgType;
- */
-
- // 封装的切换界面 outChangeIframeByClick()
- outChangeIframeByClick(treeNode);
- }
- }
- // 封装点击内部机构切换iframe--内部机构
- function inChangeIframeByClick(treeNode) {
-
- sup_classId = treeNode.classId;
- sup_org_name = treeNode.name;
- sup_fd_objectId = treeNode.objectId;
- inParentNote = treeNode.getParentNode() == null ? "" : treeNode
- .getParentNode();
- inTreeNode = treeNode;
- sup_org_isVirtual = treeNode.isV;
-
-
- /*
- * 先判定左边的iframe框是哪个部分 人员|机构 然后跳转界面
- */
- if (getTabValue() == 0) {
- // 在机构中,系查看机构信息
- // 如果是外部机构那么先跳转到内部机构
- var isInOrgInfo = false;
- var isOutOrgInfo = false;
- var iUrl = document.getElementsByName("frmrightChild")[0]
- .getAttribute("src");
- // 判定在内部和外部
- if (iUrl == "in-org-info.html") {
- // alert("判定在内部人员列表");
- isInOrgInfo = true;
- } else if (iUrl == "out-org-info.html") {
- // alert("判定在外部人员列表");
- isOutOrgInfo = true;
- }
- if (isOutOrgInfo) {
- changeUrl("in-org-info.html");
-
- } else if (isInOrgInfo) {
- reload_inOrgInfo(treeNode);
- }
-
-
- //changeUrl("in-org-info.html?" + treeNode.id);
- }
- if (getTabValue() == 1) {
- // 在人员中,系查看人员信息
- // 如果是外部机构那么先跳转到内部机构
- var isInlinklist = false;
- var isOutlinklist = false;
- var iUrl = document.getElementsByName("frmrightChild")[0]
- .getAttribute("src");
- // 判定在内部和外部
- if (iUrl == "inlinklist.html") {
- // alert("判定在内部人员列表");
- isInlinklist = true;
- } else if (iUrl == "outlinklist.html") {
- // alert("判定在外部人员列表");
- isOutlinklist = true;
- }
- if (isOutlinklist) {
- changeUrl("inlinklist.html");
-
- } else if (isInlinklist) {
- reload_inlinklist(treeNode);
- }
- }
- }
- // 封装点击外部机构树的右边界面切换--外部机构
- function outChangeIframeByClick(treeNode) {
-
- sup_classId = treeNode.classId;
- sup_org_name = treeNode.name;
- sup_fd_objectId = treeNode.objectId;
- sup_orgType= treeNode.orgType;
- if (getTabValue() == 0) {
- // 在机构中,系查看机构信息 调用reload_outOrgInfo(treeNode);
- // 如果是内部机构那么先跳转到外部机构
- var isInOrgInfo = false;
- var isOutOrgInfo = false;
- var iUrl = document.getElementsByName("frmrightChild")[0]
- .getAttribute("src");
- // 判定在内部和外部
- if (iUrl == "in-org-info.html") {
- // alert("判定在内部人员列表");
- isInOrgInfo = true;
- } else if (iUrl == "out-org-info.html") {
- // alert("判定在外部人员列表");
- isOutOrgInfo = true;
- }
- if (isInOrgInfo) {
- changeUrl("out-org-info.html");
-
- } else if (isOutOrgInfo) {
- reload_outOrgInfo(treeNode);
- }
-
- }
- if (getTabValue() == 1) {
- // 在人员中,系查看人员信息
- // 如果是内部机构那么先跳转到外部机构
- var isInlinklist = false;
- var isOutlinklist = false;
- var iUrl = document.getElementsByName("frmrightChild")[0]
- .getAttribute("src");
- // 判定在内部和外部
- if (iUrl == "inlinklist.html") {
- // alert("判定在内部人员列表");
- isInlinklist = true;
- } else if (iUrl == "outlinklist.html") {
- // alert("判定在外部人员列表");
- isOutlinklist = true;
- }
- if (isInlinklist) {
-
- changeUrl("outlinklist.html");
-
- } else if (isOutlinklist) {
-
- reload_outlinklist(treeNode);
- }
- }
- }
- // 显示节点的删除图标--内部机构
- // 设置删除图标的显示状态--内部机构
- function setRemoveBtn(treeId, treeNode) {
- var show = false;
- if(isSuperAdmin){
- show = treeNode.isV == "1";
-
- }else{
- show =false;
- }
- return show;
- }
- // 设置编辑图标的显示状态--内部机构
- function setRenameBtn(treeId, treeNode) {
- // return treeNode.isV=="1";
- return false;
- }
- // 设置删除图标的显示状态--外部机构
- function setRemoveBtn2(treeId, treeNode) {
- var show = false;
- if(isSuperAdmin){
- show = !treeNode.isParent || treeNode.id != sup_userInfo_deptId;
-
- }else{
- show =false;
- }
- return show;
- }
- // 设置编辑图标的显示状态--外部机构
- function setRenameBtn2(treeId, treeNode) {
- // return !treeNode.isParent||treeNode.id!=sup_userInfo_deptId;
- return false;
- }
- // 重新加载机构信息--外部机构
- function reload_outOrgInfo(treeNode) {
- var frame = document.getElementsByName("frmrightChild")[0];
- //frame.src = "out-orginfo.html";
- frame.contentWindow.refreshOutOrgInfo(treeNode.id);
- }
- // 重新加载机构信息--内部机构
- function reload_inOrgInfo(treeNode) {
- var frame = document.getElementsByName("frmrightChild")[0];
- //frame.src = "in-orginfo.html";
- frame.contentWindow.refreshInOrgInfo(treeNode.id);
- }
- // 根据单击的机构重新加载表格数据-外部机构
- function reload_outlinklist(treeNode) {
- var frame = document.getElementsByName("frmrightChild")[0];
- var params = "IS_DEL=0 AND ORG_DEPT_ID='" + treeNode.objectId + "'";
- frame.contentWindow.reloadByOrgName(params, treeNode.name);
- }
- // 根据单击的机构重新加载人员表格数据-内部机构
- function reload_inlinklist(treeNode) {
- /**
- * 先判定是虚拟机构还是实体机构 虚拟机构的话 params条件是以virtual_org_id 为条件 实体机构的则以 parent_org_id 为搜索条件
- */
- var sqlLoadParams;
- if(treeNode.isV=="1"){
- sqlLoadParams = "IS_DEL=0 AND VIRTUAL_ORG_ID ='"+ treeNode.id+"'";
-
- }else{
-
- sqlLoadParams = "IS_DEL=0 AND PARENT_ORG_ID ='"+ treeNode.id+"'";
- }
- var frame = document.getElementsByName("frmrightChild")[0];
- //sqlLoadParams = "IS_DEL=0 AND PARENT_DEPT_ID ='" + treeNode.id + "'";
- frame.contentWindow.reloadByOrgDeptId(sqlLoadParams, treeNode.name, treeNode.id,treeNode.isV);
- }
- // 禁止拖拽
- function beforeDrag(treeId, treeNodes) {
- return false;
- }
- // 外部控制索引
- function changeIdxHandler() {
- var idx = getTabValue() + 1;
- if (idx > 1) {
- idx = 0;
- }
- $("#basicTabModern").basicTabModernSetIdx(idx);
- }
- // 获得选中索引
- function getTabValue() {
- return $("#basicTabModern").attr("selectedIdx");
- }
- // 封装切换iframe的地址方法
- function changeUrl(url) {
- var changedUrl = document.getElementsByName("frmrightChild")[0];
- changedUrl.src = url;
- return changedUrl;
- }
- // 移除部门判定ajax--内部机构
- function beforeRemove(treeId, treeNode) {
- var zTree = $.fn.zTree.getZTreeObj("myTree");
- // 选中该节点
- zTree.selectNode(treeNode);
- top.Dialog
- .confirm(
- "确认删除" + treeNode.name + "吗?",
- function() {
- // 此处进行ajax后台数据处理
- var params = {
- "deptId" : treeNode.id,
- };
- $
- .ajax({
- url : $.pathname()
- + "/ws/orgInDeptService/OrgInDeptService/shamDeleteOrgInDept",
- type : "post",
- data : params,
- dataType : "json",
- success : function(data) {
- if (data.msg == "success") {
- top.Dialog.alert("删除成功");
- zTree.removeNode(treeNode);
- // 删除成功后去掉右边的界面显示情况
- /*
- * 1先选中该节点的父节点
- * 2再处理右边的界面,如果是机构就显示父节点结构信息,如果是人员就显示父节点的人员信息
- */
- zTree.selectNode(zTree
- .getNodesByParam("id",
- treeNode.parentId,
- null)[0]);
- inChangeIframeByClick(treeNode
- .getParentNode());
- }
- if (data.msg == "fail") {
- top.Dialog
- .alert("删除失败,"+treeNode.name+"下存在子机构或人员");
- }
- },
- error : function() {
- top.Dialog.alert("后台处理出错");
- }
- });
- });
- return false;
- }
- // 查看外部机构详情--外部机构
- function viewOutOrg(treeNode) {
- var viewBtn = $("#viewOutBtn_" + treeNode.id);
- viewBtn.bind("click", function() {
- // 判定iframe选项卡的情况-->跳转界面
- // 判定当前的iframe选项卡的序号如果为人员切换tab,如果为组织机构不切换tab
- var selectedTabIndex = getTabValue();
- if (selectedTabIndex == 0) {
- changeUrl("out-org-info.html");
- } else if (selectedTabIndex == 1) {
- changeIdxHandler();
- changeUrl("out-org-info.html");
- }
- });
- }
- // 新增外部机构
- function addOutOrg(treeNode) {
- /*
- * //先新增一个节点 var zTree = $.fn.zTree.getZTreeObj("myTree2"); var
- * newNode={id:"1213", parentId:treeNode.id, name:"新增外部机构",
- * objectId:"1213",classId:"210",
- * icon:"/nwyj/scripts/qui/libs/icons/home.gif"};
- * zTree.addNodes(treeNode,newNode);
- */
- // 判定当前的iframe选项卡的序号如果为人员切换tab,如果为组织机构不切换tab
- var selectedTabIndex = getTabValue();
- if (selectedTabIndex == 0) {
- // 跳转到新增外部组织机构界面
- // alert("跳转到modify");
- changeUrl("out-org-modify.html");
- } else if (selectedTabIndex == 1) {
- // 切换选项卡
- changeIdxHandler();
- // alert("跳转到modify");
- // 跳转到新增外部组织机构界面
- changeUrl("out-org-modify.html");
- }
- }
- // 修改外部机构
- function editOutOrg(treeNode) {
- // 判定当前的iframe选项卡的序号如果为人员切换tab,如果为组织机构不切换tab
- var selectedTabIndex = getTabValue();
- if (selectedTabIndex == 0) {
- // alert("跳转到modify+?");
- changeUrl("out-org-modify.html?" + treeNode.id);
- // 跳转到修改组织机构界面
- } else if (selectedTabIndex == 1) {
- changeIdxHandler();
- // alert("跳转到modify+?");
- changeUrl("out-org-modify.html?" + treeNode.id);
- }
- }
- // 确认是否删除+删除处理--外部机构
- function beforeRemove2(treeId, treeNode) {
- var zTree = $.fn.zTree.getZTreeObj("myTree2");
- // 选中该节点
- zTree.selectNode(treeNode);
- top.Dialog.confirm("确认删除" + treeNode.name + "吗?", function() {
- // 此处进行ajax后台数据处理
- var params = {
- "deptId" : treeNode.id,
- };
- $.ajax({
- url : $.pathname()
- + "/ws/orgOutDeptService/OrgOutDeptService/deleteOutDept/",
- type : "post",
- data : params,
- dataType : "json",
- success : function(data) {
- if (data.msg == "success") {
- top.Dialog.alert("删除成功");
- zTree.removeNode(treeNode);
- // 删除成功后去掉右边的界面显示情况
- /*
- * 1先选中该节点的父节点 2再处理右边的界面,如果是机构就显示父节点结构信息,如果是人员就显示父节点的人员信息
- */
- zTree.selectNode(zTree.getNodesByParam("id",
- treeNode.parentId, null)[0]);
- outChangeIframeByClick(treeNode.getParentNode());
- }
- if (data.msg == "fail") {
- top.Dialog.alert("删除失败"+treeNode.name+"机构下存在联系人");
- }
- },
- error : function() {
- top.Dialog.alert("后台处理出错");
- }
- });
- });
- return false;
- }
- // 刷新外部机构组织树
- function outOrgNodeRefresh(treeNode) {
- var zTree = $.fn.zTree.getZTreeObj("myTree2");
- //var node = zTree.getNodesByParam("id", treeNode.parentId, null);
-
- //选定更新的外部机构
- zTree.selectNode(zTree.getNodesByParam("id", treeNode.id, null)[0]);
-
-
- var nodes = zTree.getSelectedNodes();
- if (nodes.length > 0) {
- nodes[0].name=treeNode.name;
- nodes[0].classId=treeNode.classId;
- nodes[0].orgType=treeNode.orgType;
- nodes[0].objectId=treeNode.objectId;
- zTree.updateNode(nodes[0]);
- /* treeObj.reAsyncChildNodes(nodes[0], "refresh"); */
- }
- }
- // 新增外部机构节点
- function outOrgNodeAdd(treeNode) {
- var zTree = $.fn.zTree.getZTreeObj("myTree2");
- var node = zTree.getNodesByParam("id", treeNode.parentId, null);
- zTree.addNodes(node[0], treeNode);
- // 选定新增的节点
- zTree.selectNode(zTree.getNodesByParam("id", treeNode.id, null)[0]);
- }
- // 新增内部机构节点
- function inOrgNodeAdd(treeNode) {
- var zTree = $.fn.zTree.getZTreeObj("myTree");
- var node = zTree.getNodesByParam("id", treeNode.parentId, null);
- zTree.addNodes(node[0], treeNode);
- // 选定新增的节点
- zTree.selectNode(zTree.getNodesByParam("id", treeNode.id, null)[0]);
- }
- // 强行异步刷新树的节点--内部机构
- function refreshMytreeNode(treeNode) {
- var treeObj = $.fn.zTree.getZTreeObj("myTree");
- //选定更新的内部机构
- treeObj.selectNode(treeObj.getNodesByParam("id", treeNode.id, null)[0]);
- var nodes = treeObj.getSelectedNodes();
- if (nodes.length > 0) {
- nodes[0].isV = treeNode.isV;
- nodes[0].name = treeNode.name;
- nodes[0].classId=treeNode.classId;
- nodes[0].objectId=treeNode.objectId;
- nodes[0].icons=treeNode.objectId;
- treeObj.updateNode(nodes[0]);
- /* treeObj.reAsyncChildNodes(nodes[0], "refresh"); */
- }
- }
- function initTree() {
- $.fn.zTree.init($("#myTree"), setting);
- }
- function initTree2() {
- var url = $.pathname()
- + "/ws/orgOutDeptService/OrgOutDeptService/getOutDeptList/";
- var params = {
- "id" : sup_userInfo_deptId
- };
- /*
- * $.post(url,{"params":id},function(data){ $.fn.zTree.init($("#myTree2"),
- * setting, data.treeNodes); },"json");
- */
- $.ajax({
- url : url,
- dataType : "json",
- data : params,
- type : "post",
- success : function(data) {
- $.fn.zTree.init($("#myTree2"), setting2, data.treeNodes);
- },
- error : function() {
- top.Dialog.alert("访问服务器失败,请检查网络");
- }
- });
- }
- // 布局组件初始化
- function initLayout() {
- var layout = $("#layout1").layout({
- leftWidth : 320,
- centerWidth : 760,
- height : 630
- });
- layout.setRightCollapse(true);
- };
- // 重新设布局高度
- function customHeightSet(contentHeight) {
- $(".layout_content").height(contentHeight - 30);
- }
|