伊利项目 架构筛选 组织机构搜索
This commit is contained in:
parent
ffa244c074
commit
50be2d0fcc
@ -149,6 +149,7 @@
|
||||
:highlight-current=true
|
||||
@node-collapse="closeNodeOrg"
|
||||
:filter-node-method="filterNode"
|
||||
:default-expanded-keys="expandKeys"
|
||||
@check-change="orgCheckChange"
|
||||
node-key="id"
|
||||
lazy
|
||||
@ -321,6 +322,10 @@
|
||||
}
|
||||
};
|
||||
return {
|
||||
treeNode: null,
|
||||
treeResolve: null,
|
||||
expandKeys: [],
|
||||
tempNodeArr: [],
|
||||
isLoading:false,
|
||||
multiple: true,
|
||||
// 创建人
|
||||
@ -474,10 +479,82 @@
|
||||
},
|
||||
filterNode(value, data) {
|
||||
if (!value) return true;
|
||||
return data.name.indexOf(value) !== -1;
|
||||
// console.log('filterNode',value,data)
|
||||
return value.data.pathIdList.indexOf(data.id) !== -1;
|
||||
},
|
||||
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){
|
||||
@ -551,6 +628,9 @@
|
||||
// 获取根目录
|
||||
data.data.pid = '';
|
||||
data.data.parentType = '';
|
||||
|
||||
that.treeNode = node;
|
||||
that.treeResolve = resolve;
|
||||
} else {
|
||||
// 获取其他目录
|
||||
data.data.pid = node.data.id;
|
||||
@ -1368,6 +1448,19 @@
|
||||
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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user