role1.0
fanluyan 1 year ago
parent 9e2ad20c0b
commit ea73cb1a24

@ -88,7 +88,11 @@
<el-dropdown-item command="close">关闭GPS</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-button type="primary" @click="handlehistoryPic">
<el-button
type="primary"
@click="handlehistoryPic"
v-if="showhisButton('/realTimeSearch') && role !== 0"
>
历史图片</el-button
>
<el-button
@ -243,6 +247,7 @@ export default {
selectTowerId: "",
collectFlag: false, //
btnShowList: [],
menuList: [],
};
},
@ -263,11 +268,18 @@ export default {
return map;
}, {});
},
showButtonhisMap() {
return this.menuList.reduce((map, button) => {
map[button.key] = true; // key
return map;
}, {});
},
},
created() {
this.roleUser = localStorage.getItem("role");
console.log("asdsaddddddddddddddddddddddddd", this.roleUser);
this.btnShowList = JSON.parse(localStorage.getItem("btnPermission"));
this.menuList = JSON.parse(localStorage.getItem("menuPermission"));
console.log(this.btnShowList);
},
mounted() {
@ -278,6 +290,10 @@ export default {
showButton(key) {
return this.showButtonMap[key] || false;
},
//
showhisButton(key) {
return this.showButtonhisMap[key] || false;
},
//
handleDblClick(val) {
// alert(val);

@ -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)
);
// resourceIdmenuOptionIds
const filteredResources = this.checkedIds.filter((resource) =>
menuOptionIds.has(resource.resourceId)
);
// Set便id
const btnOptionIds = new Set(
this.btnCheckOption.map((option) => option.id)
);
// resourceIdmenuOptionIds
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 {

Loading…
Cancel
Save