权限全选按钮
This commit is contained in:
parent
50bd83e85c
commit
97e527fc0b
|
@ -230,6 +230,7 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
//选中第一个
|
||||||
clickFirst() {
|
clickFirst() {
|
||||||
document.querySelectorAll(".is-focusable")[0].click();
|
document.querySelectorAll(".is-focusable")[0].click();
|
||||||
},
|
},
|
||||||
|
|
|
@ -180,7 +180,54 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleSelectionChange(val, row) {
|
handleSelectionChange(val, row) {
|
||||||
|
// row.check = !row.check
|
||||||
|
this.multipleSelection = val;
|
||||||
|
let data = this.treeToArray([row]);
|
||||||
|
this.childNode = !row.check;
|
||||||
row.check = !row.check
|
row.check = !row.check
|
||||||
|
if (data.length > 1) {
|
||||||
|
data.forEach((el, index) => {
|
||||||
|
el.check = this.childNode
|
||||||
|
this.$refs.multipleTable.toggleRowSelection(el, this.childNode);
|
||||||
|
});
|
||||||
|
let ids = data[0].id;
|
||||||
|
let arr = this.treeFindPath(
|
||||||
|
this.menuDatas,
|
||||||
|
(data) => data.id == ids,
|
||||||
|
"id"
|
||||||
|
);
|
||||||
|
arr = arr.splice(0, arr.length - 1);
|
||||||
|
let dataList = [];
|
||||||
|
let allList = this.treeToArray(this.menuDatas);
|
||||||
|
allList.forEach((el, index) => {
|
||||||
|
if (arr.includes(el.id)) {
|
||||||
|
dataList.push(el);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dataList.forEach((el, index) => {
|
||||||
|
el.check = true
|
||||||
|
this.$refs.multipleTable.toggleRowSelection(el, true);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let ids = data[0].id;
|
||||||
|
let arr = this.treeFindPath(
|
||||||
|
this.menuDatas,
|
||||||
|
(data) => data.id == ids,
|
||||||
|
"id"
|
||||||
|
);
|
||||||
|
arr = arr.splice(0, arr.length - 1);
|
||||||
|
let dataList = [];
|
||||||
|
let allList = this.treeToArray(this.menuDatas);
|
||||||
|
allList.forEach((el, index) => {
|
||||||
|
if (arr.includes(el.id)) {
|
||||||
|
dataList.push(el);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dataList.forEach((el, index) => {
|
||||||
|
el.check=true
|
||||||
|
this.$refs.multipleTable.toggleRowSelection(el, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 默认选中
|
// 默认选中
|
||||||
exhibitList(menu, list, id) {
|
exhibitList(menu, list, id) {
|
||||||
|
|
|
@ -180,7 +180,54 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleSelectionChange(val, row) {
|
handleSelectionChange(val, row) {
|
||||||
|
// row.check = !row.check
|
||||||
|
this.multipleSelection = val;
|
||||||
|
let data = this.treeToArray([row]);
|
||||||
|
this.childNode = !row.check;
|
||||||
row.check = !row.check
|
row.check = !row.check
|
||||||
|
if (data.length > 1) {
|
||||||
|
data.forEach((el, index) => {
|
||||||
|
el.check = this.childNode
|
||||||
|
this.$refs.multipleTable.toggleRowSelection(el, this.childNode);
|
||||||
|
});
|
||||||
|
let ids = data[0].id;
|
||||||
|
let arr = this.treeFindPath(
|
||||||
|
this.menuDatas,
|
||||||
|
(data) => data.id == ids,
|
||||||
|
"id"
|
||||||
|
);
|
||||||
|
arr = arr.splice(0, arr.length - 1);
|
||||||
|
let dataList = [];
|
||||||
|
let allList = this.treeToArray(this.menuDatas);
|
||||||
|
allList.forEach((el, index) => {
|
||||||
|
if (arr.includes(el.id)) {
|
||||||
|
dataList.push(el);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dataList.forEach((el, index) => {
|
||||||
|
el.check = true
|
||||||
|
this.$refs.multipleTable.toggleRowSelection(el, true);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
let ids = data[0].id;
|
||||||
|
let arr = this.treeFindPath(
|
||||||
|
this.menuDatas,
|
||||||
|
(data) => data.id == ids,
|
||||||
|
"id"
|
||||||
|
);
|
||||||
|
arr = arr.splice(0, arr.length - 1);
|
||||||
|
let dataList = [];
|
||||||
|
let allList = this.treeToArray(this.menuDatas);
|
||||||
|
allList.forEach((el, index) => {
|
||||||
|
if (arr.includes(el.id)) {
|
||||||
|
dataList.push(el);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dataList.forEach((el, index) => {
|
||||||
|
el.check=true
|
||||||
|
this.$refs.multipleTable.toggleRowSelection(el, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 默认选中
|
// 默认选中
|
||||||
exhibitList(menu, list, id) {
|
exhibitList(menu, list, id) {
|
||||||
|
|
Loading…
Reference in New Issue