伊利项目 架构筛选 组织机构搜索功能
This commit is contained in:
parent
33b55a4631
commit
497b92a266
@ -477,10 +477,23 @@
|
||||
this.refreshNode('control');
|
||||
this.refreshNode('process');
|
||||
},
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
// console.log('filterNode',value,data)
|
||||
return value.data.pathIdList.indexOf(data.id) !== -1;
|
||||
filterNode(values, data) {
|
||||
if (!values) return true;
|
||||
let tempIds = [];
|
||||
values.forEach(value => {
|
||||
if (value.data.pathIdList.indexOf(data.id) !== -1) {
|
||||
let node = this.$refs.orgTree.getNode(data.id);
|
||||
if (node) {
|
||||
this.tempNodeArr.push(node);
|
||||
}
|
||||
}
|
||||
value.data.pathIdList.forEach(pathId => {
|
||||
if (tempIds.indexOf(pathId) === -1) {
|
||||
tempIds.push(pathId)
|
||||
}
|
||||
});
|
||||
});
|
||||
return tempIds.indexOf(data.id) !== -1;
|
||||
},
|
||||
searchOrgNameFun(){
|
||||
let that = this;
|
||||
@ -496,24 +509,8 @@
|
||||
// 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);
|
||||
}
|
||||
});
|
||||
// 查询当前部门节所有父级部门
|
||||
that.searchParentOrgIdFun(orgIdArr,that.searchOrgName);
|
||||
}else {
|
||||
that.$message({type:'warning',message:'查询的部门不存在,请检查输入的部门名称'});
|
||||
}
|
||||
@ -524,7 +521,7 @@
|
||||
that.treeNode.childNodes = [];
|
||||
that.loadNodeOrg(that.treeNode,that.treeResolve);
|
||||
that.expandKeys = [];
|
||||
if (that.tempNodeArr.length){
|
||||
if (that.tempNodeArr?.length){
|
||||
that.tempNodeArr.forEach(node => {
|
||||
that.$refs.orgTree.remove(node);
|
||||
})
|
||||
@ -543,14 +540,18 @@
|
||||
}
|
||||
awsuiAxios.post(data)
|
||||
.then(ro => {
|
||||
console.log('父级部门',ro.data);
|
||||
// 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);
|
||||
let tempNode = [];
|
||||
orgId.forEach(tempOrgId => {
|
||||
let node = that.$refs.orgTree.getNode(tempOrgId);
|
||||
tempNode.push(node);
|
||||
that.tempNodeArr.push(node);
|
||||
},100);
|
||||
})
|
||||
that.$refs.orgTree.filter(tempNode);
|
||||
},500);
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
@ -1453,7 +1454,7 @@
|
||||
this.treeNode.childNodes = [];
|
||||
this.loadNodeOrg(this.treeNode,this.treeResolve);
|
||||
this.expandKeys = [];
|
||||
if (this.tempNodeArr.length){
|
||||
if (this.tempNodeArr?.length){
|
||||
this.tempNodeArr.forEach(node => {
|
||||
this.$refs.orgTree.remove(node);
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user