This commit is contained in:
zhutianqi
2021-12-08 16:54:54 +08:00
parent fd9fa1c55c
commit a5b6b9c75f
+26 -9
View File
@@ -143,6 +143,8 @@
} }
}), }),
checkChange2 (row, type, c) { checkChange2 (row, type, c) {
if (this.checkBox) {
} else {
if (type) { if (type) {
this.nodeList.push(row.id) this.nodeList.push(row.id)
} else { } else {
@@ -152,8 +154,11 @@
} }
} }
} }
}
}, },
checkChange (row, type, c) { checkChange (row, type, c) {
if (this.checkBox) {
} else {
if (type) { if (type) {
this.nodeList.push(row.id) this.nodeList.push(row.id)
} else { } else {
@@ -163,6 +168,8 @@
} }
} }
} }
}
}, },
handleTreeDrawerCancel () { handleTreeDrawerCancel () {
this.filterText = '' this.filterText = ''
@@ -200,17 +207,27 @@
this.open1 = true this.open1 = true
}, },
drawerCheck (data) { drawerCheck (data) {
if (this.checkBox) { if (this.checkBox) { // 单选
// 单选判断 // 单选判断
var getlist = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes()); let getlist = this.$refs.tree.getCheckedNodes()
if(getlist.length == 1) { if (getlist.length > 1) {
this.roleRow = getlist[0] this.$refs.tree.setCheckedKeys([])
} else { this.$refs.tree.setCheckedKeys([data.id])
this.$refs.tree.setCheckedKeys([data.id]); this.roleList = [data]
this.roleRow = this.$refs.tree.getCheckedNodes()[0] } else if (getlist.length === 0) {
this.roleList = [{}]
} else if (getlist.length === 1) {
this.roleList = [data]
} }
this.roleList = [this.roleRow] // var getlist = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes());
} else { // if(getlist.length == 1) {
// this.roleRow = getlist[0]
// } else {
// this.$refs.tree.setCheckedKeys([data.id])
// this.roleRow = this.$refs.tree.getCheckedNodes()[0]
// }
// this.roleList = [this.roleRow]
} else { // 多选
this.roleList = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes()) this.roleList = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes())
} }
}, },