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) {
if (type) {
this.nodeList.push(row.id)
if (this.checkBox) {
} else {
for (let a = 0; a < this.nodeList.length; a ++) {
if (row.id === this.nodeList[a]) {
this.nodeList.splice(a, 1)
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)
}
}
}
}
},
checkChange (row, type, c) {
if (type) {
this.nodeList.push(row.id)
if (this.checkBox) {
} else {
for (let a = 0; a < this.nodeList.length; a ++) {
if (row.id === this.nodeList[a]) {
this.nodeList.splice(a, 1)
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 = ''
@@ -200,17 +207,27 @@
this.open1 = true
},
drawerCheck (data) {
if (this.checkBox) {
if (this.checkBox) { // 单选
// 单选判断
var getlist = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes());
if(getlist.length == 1) {
this.roleRow = getlist[0]
} else {
this.$refs.tree.setCheckedKeys([data.id]);
this.roleRow = this.$refs.tree.getCheckedNodes()[0]
let getlist = this.$refs.tree.getCheckedNodes()
if (getlist.length > 1) {
this.$refs.tree.setCheckedKeys([])
this.$refs.tree.setCheckedKeys([data.id])
this.roleList = [data]
} else if (getlist.length === 0) {
this.roleList = [{}]
} else if (getlist.length === 1) {
this.roleList = [data]
}
this.roleList = [this.roleRow]
} else {
// var getlist = this.$refs.tree.getCheckedNodes().concat(this.$refs.tree.getHalfCheckedNodes());
// 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())
}
},