|
@@ -298,25 +298,38 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
select(selection, row) {
|
|
|
+ const that = this;
|
|
|
if (
|
|
|
selection.some(el => {
|
|
|
return row.id === el.id;
|
|
|
})
|
|
|
) {
|
|
|
if (row.children) {
|
|
|
- row.children.map(j => {
|
|
|
- this.toggleSelection(j, true);
|
|
|
- });
|
|
|
+ loopRowChild(row.children,true);
|
|
|
+ // row.children.map(j => {
|
|
|
+ // this.toggleSelection(j, true);
|
|
|
+ // });
|
|
|
}
|
|
|
} else {
|
|
|
if (row.children) {
|
|
|
- row.children.map(j => {
|
|
|
- this.toggleSelection(j, false);
|
|
|
- });
|
|
|
+ // row.children.map(j => {
|
|
|
+ // this.toggleSelection(j, false);
|
|
|
+ // });
|
|
|
+ loopRowChild(row.children,false);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ function loopRowChild(rows,flag){
|
|
|
+ rows.map(item => {
|
|
|
+ if(item.children){
|
|
|
+ loopRowChild(item.children,flag)
|
|
|
+ }
|
|
|
+ that.toggleSelection(item, flag);
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
selectAll(selection) {
|
|
|
+ const that = this;
|
|
|
// tabledata第一层只要有在selection里面就是全选
|
|
|
const isSelect = selection.some(el => {
|
|
|
const tableDataIds = this.tableData.map(j => j.id);
|
|
@@ -327,21 +340,32 @@ export default {
|
|
|
const selectIds = selection.map(j => j.id);
|
|
|
return selectIds.includes(el.id);
|
|
|
});
|
|
|
+
|
|
|
+ function loopRowChild(rows,flag){
|
|
|
+ rows.map(item => {
|
|
|
+ if(item.children){
|
|
|
+ loopRowChild(item.children,flag)
|
|
|
+ }
|
|
|
+ that.toggleSelection(item, flag);
|
|
|
+ })
|
|
|
+ }
|
|
|
if (isSelect) {
|
|
|
selection.map(el => {
|
|
|
if (el.children) {
|
|
|
- el.children.map(j => {
|
|
|
- this.toggleSelection(j, true);
|
|
|
- });
|
|
|
+ // el.children.map(j => {
|
|
|
+ // this.toggleSelection(j, true);
|
|
|
+ // });
|
|
|
+ loopRowChild(el.children,true)
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
if (isCancel) {
|
|
|
this.tableData.map(el => {
|
|
|
if (el.children) {
|
|
|
- el.children.map(j => {
|
|
|
- this.toggleSelection(j, false);
|
|
|
- });
|
|
|
+ // el.children.map(j => {
|
|
|
+ // this.toggleSelection(j, false);
|
|
|
+ // });
|
|
|
+ loopRowChild(el.children,false)
|
|
|
}
|
|
|
});
|
|
|
}
|