|
@@ -486,10 +486,13 @@ export default {
|
|
handleSelectionChange(val, index) {
|
|
handleSelectionChange(val, index) {
|
|
let obj = this.newObj;
|
|
let obj = this.newObj;
|
|
let numberIndex;
|
|
let numberIndex;
|
|
|
|
+ console.log(this.num);
|
|
|
|
+ //如果返回来的数组为空,那么就是这个list全部取消
|
|
if (val.length === 0) {
|
|
if (val.length === 0) {
|
|
let newArray = _.differenceWith(this.selected, this.list[index].split, _.isEqual);
|
|
let newArray = _.differenceWith(this.selected, this.list[index].split, _.isEqual);
|
|
this.$set(this, `selected`, newArray);
|
|
this.$set(this, `selected`, newArray);
|
|
} else {
|
|
} else {
|
|
|
|
+ //正常取消,除了全部取消的情况
|
|
if (this.num === false) {
|
|
if (this.num === false) {
|
|
numberIndex = _.findIndex(this.selected, function(o) {
|
|
numberIndex = _.findIndex(this.selected, function(o) {
|
|
return o._id == obj._id;
|
|
return o._id == obj._id;
|
|
@@ -503,8 +506,11 @@ export default {
|
|
this.$set(this, `selected`, newData);
|
|
this.$set(this, `selected`, newData);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ console.log(this.selected);
|
|
},
|
|
},
|
|
onTableSelect(selection, row) {
|
|
onTableSelect(selection, row) {
|
|
|
|
+ //判断是选中还是取消商品,num为true是选中,为false的时候是取消
|
|
|
|
+ //取消没了的时候selection.length为0,num也就是0
|
|
this.num = selection.length && selection.indexOf(row) !== -1;
|
|
this.num = selection.length && selection.indexOf(row) !== -1;
|
|
this.newObj = row;
|
|
this.newObj = row;
|
|
},
|
|
},
|