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