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