提交 aedce9cd 编写于 作者: Shine-zwj's avatar Shine-zwj

部门人员选择器--fix5

上级 05d00fed
......@@ -186,19 +186,55 @@ export default class AppDepartmentPersonnel extends Vue {
this.items = items;
}else{
this.getDepertmentId();
let tempUrl = this.url.replace('{deptId}',this.filtervalue);
if(this.treeurl){
let tempUrl = this.treeurl.replace('{deptId}',this.filtervalue);
let get = Http.getInstance().get(tempUrl, true);
get.then((response: any) => {
get.then((response: any)=>{
if(response.status === 200) {
this.items = response.data;
this.$store.commit("addDepartmentPersonnel",this.items);
this.getTreeItems(response.data);
}
});
}else{
this.getPersonnelItems(this.filtervalue);
}
}
}
}
/**
* 加载当前部门和其下级部门数据
*
* @param {*} $event
* @memberof AppDepartmentPersonnel
*/
public getTreeItems(treeItems: Array<any>){
if(treeItems.length > 0){
treeItems.forEach((treeItem: any)=>{
this.getPersonnelItems(treeItem.id);
});
}
}
/**
* 加载部门人员数据
*
* @param {*} $event
* @memberof AppDepartmentPersonnel
*/
public getPersonnelItems($event: string){
let tempUrl = this.url.replace('{deptId}',$event);
let get = Http.getInstance().get(tempUrl, true);
get.then((response: any) => {
if(response.status === 200 && response.data.length > 0) {
response.data.forEach((item: any)=>{
this.items.push(item);
});
}
this.$store.commit("addDepartmentPersonnel",this.items);
}).catch((error: any) => {
console.log(error)
})
}
}
}
/**
* 值变化
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册