|
|
|
@ -79,6 +79,7 @@ export default {
|
|
|
|
|
this.btnCheckOption = res.data.filter((item) =>
|
|
|
|
|
item.key.includes("Btn")
|
|
|
|
|
);
|
|
|
|
|
console.log(this.menuCheckOption, this.btnCheckOption);
|
|
|
|
|
this.getRolePermission();
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error(res.msg);
|
|
|
|
@ -95,9 +96,29 @@ export default {
|
|
|
|
|
console.log(res);
|
|
|
|
|
this.checkedIds = res.data;
|
|
|
|
|
console.log(this.checkedIds);
|
|
|
|
|
this.checkedMenu = this.checkedIds.map((obj) => obj.resourceId);
|
|
|
|
|
this.checkedBtn = this.checkedIds.map((obj) => obj.resourceId);
|
|
|
|
|
console.log("我时查询到的选中的值", this.checkedIds);
|
|
|
|
|
|
|
|
|
|
// 创建一个Set,以便快速检查id是否存在
|
|
|
|
|
const menuOptionIds = new Set(
|
|
|
|
|
this.menuCheckOption.map((option) => option.id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 过滤资源数组,只保留那些其resourceId存在于menuOptionIds中的项
|
|
|
|
|
const filteredResources = this.checkedIds.filter((resource) =>
|
|
|
|
|
menuOptionIds.has(resource.resourceId)
|
|
|
|
|
);
|
|
|
|
|
// 创建一个Set,以便快速检查id是否存在
|
|
|
|
|
const btnOptionIds = new Set(
|
|
|
|
|
this.btnCheckOption.map((option) => option.id)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 过滤资源数组,只保留那些其resourceId存在于menuOptionIds中的项
|
|
|
|
|
const filteredBtnResources = this.checkedIds.filter((resource) =>
|
|
|
|
|
btnOptionIds.has(resource.resourceId)
|
|
|
|
|
);
|
|
|
|
|
console.log(filteredResources, filteredBtnResources);
|
|
|
|
|
this.checkedMenu = filteredResources.map((obj) => obj.resourceId);
|
|
|
|
|
this.checkedBtn = filteredBtnResources.map((obj) => obj.resourceId);
|
|
|
|
|
// console.log("我时查询到的选中的值", this.checkedIds);
|
|
|
|
|
|
|
|
|
|
this.treeLoading = false;
|
|
|
|
|
} else {
|
|
|
|
|