提交 bbabbf85 编写于 作者: laizhilong's avatar laizhilong

组织树,部门树增加搜索框

上级 554f721d
<template>
<div class="design-tree-container">
<context-menu-container>
<el-input size="medium" placeholder="搜索..." v-model="filerText" @input="filterChange">
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
<el-tree
:filter-node-method="filterNode"
class="tre"
:data="this.TreeData"
ref="DeptTree"
......@@ -28,6 +32,23 @@
})
export default class DeptTree extends Vue {
// 过滤文本
public filerText: any = '';
/**
* 过滤节点
*/
public filterNode(value:any,data:any){
if (!value) return true;
return data.label.indexOf(value) !==-1;
}
/**
* 树搜索触发
*/
public filterChange(){
const DeptTree:any = this.$refs.DeptTree;
DeptTree.filter(this.filerText);
}
/*树数据*/
public TreeData: any = [];
......
<template>
<div class="design-tree-container">
<context-menu-container>
<el-input size="medium" placeholder="搜索..." v-model="filerText" @input="filterChange">
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
<el-tree
:filter-node-method="filterNode"
class="tre"
:data="this.TreeData"
ref="OrgTree"
......@@ -27,6 +31,23 @@
})
export default class OrgTree extends Vue {
// 过滤文本
public filerText: any = '';
/**
* 过滤节点
*/
public filterNode(value:any,data:any){
if (!value) return true;
return data.label.indexOf(value) !==-1;
}
/**
* 树搜索触发
*/
public filterChange(){
const OrgTree:any = this.$refs.OrgTree;
OrgTree.filter(this.filerText);
}
/*树数据*/
public TreeData: any = [];
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册