This commit is contained in:
zhutianqi
2022-03-09 16:40:13 +08:00
parent ecaee403d0
commit e6e01768af
9 changed files with 111 additions and 90 deletions
+41 -20
View File
@@ -5,7 +5,7 @@
:visible.sync="isVisible2"
:wrapperClosable="false"
@close="handleTreeDrawerCancel"
size="400px">
size="460px">
<el-form
ref="attributeEO"
class="label-input-form"
@@ -30,7 +30,7 @@
@check-change="checkChange"
:data="treeData"
:props="defaultProps"
:default-checked-keys="nodeList"
:default-checked-keys="nodeList2"
highlight-current
check-strictly
@check="drawerCheck"
@@ -53,7 +53,7 @@
:data="treeData1"
:props="defaultProps"
@check-change="checkChange2"
:default-checked-keys="nodeList"
:default-checked-keys="nodeList2"
highlight-current
check-strictly
@check="drawerCheck"
@@ -124,6 +124,7 @@
},
data () {
return {
nodeList2: [],
delList: [],
roleList: [],
isVisible2: false,
@@ -146,14 +147,19 @@
},
methods: {
handleClose (tag) {
let arr = []
for (let a = 0; a < this.delList.length; a++) {
if (tag.id === this.delList[a].id) {
this.delList.splice(a, 1)
}
}
for (let b = 0; b < this.nodeList.length; b++) {
if (tag.id === this.nodeList[b]) {
this.nodeList.splice(b, 1)
this.delList.map(item => {
arr.push(item)
})
this.$refs.tree.setCheckedKeys(arr);
for (let b = 0; b < this.nodeList2.length; b++) {
if (tag.id === this.nodeList2[b]) {
this.nodeList2.splice(b, 1)
}
}
},
@@ -166,7 +172,8 @@
cancelButtonText: '取消',
}).then(() => {
this.delList = []
this.nodeList = []
this.nodeList2 = []
this.$refs.tree.setCheckedKeys([]);
}).catch(() => {
this.$message({
type: 'info',
@@ -191,13 +198,20 @@
}),
checkChange2 (row, type, c) {
if (this.checkBox) {
} else {
if (type) {
this.nodeList.push(row.id)
this.nodeList2.push(row.id)
this.delList.push(row)
} else {
for (let a = 0; a < this.nodeList.length; a ++) {
if (row.id === this.nodeList[a]) {
this.nodeList.splice(a, 1)
for (let a = 0; a < this.nodeList2.length; a ++) {
if (row.id === this.nodeList2[a]) {
this.nodeList2.splice(a, 1)
}
}
for (let b = 0; b < this.delList.length; b++) {
if (row.id === this.delList[b].id) {
this.delList.splice(b, 1)
}
}
}
@@ -205,18 +219,24 @@
},
checkChange (row, type, c) {
if (this.checkBox) {
} else {
if (type) {
this.nodeList.push(row.id)
this.nodeList2.push(row.id)
this.delList.push(row)
} else {
for (let a = 0; a < this.nodeList.length; a ++) {
if (row.id === this.nodeList[a]) {
this.nodeList.splice(a, 1)
for (let a = 0; a < this.nodeList2.length; a++) {
if (row.id === this.nodeList2[a]) {
this.nodeList2.splice(a, 1)
}
}
for (let b = 0; b < this.delList.length; b++) {
if (row.id === this.delList[b].id) {
this.delList.splice(b, 1)
}
}
}
}
},
handleTreeDrawerCancel () {
this.filterText = ''
@@ -228,9 +248,9 @@
this.isVisible2 = false
this.$emit('checkedRole', this.roleList)
} else {
if (this.nodeList.length > 0 && this.nodeList[0].length !== 0) {
if (this.nodeList2.length > 0 && this.nodeList2[0].length !== 0) {
let ids = ''
this.nodeList.forEach(item => {
this.nodeList2.forEach(item => {
if (ids.length > 0) {
ids += ','
ids += item
@@ -295,10 +315,11 @@
watch: {
isVisible (val) {
this.isVisible2 = val
this.nodeList2 = this.nodeList
if (val) {
if (this.nodeList.length > 0 && this.nodeList[0].length !== 0) {
if (this.nodeList2.length > 0 && this.nodeList2[0].length !== 0) {
let ids = ''
this.nodeList.forEach(item => {
this.nodeList2.forEach(item => {
if (ids.length > 0) {
ids += ','
ids += item