diff --git a/src/components/roleTree/index.vue b/src/components/roleTree/index.vue index a9d365639..7b35fb11b 100644 --- a/src/components/roleTree/index.vue +++ b/src/components/roleTree/index.vue @@ -14,11 +14,16 @@ > + + + 查询 + +
+ :lazy="true"> {{ node.label }} @@ -54,13 +60,14 @@ :props="defaultProps" @check-change="checkChange2" :default-checked-keys="nodeList2" - highlight-current - check-strictly - @check="drawerCheck" - :expand-on-click-node="true" + :default-expanded-keys="defaultKey" default-expand-all + highlight-current + :check-strictly="true" + @check="drawerCheck" show-checkbox - ref="tree"> + ref="tree" + :lazy="false"> {{ node.label }} @@ -128,6 +135,52 @@ }, data () { return { + data3: [{ + id: 1, + label: '一级 1', + children: [{ + id: 4, + label: '二级 1-1', + children: [{ + id: 9, + label: '三级 1-1-1' + }, { + id: 10, + label: '三级 1-1-2' + }] + }] + }, { + id: 2, + label: '一级 2', + children: [{ + id: 5, + label: '二级 2-1' + }, { + id: 6, + label: '二级 2-2' + }] + }, { + id: 3, + label: '一级 3', + children: [{ + id: 7, + label: '二级 3-1' + }, { + id: 8, + label: '二级 3-2', + children: [{ + id: 11, + label: '三级 3-2-1' + }, { + id: 12, + label: '三级 3-2-2' + }, { + id: 13, + label: '三级 3-2-3' + }] + }] + }], + defaultKey: [], visible: false, selectList: [], nodeList2: [], @@ -137,11 +190,6 @@ defaultProps: { children: 'children', label: 'name', - isLeaf: (data, node) => { - if (!node.disabled) { - return true - } - } }, treeData1: [], treeData: [], @@ -193,6 +241,39 @@ } ) }, + searchChange(){ + if (this.filterText.length) { + this.open1 = false + this.treeLoading = true + this.defaultKey = [] + this.$http.get('SarInstitution/institution/getNextTwo', { + userName: this.filterText + }, {}, res => { + this.treeData1 = res + this.treeData1.forEach(item => { + this.defaultKey.push(item.id) + }) + this.treeLoading = false + }) + + + + + // this.$http.get('SarInstitution/institution/institutionAndUser', { + // userName: this.filterText + // }, {}, res => { + // this.treeData1 = res.data + // this.treeData1.forEach(item => { + // this.defaultKey.push(item.id) + // }) + // console.log(1); + // this.getChildren() + // this.treeLoading = false + // }) + } else { + this.open1 = true + } + }, changeInput:debounce(function (val) { if (val.length) { this.open1 = false