Commit fcf571c7 authored by jiaxu.yan's avatar jiaxu.yan

feat: 关联勾选

parent b5d1bdbf
...@@ -100,18 +100,16 @@ export default { ...@@ -100,18 +100,16 @@ export default {
} }
} }
}) })
console.log(this.model.list)
this.model.value = old this.model.value = old
}, },
removeItem(array, item) {
checkOne(i, e) { let arr = []
if (this.merge) { array.map(i => {
this.$emit('mergeVal', { if (i !== item) {
name: e, arr.push(i)
flag: i.flag ? i.flag.split(',') : [] }
}) })
} return arr
}, },
input(val) { input(val) {
let arr = [] let arr = []
......
...@@ -136,11 +136,17 @@ export default { ...@@ -136,11 +136,17 @@ export default {
} }
} }
}) })
console.log(this.model.list)
this.model.value = old this.model.value = old
}, },
removeItem(array, item) {
let arr = []
array.map(i => {
if (i !== item) {
arr.push(i)
}
})
return arr
},
checkOne(i, e) { checkOne(i, e) {
if (this.merge) { if (this.merge) {
this.$emit('mergeVal', { this.$emit('mergeVal', {
......
...@@ -70,29 +70,35 @@ export default { ...@@ -70,29 +70,35 @@ export default {
return return
} }
let old = this.value || [] let old = this.value || []
this.items.options.map(i => { if (this.prop == 'chcek2' || this.prop == 'chcek0') {
if (name) { this.items.options.map(i => {
if (Array.isArray(old) && flag.includes(String(i.id))) { if (name) {
old.push(i.id) if (Array.isArray(old) && flag.includes(String(i.id))) {
} old.push(i.id)
} else { }
if (flag.includes(String(i.id))) { } else {
old = this.removeItem(old, i.id) || [] if (flag.includes(String(i.id))) {
console.log(i.id)
old = this.removeItem(old, i.id) || []
}
} }
} })
}) }
this.value = old this.value = old
}, },
removeItem(array, item) { removeItem(array, item) {
const index = array.indexOf(item) let arr = []
if (index !== -1) { array.map(i => {
array.splice(index, 1) if (i !== item) {
} arr.push(i)
}
})
return arr
}, },
checkOne(i, e) { checkOne(i, e) {
if (this.merge) { if (this.merge) {
this.$emit('mergeVal', { this.$emit('mergeVal', {
name: e, name: e,
......
...@@ -117,10 +117,13 @@ export default { ...@@ -117,10 +117,13 @@ export default {
}, },
removeItem(array, item) { removeItem(array, item) {
const index = array.indexOf(item) let arr = []
if (index !== -1) { array.map(i => {
array.splice(index, 1) if (i !== item) {
} arr.push(i)
}
})
return arr
}, },
checkOne(i, e) { checkOne(i, e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment