选人组件更改

This commit is contained in:
宋伟佳
2022-05-20 16:47:01 +08:00
parent f45969ff51
commit 10bf57d22b
+95 -14
View File
@@ -14,11 +14,16 @@
>
<el-form-item class="form-item-disabled" style="margin: 10px;">
<el-input
v-model="filterText"
placeholder="请输入姓名"
@input="changeInput"
v-model="filterText"
placeholder="请输入姓名"
@keyup.enter.native="searchChange"
></el-input>
</el-form-item>
<el-form-item class="form-item-disabled" style="margin-top: 10px;">
<el-button size="medium " type="primary" @click="searchChange">
查询
</el-button>
</el-form-item>
</el-form>
<div class="divTree">
<el-tree
@@ -31,6 +36,7 @@
:data="treeData"
:props="defaultProps"
:default-checked-keys="nodeList2"
:default-expanded-keys="defaultKey"
highlight-current
check-strictly
@check="drawerCheck"
@@ -38,7 +44,7 @@
show-checkbox
ref="tree"
:load="loadNode"
lazy>
:lazy="true">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span :class="node.disabled ? 'is-show' : 'is-leaf-none'"></span>
<span> {{ node.label }} </span>
@@ -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">
<span class="custom-tree-node" slot-scope="{ node, data }">
<span :class="node.disabled ? 'is-show' : 'is-leaf-none'"></span>
<span> {{ node.label }} </span>
@@ -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