权限全选按钮

This commit is contained in:
hyt 2024-05-07 15:05:05 +08:00
parent 50bd83e85c
commit 97e527fc0b
3 changed files with 95 additions and 0 deletions

View File

@ -230,6 +230,7 @@ export default {
},
},
methods: {
//
clickFirst() {
document.querySelectorAll(".is-focusable")[0].click();
},

View File

@ -180,7 +180,54 @@ export default {
})
},
handleSelectionChange(val, row) {
// row.check = !row.check
this.multipleSelection = val;
let data = this.treeToArray([row]);
this.childNode = !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) {

View File

@ -180,7 +180,54 @@ export default {
})
},
handleSelectionChange(val, row) {
// row.check = !row.check
this.multipleSelection = val;
let data = this.treeToArray([row]);
this.childNode = !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) {