This commit is contained in:
zhutianqi
2021-12-08 16:54:54 +08:00
parent fd9fa1c55c
commit a5b6b9c75f
+36 -19
View File
@@ -143,26 +143,33 @@
} }
}), }),
checkChange2 (row, type, c) { checkChange2 (row, type, c) {
if (type) { if (this.checkBox) {
this.nodeList.push(row.id)
} else { } else {
for (let a = 0; a < this.nodeList.length; a ++) { if (type) {
if (row.id === this.nodeList[a]) { this.nodeList.push(row.id)
this.nodeList.splice(a, 1) } else {
for (let a = 0; a < this.nodeList.length; a ++) {
if (row.id === this.nodeList[a]) {
this.nodeList.splice(a, 1)
}
} }
} }
} }
}, },
checkChange (row, type, c) { checkChange (row, type, c) {
if (type) { if (this.checkBox) {
this.nodeList.push(row.id)
} else { } else {
for (let a = 0; a < this.nodeList.length; a ++) { if (type) {
if (row.id === this.nodeList[a]) { this.nodeList.push(row.id)
this.nodeList.splice(a, 1) } else {
for (let a = 0; a < this.nodeList.length; a ++) {
if (row.id === this.nodeList[a]) {
this.nodeList.splice(a, 1)
}
} }
} }
} }
}, },
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())
} }
}, },