123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- var setting1;
- var corpId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
- var role_id = top.com.sinosoft.lz.system.user.LoginInfo.getRoleids();
- var corpName = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
- var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
- //获取用户Id
- var user_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id();
- var yqRole = getYqRole(role_id);
- //记录选中的组织id
- var selectedOrgId=[];
- var addTreeNodes=[];
- var zTree = $.fn.zTree.getZTreeObj("myTree1");
- function initTree1(){
- $.fn.zTree.init($("#myTree1"), setting1);
- }
- function getDeptLevel2(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;
- }
- function showData(selectedComp,report_type,affair){
- selectedOrgId = selectedComp.split(",");
- setting1 = {
- async : {
- enable : true,
- dataType : 'JSON',
- contentType : "application/json",
- dataName : 'treeNodes',
- url : $.pathname() +"/ws/getRepotDept/ReportDeptService/getAllDeptTree",
- autoParam : [ "id" ],
- otherParam : [ "corpId",corpId ,"selectedComp",selectedComp,"deptLevel",getDeptLevel2(corpId)]
- },
- check : {
- enable:true,
- },
- callback:{
- onClick:nodeCheck
- }
- };
-
- initTree1();
- }
- //数据补录里的单位选择
- function showData2(selectedComp,report_type,affair){
- setting1 = {
- async : {
- enable : true,
- dataType : 'JSON',
- contentType : "application/json",
- dataName : 'treeNodes',
- url : $.pathname() +"/ws/getRepotDept/ReportDeptService/getAllDeptTree2",
- autoParam : [ "id" ],
- otherParam : [ "corpId",corpId ,"deptLevel",getDeptLevel2(corpId),"roleId",role_id]
- },
- check : {
- enable:true,
- },
- callback:{
- onClick:nodeCheck
- }
- };
- //取消父子节点的相互关联
- setting1.check.chkboxType = {
- "Y":"",
- "N":""
- };
-
- initTree1();
- }
- function queDing(){
- var treeObj = $.fn.zTree.getZTreeObj("myTree1");
- var nodes = treeObj.getCheckedNodes(true);
- var arr = [];
- if(nodes.length>0){
- for(var i=0;i<nodes.length;i++){
- // if(nodes[i].isParent!=true){
- if(nodes[i].id!=corpId && nodes[i].name!='本部'){
- arr.push(nodes[i].id+","+nodes[i].name);
- }
- }
- }
- return arr;
- }
- function queDing2(){
- var treeObj = $.fn.zTree.getZTreeObj("myTree1");
- var nodes = treeObj.getCheckedNodes(true);
- var arr = [];
- if(nodes.length>0){
- for(var i=0;i<nodes.length;i++){
- arr.push(nodes[i].id+","+nodes[i].name);
- }
- }
- return arr;
- }
- function qingChu(){
- var treeObj = $.fn.zTree.getZTreeObj("myTree1");
- treeObj.checkAllNodes(false);
- }
- function quanXuan(){
- var treeObj = $.fn.zTree.getZTreeObj("myTree1");
- treeObj.checkAllNodes(true);
- }
- function nodeCheck(event,treeId,treeNode){
- if(treeNode.id!=corpId && treeNode.id!="benbu999"){
- var treeObj = $.fn.zTree.getZTreeObj("myTree1");
- var nodes = treeObj.getSelectedNodes();
- for (var i=0, l=nodes.length; i < l; i++) {
- var id = nodes[i].id;
- if(chekedId(selectedOrgId,id)){
- treeObj.checkNode(nodes[i], true, true);
- selectedOrgId.push(id);
- }else{
- treeObj.checkNode(nodes[i], false, false);
- for(var j=0; j<selectedOrgId.length; j++) {
- if(selectedOrgId[j] == id){
- selectedOrgId.splice(j, 1);
- }
- }
- }
- }
- }
- return false;
- }
- function chekedId(arr,str){
- if(arr.length==0){
- return true;
- }
- for(var i=0;i<arr.length;i++){
- if(arr[i]==str){
- return false;
- }
- }
- return true;
- }
|