123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <template>
- <div :class="{ 'has-logo': showLogo }">
- <logo v-if="showLogo" :collapse="isCollapse" />
- <el-scrollbar wrap-class="scrollbar-wrapper">
- <el-menu
- class="navMenu"
- :default-active="activeMenu"
- :collapse="isCollapse"
- :background-color="variables.menusBg"
- :text-color="variables.menuText"
- :unique-opened="false"
- :active-text-color="variables.menuActiveText"
- :collapse-transition="false"
- mode="vertical"
- >
- <sidebar-item
- v-for="(route, index) in permission_routes"
- :key="index"
- :item="route"
- :base-path="route.path"
- :leup="leup"
- />
- </el-menu>
- </el-scrollbar>
- </div>
- </template>
- <script>
- import { mapGetters } from "vuex";
- import Logo from "./Logo";
- import SidebarItem from "./SidebarItem";
- import variables from "@/styles/variables.scss";
- export default {
- props: {
- // route object
- leup: {
- type: Boolean,
- default: false,
- },
- },
- components: { SidebarItem, Logo },
- computed: {
- ...mapGetters(["sidebar", "permission_routes"]),
- routes() {
- const power =
- typeof this.userPowerList == "string"
- ? JSON.parse(this.userPowerList)
- : this.userPowerList;
- return power;
- // const datas = this.$router.options.routes;
- // const arrs = [];
- // const menus = [];
- // if (power && power.length) {
- // for (const item of datas) {
- // if (item.meta) {
- // arrs.push(item);
- // }
- // }
- // arrs.forEach(item => {
- // power.forEach(p => {
- // if (item.meta.isModule == p) {
- // menus.push(item);
- // }
- // })
- // })
- // return menus;
- // } else {
- // return datas;
- // }
- },
- activeMenu() {
- const route = this.$route;
- const { meta, path } = route;
- // if set path, the sidebar will highlight the path you set
- if (meta.activeMenu) {
- return meta.activeMenu;
- }
- return path;
- },
- showLogo() {
- return this.$store.state.settings.sidebarLogo;
- },
- variables() {
- return variables;
- },
- isCollapse() {
- return !this.sidebar.opened;
- },
- },
- watch: {
- leup() {
- console.log(this.leup);
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- ::v-deep .navMenu {
- .router-link-active {
- .account {
- background: url("../../../assets/nav/ic_list_nav_account_check.png")
- no-repeat;
- }
- .role {
- background: url("../../../assets/nav/ic_list_nav_character_check.png")
- no-repeat;
- }
- .authority {
- background: url("../../../assets/nav/ic_list_nav_permissions_check.png")
- no-repeat;
- }
- .transfer {
- background: url("../../../assets/nav/ic_list_nav_transit_check.png")
- no-repeat;
- }
- .arrival {
- background: url("../../../assets/nav/ic_list_nav_arrive_check.png")
- no-repeat;
- }
- .departure {
- background: url("../../../assets/nav/ic_list_nav_leave_check.png")
- no-repeat;
- }
- .dataCollection {
- background: url("../../../assets/nav/ic_data_collection_check.png")
- no-repeat;
- }
- .dataParser {
- background: url("../../../assets/nav/ic_data_governance_check .png")
- no-repeat;
- }
- .dataStore {
- background: url("../../../assets/nav/ic_data_save_check.png") no-repeat;
- }
- .dashboard {
- background: url("../../../assets/nav/ic_setting_nav_check.png") no-repeat;
- }
- .advance {
- background: url("../../../assets/nav/ic_list_nav_search_check.png")
- no-repeat;
- }
- .integration {
- background: url("../../../assets/nav/ic_data_governance_check .png")
- no-repeat;
- }
- .protocol {
- background: url("../../../assets/nav/ic_list_nav_agreement_check.png")
- no-repeat;
- }
- .deployNode {
- background: url("../../../assets/nav/ic_list_nav_node_check.png")
- no-repeat;
- }
- .sourceDataItem {
- background: url("../../../assets/nav/ic_list_nav_source_check.png")
- no-repeat;
- }
- }
- }
- </style>
|