| | |
| | | <template> |
| | | <div class="navbar"> |
| | | <hamburger |
| | | :is-active="sidebar.opened" |
| | | class="hamburger-container" |
| | | @toggleClick="toggleSideBar" |
| | | /> |
| | | <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> |
| | | |
| | | <breadcrumb class="breadcrumb-container" /> |
| | | <!-- 固定右上角 --> |
| | |
| | | <el-dropdown trigger="click" ref="eldrop" style="margin-right: 20px"> |
| | | <div class="avatar-wrapper" style="font-size: 20px"> |
| | | {{ selectStaff ? selectStaff.org.name : "" }}-{{ |
| | | selectStaff ? selectStaff.sysRole.name : "" |
| | | selectStaff && selectStaff.sysRole ? selectStaff.sysRole.name : "" |
| | | }} |
| | | <i class="el-icon-caret-bottom"></i> |
| | | </div> |
| | | <el-dropdown-menu slot="dropdown" align="center"> |
| | | <el-dropdown-item |
| | | v-for="item in staffs" |
| | | @click.native="changeStaff(item)" |
| | | :key="item.id" |
| | | > |
| | | {{ item ? item.org.name : "" }}-{{ item ? item.sysRole.name : "" }} |
| | | <el-dropdown-item v-for="item in staffs" @click.native="changeStaff(item)" :key="item.id"> |
| | | {{ item ? item.org.name : "" }}-{{ item && item.sysRole ? item.sysRole.name : "" }} |
| | | </el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | |
| | | // await this.$store.dispatch('user/logout') |
| | | this.$router.push(`/login`); |
| | | }, |
| | | loadStaffs() { |
| | | const selectStaff = JSON.parse(localStorage.getItem("selectStaff")); |
| | | if (selectStaff) { |
| | | this.selectStaff = selectStaff; |
| | | } |
| | | const staffs = JSON.parse(localStorage.getItem("staffs")); |
| | | |
| | | console.log('Navbar-created'); |
| | | if (staffs) { |
| | | this.staffs = staffs; |
| | | } |
| | | }, |
| | | beforeCreate() { |
| | | const user = JSON.parse(localStorage.getItem("user")); |
| | |
| | | this.$router.push(`/login`); |
| | | } |
| | | }, |
| | | }, |
| | | created() { |
| | | const selectStaff = JSON.parse(localStorage.getItem("selectStaff")); |
| | | if (selectStaff) { |
| | | this.selectStaff = selectStaff; |
| | | } |
| | | const staffs = JSON.parse(localStorage.getItem("staffs")); |
| | | if (staffs) { |
| | | this.staffs = staffs; |
| | | } |
| | | this.loadStaffs(); |
| | | }, |
| | | mounted() { |
| | | this.$EventBus.$on("updateStaffs", (data) => { |
| | | |
| | | this.loadStaffs(); |
| | | }); |
| | | }, |
| | | }; |
| | | </script> |
| | |
| | | } |
| | | |
| | | .el-dropdown-menu { |
| | | max-height: 400px; /*设置菜单高度为200px*/ |
| | | overflow-y: auto; /*设置滚动条*/ |
| | | max-height: 400px; |
| | | /*设置菜单高度为200px*/ |
| | | overflow-y: auto; |
| | | /*设置滚动条*/ |
| | | } |
| | | </style> |