|
|
|
@ -168,19 +168,33 @@ |
|
|
|
|
const item = this.list[i] |
|
|
|
|
const { id, productType } = item |
|
|
|
|
const include = checked.findIndex(e => e.id === id && e.productType === productType) |
|
|
|
|
console.log(11, this.list, e, i) |
|
|
|
|
// 选中的情况下,该产品如果没有push到已选数组里,则push |
|
|
|
|
if (e.detail.value.length) { |
|
|
|
|
include === -1 && checked.push(item) |
|
|
|
|
} else { |
|
|
|
|
// 取消选中的情况下,如果已选数组里存在该产品,则移除 |
|
|
|
|
include === -1 || checked.splice(include, 1) |
|
|
|
|
if (include !== -1) { |
|
|
|
|
checked.splice(include, 1) |
|
|
|
|
this.checkAll = [] |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 全选 |
|
|
|
|
allChange(e) { |
|
|
|
|
const checked = !!e.detail.value.length |
|
|
|
|
this.list.map(e => e.check = checked ? [1] : []) // 选中则为[1],取消选中为[] |
|
|
|
|
const isCheck = !!e.detail.value.length // 是否选中 |
|
|
|
|
const { checked, list } = this |
|
|
|
|
list.map(e => { |
|
|
|
|
e.check = isCheck ? 1 : 0 |
|
|
|
|
const { id, productType } = e |
|
|
|
|
const include = checked.findIndex(n => n.id === id && n.productType === productType) |
|
|
|
|
// 选中的情况下,该产品如果没有push到已选数组里,则push |
|
|
|
|
if (isCheck) { |
|
|
|
|
include === -1 && checked.push(e) |
|
|
|
|
} else { |
|
|
|
|
// 取消选中的情况下,如果已选数组里存在该产品,则移除 |
|
|
|
|
include === -1 || checked.splice(include, 1) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 生成产品参数 |
|
|
|
|
createParam(e) { |
|
|
|
|