Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
yanyizhou
2021-11-22 11:03:52 +08:00
+67 -52
View File
@@ -17,6 +17,7 @@
<el-input
v-model="filterText"
placeholder="请输入姓名"
@input="changeInput"
></el-input>
</el-form-item>
</el-form>
@@ -25,7 +26,6 @@
node-key="id"
style="height: 100%; overflow: auto;"
class="filter-tree tree-line"
:class="treeClass"
@check-change="checkChange"
:data="treeData"
:props="defaultProps"
@@ -50,6 +50,7 @@
class="filter-tree tree-line"
:data="treeData1"
:props="defaultProps"
@check-change="checkChange2"
:default-checked-keys="nodeList"
highlight-current
check-strictly
@@ -74,6 +75,15 @@
</template>
<script>
function debounce(func, wait = 500){
let timeout;
return function(event){
clearTimeout(timeout)
timeout = setTimeout(()=>{
func.call(this, event)
},wait)
}
}
export default {
name: "roleTree",
props: {
@@ -117,54 +127,73 @@
}
},
methods: {
checkChange (row, type, c) {
if (!type) {
if (this.nodeList.length > 0) {
for (let a = 0; a < this.nodeList.length; a ++) {
if (row.id === this.nodeList[a]) {
this.nodeList.splice(a, 1)
}
changeInput:debounce(function (val) {
if (val.length) {
this.open1 = false
this.treeLoading = true
this.$http.get('SarInstitution/institution/institutionAndUser', {
userName: val
}, {}, res => {
this.treeData1 = res.data
this.treeLoading = false
})
} else {
this.open1 = true
}
}),
checkChange2 (row, type, c) {
if (type) {
this.nodeList.push(row.id)
} else {
for (let a = 0; a < this.nodeList.length; a ++) {
if (row.id === this.nodeList[a]) {
this.nodeList.splice(a, 1)
}
}
}
},
treeClass () {
checkChange (row, type, c) {
if (type) {
this.nodeList.push(row.id)
} else {
for (let a = 0; a < this.nodeList.length; a ++) {
if (row.id === this.nodeList[a]) {
this.nodeList.splice(a, 1)
}
}
}
},
handleTreeDrawerCancel () {
this.filterText = ''
this.isVisible2 = false
},
saveUserInfo () {
if (this.nodeList.length > 0 && this.nodeList[0].length !== 0) {
let ids = ''
this.nodeList.forEach(item => {
if (ids.length > 0) {
ids += ','
ids += item
} else {
ids = item
}
})
this.$http.get('SarInstitution/institution/getNextById', {
ids: ids
}, {
_this: this
}, res => {
let oldList2 = res.concat(this.roleList)
let result = []
let obj = {}
for(let i = 0; i < oldList2.length; i++){
if(!obj[oldList2[i].id]){
result.push(oldList2[i]);
obj[oldList2[i].id] = true;
}
}
this.isVisible2 = false
this.$emit('checkedRole', result)
})
} else {
if (this.checkBox) {
this.isVisible2 = false
this.$emit('checkedRole', this.roleList)
} else {
if (this.nodeList.length > 0 && this.nodeList[0].length !== 0) {
let ids = ''
this.nodeList.forEach(item => {
if (ids.length > 0) {
ids += ','
ids += item
} else {
ids = item
}
})
this.$http.get('SarInstitution/institution/getNextById', {
ids: ids
}, {
_this: this
}, res => {
this.isVisible2 = false
this.$emit('checkedRole', res)
})
} else {
this.isVisible2 = false
this.$emit('checkedRole', this.roleList)
}
}
},
drawerCheck (data) {
@@ -173,7 +202,7 @@
var getlist = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes());
if(getlist.length == 1) {
this.roleRow = getlist[0]
}else {
} else {
this.$refs.tree.setCheckedKeys([data.id]);
this.roleRow = this.$refs.tree.getCheckedNodes()[0]
}
@@ -211,20 +240,6 @@
isVisible2 (val) {
this.$emit('update:isVisible', val)
},
filterText (val) {
if (val.length) {
this.open1 = false
this.treeLoading = true
this.$http.get('SarInstitution/institution/institutionAndUser', {
userName: val
}, {}, res => {
this.treeData1 = res.data
this.treeLoading = false
})
} else {
this.open1 = true
}
},
},
mounted () {
this.getTree()