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

@ -79,6 +79,7 @@ export default {
this.btnCheckOption = res.data.filter((item) => this.btnCheckOption = res.data.filter((item) =>
item.key.includes("Btn") item.key.includes("Btn")
); );
console.log(this.menuCheckOption, this.btnCheckOption);
this.getRolePermission(); this.getRolePermission();
} else { } else {
this.$message.error(res.msg); this.$message.error(res.msg);
@ -95,9 +96,29 @@ export default {
console.log(res); console.log(res);
this.checkedIds = res.data; this.checkedIds = res.data;
console.log(this.checkedIds); console.log(this.checkedIds);
this.checkedMenu = this.checkedIds.map((obj) => obj.resourceId);
this.checkedBtn = this.checkedIds.map((obj) => obj.resourceId); // Set便id
console.log("我时查询到的选中的值", this.checkedIds); 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; this.treeLoading = false;
} else { } else {

Loading…
Cancel
Save