0%
树形选项点击主项子项默认全选
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| carSelectedChange(val, row) { this.responseData.carInfo.map((car) => { if (val.find((x) => x.accCarSeq == car.accCarSeq)) { car.checked = true; } else { car.checked = false; }
if (car.children) { car.children.map((p) => { if (val.find((x) => x.accCarSeq == p.accCarSeq)) { p.checked = true; } else { p.checked = false; } }); } });
if (row) { let action = "";
if (val.find((x) => x.accCarSeq == row.accCarSeq)) { action = "add"; } else { action = "remove"; } let carIndex = this.responseData.carInfo.findIndex( (car) => car.accCarSeq == row.accCarSeq );
if (carIndex >= 0) { this.responseData.carInfo[carIndex].children.map((p) => { p.checked = action == "add"; this.$refs.carTable.toggleRowSelection(p, action == "add"); }); } else { this.responseData.carInfo.map((car) => { car.children.map((p) => { if (p.accCarSeq == row.accCarSeq && action == "add") { car.checked = true; this.$refs.carTable.toggleRowSelection(car, true); } }); }); } } else { this.responseData.carInfo.map((car) => { car.children.map((p) => { p.checked = car.checked; this.$refs.carTable.toggleRowSelection(p, p.checked); }); }); } },
|