592e603890384195420227063c51709f99201cf3.svn-base 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <div class="navbar">
  3. <div class="left-menu">
  4. <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
  5. <!-- <h3>设备管理系统</h3> -->
  6. </div>
  7. <div class="right-menu">
  8. <!-- <search id="header-search" class="right-menu-item" />-->
  9. <!--<screenfull id="screenfull" class="right-menu-item hover-effect" /> -->
  10. <!-- <el-dropdown id="news" class="avatar-container" trigger="click">
  11. <span class="right-menu-news">
  12. <svg-icon class="right-menu-news-icon" :icon-class="'icon-news'" />
  13. <i class="right-menu-news-right">{{ sumAmount }}</i>
  14. </span>
  15. <el-dropdown-menu slot="dropdown" class="user-dropdown">
  16. <div class="newsTitle" style="padding-left: 10px">
  17. 消息通知
  18. </div>
  19. <el-dropdown-item v-for="(item,index) in meslist" :key="index" divided>
  20. <span style="display:block;" @click="clickList(item)"><span style="margin-right:30px;">{{ item.remark }}</span><span style="float:right;">{{ item.mesTime }}</span></span>
  21. </el-dropdown-item>
  22. <router-link to="/console/News">
  23. <el-dropdown-item style="text-align:center;margin-top:10px;">
  24. 查看全部
  25. </el-dropdown-item>
  26. </router-link>
  27. </el-dropdown-menu>
  28. </el-dropdown> -->
  29. <el-dropdown class="avatar-container" trigger="click">
  30. <div class="avatar-wrapper">
  31. <!-- <img src="@/assets/cow.jpg" class="user-avatar"> -->
  32. <span style="font-size:12px;">欢迎您,{{ employename }}</span>
  33. <i class="el-icon-caret-bottom" />
  34. </div>
  35. <el-dropdown-menu slot="dropdown" class="user-dropdown">
  36. <router-link to="/">
  37. <el-dropdown-item>
  38. 主页
  39. </el-dropdown-item>
  40. </router-link>
  41. <el-dropdown-item divided>
  42. <span style="display:block;" @click="logout">注销</span>
  43. </el-dropdown-item>
  44. <router-link to="/console/Changpwd">
  45. <el-dropdown-item>
  46. 修改密码
  47. </el-dropdown-item>
  48. </router-link>
  49. </el-dropdown-menu>
  50. </el-dropdown>
  51. </div>
  52. </div>
  53. </template>
  54. <script>
  55. // import { GetDataByName } from '@/api/common'
  56. import { mapGetters } from 'vuex'
  57. import Hamburger from '@/components/Hamburger'
  58. // import Screenfull from '@/components/Screenfull'
  59. // import Search from '@/components/HeaderSearch'
  60. // import path from 'path'
  61. // import Cookies from 'js-cookie'
  62. export default {
  63. components: {
  64. Hamburger
  65. // Screenfull,
  66. // Search
  67. },
  68. data() {
  69. return {
  70. sumAmount: '',
  71. meslist: ''
  72. }
  73. },
  74. computed: {
  75. ...mapGetters([
  76. 'sidebar',
  77. 'avatar',
  78. 'employename',
  79. 'employeid',
  80. 'pastureid',
  81. 'departmentid',
  82. 'sumamount'
  83. ])
  84. },
  85. created() {
  86. // window.setInterval(() => {
  87. // setTimeout(() => {
  88. // this.sumAmount = JSON.parse(sessionStorage.sumamount)
  89. // this.meslist = JSON.parse(sessionStorage.meslist)
  90. // }, 0)
  91. // }, 100)
  92. },
  93. methods: {
  94. toggleSideBar() {
  95. this.$store.dispatch('app/toggleSideBar')
  96. },
  97. async logout() {
  98. await this.$store.dispatch('user/logout')
  99. this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {
  100. this.$router.push(`/login}`) // 跳转到主页
  101. })
  102. // this.$router.push(`/login?redirect=${this.$route.fullPath}`) //跳转到登陆前页面
  103. }
  104. // 点击消息列表跳转
  105. // clickList(val) {
  106. // var regex1 = /\【(.+?)\】/g
  107. // var value = (val.remark).match(regex1)[0]
  108. // var routerName = value.substring(1, value.length - 1)
  109. // if (routerName === '合同审核') {
  110. // this.$router.push('/customs/Contract')
  111. // } else if (routerName === '申购审核') {
  112. // this.$router.push('/customs/Subscribe')
  113. // } else if (routerName === '采购配单') {
  114. // this.$router.push('/customs/Purchase')
  115. // } else if (routerName === '领用审核') {
  116. // this.$router.push('/customs/Receive')
  117. // } else if (routerName === '退货审核') {
  118. // this.$router.push('/customs/Returngoods')
  119. // } else if (routerName === '设备审核') {
  120. // this.$router.push({ path: '/asset/Basics', query: { tabName: 'second' }})
  121. // } else if (routerName === '设备保养' || routerName === '保养审核') {
  122. // this.$router.push('/maintenance/Maintain')
  123. // } else if (routerName === '维修接单' || routerName === '维修派单' || routerName === '维修审核') {
  124. // this.$router.push('/maintenance/Repair')
  125. // } else if (routerName === '备件审核') {
  126. // this.$router.push({ path: '/customs/Basic', query: { tabName: 'second' }})
  127. // } else if (routerName === '配单审核') {
  128. // this.$router.push({ path: '/customs/Purchase', query: { activeName: 'fouth' }})
  129. // }
  130. // }
  131. }
  132. }
  133. </script>
  134. <style lang="scss" scoped>
  135. .navbar {
  136. height: 50px;
  137. overflow: hidden;
  138. position: relative;
  139. background: #fff;
  140. box-shadow: 0 1px 4px rgba(0,21,41,.08);
  141. .hamburger-container {
  142. line-height: 46px;
  143. height: 100%;
  144. float: left;
  145. cursor: pointer;
  146. transition: background .3s;
  147. -webkit-tap-highlight-color:transparent;
  148. &:hover {
  149. background: rgba(0, 0, 0, .025)
  150. }
  151. }
  152. h3{
  153. margin-top: 13px;
  154. }
  155. .breadcrumb-container {
  156. float: left;
  157. }
  158. .right-menu {
  159. float: right;
  160. height: 100%;
  161. line-height: 50px;
  162. &:focus {
  163. outline: none;
  164. }
  165. .right-menu-item {
  166. display: inline-block;
  167. padding: 0 8px;
  168. height: 100%;
  169. font-size: 18px;
  170. color: #5a5e66;
  171. vertical-align: text-bottom;
  172. &.hover-effect {
  173. cursor: pointer;
  174. transition: background .3s;
  175. &:hover {
  176. background: rgba(0, 0, 0, .025)
  177. }
  178. }
  179. }
  180. .avatar-container {
  181. margin-right: 30px;
  182. .avatar-wrapper {
  183. margin-top: 5px;
  184. position: relative;
  185. .user-avatar {
  186. cursor: pointer;
  187. width: 40px;
  188. height: 40px;
  189. border-radius: 10px;
  190. }
  191. .el-icon-caret-bottom {
  192. cursor: pointer;
  193. position: absolute;
  194. right: -20px;
  195. top: 18px;
  196. font-size: 12px;
  197. }
  198. }
  199. }
  200. .right-menu-news{
  201. margin-right:25px;
  202. position:relative;
  203. .right-menu-news-icon{
  204. display:block;
  205. float:left;
  206. width:25px;
  207. height:40px;
  208. }
  209. .right-menu-news-right{
  210. display:block;
  211. width:20px;
  212. height:20px;
  213. float:left;
  214. border-radius: 10px;
  215. background:red;
  216. font-style:normal;
  217. position:absolute;
  218. right:-12px;
  219. bottom:25px;
  220. font-weight: 300;
  221. font-size:12px ;
  222. line-height: 20px;
  223. text-align:center;
  224. color:#fff;
  225. }
  226. }
  227. }
  228. }
  229. </style>
  230. <style lang="scss" >
  231. .user-dropdown{
  232. top: 40px!important;
  233. }
  234. </style>