伊利项目 架构筛选 组织机构搜索

This commit is contained in:
qinoy 2022-09-06 17:56:05 +08:00
parent ffa244c074
commit 50be2d0fcc

View File

@ -149,6 +149,7 @@
:highlight-current=true :highlight-current=true
@node-collapse="closeNodeOrg" @node-collapse="closeNodeOrg"
:filter-node-method="filterNode" :filter-node-method="filterNode"
:default-expanded-keys="expandKeys"
@check-change="orgCheckChange" @check-change="orgCheckChange"
node-key="id" node-key="id"
lazy lazy
@ -321,6 +322,10 @@
} }
}; };
return { return {
treeNode: null,
treeResolve: null,
expandKeys: [],
tempNodeArr: [],
isLoading:false, isLoading:false,
multiple: true, multiple: true,
// //
@ -474,10 +479,82 @@
}, },
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
return data.name.indexOf(value) !== -1; // console.log('filterNode',value,data)
return value.data.pathIdList.indexOf(data.id) !== -1;
}, },
searchOrgNameFun(){ searchOrgNameFun(){
this.$refs.orgTree.filter(this.searchOrgName); let that = this;
if (that.searchOrgName) {
const data = {
url: 'jd',
data: {
cmd: 'com.actionsoft.apps.coe.pal_search_org_tree_node',
orgName: that.searchOrgName,
}
}
awsuiAxios.post(data).then(ro => {
// console.log('--------',ro)
let orgIdArr = [...ro.data];
if (orgIdArr.length) {
orgIdArr.forEach(orgId => {
let node = that.$refs.orgTree.getNode(orgId);
//
if (node) {
that.$refs.orgTree.filter(node);
setTimeout(() => {
if (node && node.parent) {
if (!node.parent.expanded){
node.parent.expand();
}
}
},100);
that.tempNodeArr.push(node);
}else {
//
that.searchParentOrgIdFun(orgId,that.searchOrgName);
}
});
}else {
that.$message({type:'warning',message:'查询的部门不存在,请检查输入的部门名称'});
}
}).catch(error => {
console.log(error);
})
}else {
that.treeNode.childNodes = [];
that.loadNodeOrg(that.treeNode,that.treeResolve);
that.expandKeys = [];
if (that.tempNodeArr.length){
that.tempNodeArr.forEach(node => {
that.$refs.orgTree.remove(node);
})
that.tempNodeArr.length = 0;
}
}
},
searchParentOrgIdFun(orgId,orgName){
let that = this;
const data = {
url: 'jd',
data: {
cmd: 'com.actionsoft.apps.coe.pal_search_org_tree_parent_node',
orgId,
}
}
awsuiAxios.post(data)
.then(ro => {
console.log('父级部门',ro.data);
that.expandKeys = [...ro.data];
setTimeout(() => {
// that.$refs.orgTree.filter(orgName);
let node = that.$refs.orgTree.getNode(orgId);
that.$refs.orgTree.filter(node);
that.tempNodeArr.push(node);
},100);
})
.catch(err => {
console.log(err);
});
}, },
// //
handleCheckCurrentUserDeptChange(val){ handleCheckCurrentUserDeptChange(val){
@ -551,6 +628,9 @@
// //
data.data.pid = ''; data.data.pid = '';
data.data.parentType = ''; data.data.parentType = '';
that.treeNode = node;
that.treeResolve = resolve;
} else { } else {
// //
data.data.pid = node.data.id; data.data.pid = node.data.id;
@ -1368,6 +1448,19 @@
this.securityFileList.splice(0,this.securityFileList.length); this.securityFileList.splice(0,this.securityFileList.length);
} }
}, },
searchOrgName(newval, oldval){
if (!newval) {
this.treeNode.childNodes = [];
this.loadNodeOrg(this.treeNode,this.treeResolve);
this.expandKeys = [];
if (this.tempNodeArr.length){
this.tempNodeArr.forEach(node => {
this.$refs.orgTree.remove(node);
});
this.tempNodeArr.length = 0;
}
}
}
} }
} }
</script> </script>