Navbar.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. <template>
  2. <div class="navbar">
  3. <!-- <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> -->
  4. <!-- <breadcrumb class="breadcrumb-container" /> -->
  5. <div class="navbar_top">
  6. <div class="nav_left">
  7. <!-- <div class="log_icon">
  8. <el-avatar :size="24" :src="imgSrc" @error="errorHandler">
  9. <img src="@/assets/logo/error.png" />
  10. </el-avatar>
  11. </div> -->
  12. <!-- <div class="dividing"></div> -->
  13. <div class="log_name">{{ pageTitle }}</div>
  14. </div>
  15. <div class="right-menu">
  16. <el-dropdown>
  17. <div class="user">
  18. <img class="head-icon-img" src="../../assets/status/ic_user.png" alt="" />
  19. <span class="name">{{ name }}</span>
  20. <i class="el-icon-arrow-down el-icon--right"></i>
  21. </div>
  22. <el-dropdown-menu class="handleMsgMneu" slot="dropdown">
  23. <el-dropdown-item v-if="name != '匿名用户'">
  24. <span class="editPwd" @click="dialogPwd">修改密码</span>
  25. </el-dropdown-item>
  26. <el-dropdown-item>
  27. <span @click="exitDialog" class="layoutSys">退出登录</span>
  28. </el-dropdown-item>
  29. </el-dropdown-menu>
  30. </el-dropdown>
  31. <el-dropdown>
  32. <el-button class="btn-help" plain>帮助</el-button>
  33. <el-dropdown-menu class="handleMsgMneu" slot="dropdown">
  34. <el-dropdown-item>
  35. <div class="handleMsgMneu-item">
  36. <span class="editPwd">行李全流程跟踪数据系统-用户使用手册V2.1</span>
  37. <span>
  38. <el-button @click="lookFile('行李全流程跟踪数据系统-用户使用手册V2.1.docx')" type="text">查看</el-button>
  39. <el-button @click="downFile('行李全流程跟踪数据系统-用户使用手册V2.1.docx')" type="text">下载</el-button>
  40. </span>
  41. </div>
  42. </el-dropdown-item>
  43. <el-dropdown-item>
  44. <div class="handleMsgMneu-item">
  45. <span class="editPwd">行李跟踪航站清单</span>
  46. <span>
  47. <el-button @click="lookFile('行李跟踪航站清单(2024年7月).xlsx')" type="text">查看</el-button>
  48. <el-button @click="downFile('行李跟踪航站清单(2024年7月).xlsx')" type="text">下载</el-button>
  49. </span>
  50. </div>
  51. </el-dropdown-item>
  52. <el-dropdown-item>
  53. <div class="handleMsgMneu-item">
  54. <span class="editPwd">行李全流程跟踪数据系统账号申请表</span>
  55. <span>
  56. <!-- <el-button @click="lookFile('行李全流程跟踪数据系统账号申请.doc')" type="text">查看</el-button> -->
  57. <el-button @click="downFile('行李全流程跟踪数据系统账号申请.doc')" type="text">下载</el-button>
  58. </span>
  59. </div>
  60. </el-dropdown-item>
  61. <el-dropdown-item>
  62. <div class="handleMsgMneu-item">
  63. <span class="editPwd">行李全流程跟踪数据系统管理规程</span>
  64. <span>
  65. <el-button @click="lookFile('行李全流程跟踪数据系统管理规程.pdf')" type="text">查看</el-button>
  66. <el-button @click="downFile('行李全流程跟踪数据系统管理规程.pdf')" type="text">下载</el-button>
  67. </span>
  68. </div>
  69. </el-dropdown-item>
  70. <el-dropdown-item>
  71. <div class="handleMsgMneu-item">
  72. <span class="editPwd">航站三字码对应表</span>
  73. <span>
  74. <el-button @click="lookFile('航站三字码对应表.xlsx')" type="text">查看</el-button>
  75. <el-button @click="downFile('航站三字码对应表.xlsx')" type="text">下载</el-button>
  76. </span>
  77. </div>
  78. </el-dropdown-item>
  79. </el-dropdown-menu>
  80. </el-dropdown>
  81. <!-- <div class="seting">
  82. <span @click="toSystem" class="img-icon"></span>
  83. </div> -->
  84. <!-- <div class="lock">
  85. <span @click="dialogPwd" class="img-icon"></span>
  86. </div>
  87. <div class="exit">
  88. <span @click="exitDialog" class="img-icon"></span>
  89. </div> -->
  90. </div>
  91. </div>
  92. <div class="navbar_lower" :class="isSidebar ? 'hide_navbar_lower' : ''" id="navbar_lowers">
  93. <el-breadcrumb separator-class="el-icon-arrow-right">
  94. <el-breadcrumb-item v-for="(item, index) in breadList" :key="index" :to="index < breadList.length -1 ? item.path : undefined">
  95. <span>{{ item.meta.title }}</span>
  96. </el-breadcrumb-item>
  97. </el-breadcrumb>
  98. <!-- <tags-view /> -->
  99. <div class="newdata">{{ newData }}</div>
  100. </div>
  101. </div>
  102. </template>
  103. <script>
  104. import { mapGetters } from 'vuex'
  105. import Breadcrumb from '@/components/Breadcrumb'
  106. import Hamburger from '@/components/Hamburger'
  107. // import { Format } from "../../config/util";
  108. import { timeInZone } from '@/utils/table'
  109. // import TagsView from "./TagsView";
  110. export default {
  111. props: ['logstart'],
  112. data () {
  113. return {
  114. newData: '',
  115. breadList: this.getBreadcrumb(),
  116. getTimeInterval: null,
  117. imgSrc: window.location.origin + sessionStorage.getItem('appLog'),
  118. pageTitle: sessionStorage.getItem('appName'),
  119. name: sessionStorage.getItem('userName')
  120. }
  121. },
  122. components: {
  123. Breadcrumb,
  124. Hamburger
  125. // TagsView,
  126. },
  127. watch: {
  128. $route (val) {
  129. this.breadList = this.getBreadcrumb()
  130. }
  131. },
  132. computed: {
  133. ...mapGetters(['sidebar', 'avatar', 'timeZone']),
  134. isSidebar () {
  135. return !this.sidebar.opened
  136. }
  137. },
  138. mounted () {
  139. this.getTimeInterval = setInterval(() => {
  140. // this.newData = Format("yyyy/MM/dd hh:mm:ss", new Date());
  141. this.newData = timeInZone(new Date(), this.timeZone).replaceAll('-', '/')
  142. })
  143. },
  144. beforeDestroy () {
  145. this.getTimeInterval && clearInterval(this.getTimeInterval)
  146. this.getTimeInterval = null
  147. },
  148. methods: {
  149. errorHandler () {
  150. return true
  151. },
  152. toggleSideBar () {
  153. this.$store.dispatch('app/toggleSideBar')
  154. },
  155. async logout () {
  156. await this.$store.dispatch('user/logout')
  157. this.$router.push(`/login?redirect=${this.$route.fullPath}`)
  158. },
  159. getBreadcrumb () {
  160. return this.$route.matched.filter(item => item.name && item.meta.title)
  161. },
  162. //修改密码
  163. dialogPwd () {
  164. this.$store.dispatch('app/togglePwdflag', true)
  165. },
  166. //退出系统-弹框
  167. exitDialog () {
  168. this.$store.dispatch('app/toggleOutflag', true)
  169. },
  170. //查看
  171. lookFile (fileName) {
  172. this.$router.push({
  173. path: "/preview",
  174. query: { fileName },
  175. })
  176. },
  177. //下载
  178. downFile (fileName) {
  179. const a = document.createElement('a')
  180. // 给a标签的href属性值加上地址,注意:这里是绝对路径,不用加 点.
  181. a.href = './' + fileName
  182. // 设置下载文件文件名,这里加上.xlsx指定文件类型,pdf文件就指定.fpd即可
  183. a.download = fileName
  184. // 障眼法藏起来a标签
  185. a.style.display = 'none'
  186. // 将a标签追加到文档对象中
  187. document.body.appendChild(a)
  188. // 模拟点击了<a>标签,会触发<a>标签的href的读取,浏览器就会自动下载了
  189. a.click()
  190. // 一次性的,用完就删除a标签
  191. a.remove()
  192. // window.location.href = './行李全流程跟踪数据系统-用户使用手册V2.1.pdf'
  193. },
  194. goBackHandler (item) {
  195. return item.parent?.path
  196. }
  197. }
  198. }
  199. </script>
  200. <style lang="scss" scoped>
  201. .navbar {
  202. width: 100%;
  203. height: 80px;
  204. overflow: hidden;
  205. position: relative;
  206. background: #fff;
  207. position: fixed;
  208. top: 0;
  209. box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
  210. z-index: 999;
  211. ::v-deep .el-breadcrumb__separator {
  212. display: none;
  213. }
  214. ::v-deep .el-breadcrumb__inner {
  215. padding: 8px 31px 9px 31px;
  216. color: #afb4bf;
  217. }
  218. ::v-deep .el-breadcrumb__item:last-child {
  219. .el-breadcrumb__inner {
  220. padding: 8px 31px 9px 31px;
  221. background: #dfe3ea;
  222. font-size: 14px;
  223. font-family: Microsoft YaHei;
  224. font-weight: 400;
  225. color: #101116;
  226. }
  227. }
  228. > .navbar_top {
  229. width: 100%;
  230. height: 48px;
  231. background: #2d67e3;
  232. display: flex;
  233. align-items: center;
  234. justify-content: space-between;
  235. // border-bottom: 1px solid #f2f6fc;
  236. padding-left: 14px;
  237. > .nav_left {
  238. height: 100%;
  239. display: flex;
  240. align-items: center;
  241. > .dividing {
  242. width: 1px;
  243. height: 16px;
  244. margin-left: 8px;
  245. margin-right: 12px;
  246. background: #ffffff;
  247. }
  248. > .log_name {
  249. font-size: 14px;
  250. font-family: Microsoft YaHei;
  251. font-weight: bold;
  252. color: #ffffff;
  253. }
  254. }
  255. .hamburger-container {
  256. line-height: 46px;
  257. height: 100%;
  258. float: left;
  259. cursor: pointer;
  260. transition: background 0.3s;
  261. -webkit-tap-highlight-color: transparent;
  262. &:hover {
  263. background: rgba(0, 0, 0, 0.025);
  264. }
  265. }
  266. .breadcrumb-container {
  267. float: left;
  268. }
  269. .right-menu {
  270. float: right;
  271. height: 100%;
  272. line-height: 48px;
  273. margin-right: 44px;
  274. display: flex;
  275. &:focus {
  276. outline: none;
  277. }
  278. > div {
  279. margin-right: 20px;
  280. }
  281. .img-icon {
  282. display: inline-block;
  283. width: 24px;
  284. height: 24px;
  285. vertical-align: middle;
  286. background-repeat: no-repeat;
  287. background-size: cover;
  288. cursor: pointer;
  289. transition: all 0.3s;
  290. }
  291. .lock {
  292. .img-icon {
  293. background-image: url("../../assets/status/ic_password.png");
  294. &:hover {
  295. background-image: url("../../assets/status/ic_password_hovar.png");
  296. }
  297. }
  298. }
  299. .exit {
  300. .img-icon {
  301. background-image: url("../../assets/status/ic_exit.png");
  302. &:hover {
  303. background-image: url("../../assets/status/ic_exit_hovar.png");
  304. }
  305. }
  306. }
  307. .btn-help {
  308. height: 20px;
  309. line-height: 20px;
  310. padding: 0;
  311. width: 38px;
  312. margin-top: 14px;
  313. border: 1px solid #fff;
  314. background: none;
  315. color: #fff;
  316. transition: all 0.3s;
  317. &:hover {
  318. background: #fff;
  319. color: #2d67e3;
  320. }
  321. }
  322. .user {
  323. img {
  324. position: relative;
  325. top: 6px;
  326. margin-right: 10px;
  327. }
  328. color: #fff;
  329. font-weight: 600;
  330. font-size: 16px;
  331. cursor: pointer;
  332. }
  333. > .right {
  334. width: 100%;
  335. height: 100%;
  336. display: flex;
  337. align-items: center;
  338. justify-content: flex-start;
  339. padding-right: 80px;
  340. > .log {
  341. width: 40px;
  342. height: 40px;
  343. background: #e1e5eb;
  344. border-radius: 50%;
  345. margin-right: 16px;
  346. }
  347. > p {
  348. font-size: 16px;
  349. font-family: Microsoft YaHei;
  350. font-weight: 300;
  351. color: #303133;
  352. }
  353. }
  354. .right-menu-item {
  355. display: inline-block;
  356. padding: 0 8px;
  357. height: 100%;
  358. font-size: 18px;
  359. color: #5a5e66;
  360. vertical-align: text-bottom;
  361. &.hover-effect {
  362. cursor: pointer;
  363. transition: background 0.3s;
  364. &:hover {
  365. background: rgba(0, 0, 0, 0.025);
  366. }
  367. }
  368. }
  369. .avatar-container {
  370. margin-right: 30px;
  371. height: 100%;
  372. .avatar-wrapper {
  373. height: 100%;
  374. // margin-top: 5px;
  375. display: flex;
  376. align-items: center;
  377. position: relative;
  378. .search {
  379. width: 21px;
  380. height: 21px;
  381. background: url("../../assets/header/ic_search_top.png") no-repeat;
  382. background-size: 100% 100%;
  383. margin-top: 10px;
  384. margin-right: 41px;
  385. }
  386. .fullscreen {
  387. width: 21px;
  388. height: 21px;
  389. background: url("../../assets/header/ic_fullscreen_top.png")
  390. no-repeat;
  391. background-size: 100% 100%;
  392. margin-top: 10px;
  393. margin-right: 20px;
  394. }
  395. .journaler {
  396. width: 21px;
  397. height: 21px;
  398. background: url("../../assets/header/ic_data_top.png") no-repeat;
  399. background-size: 100% 100%;
  400. margin-top: 10px;
  401. margin-right: 41px;
  402. }
  403. .information {
  404. width: 21px;
  405. height: 21px;
  406. background: url("../../assets/header/ic_message_top.png") no-repeat;
  407. background-size: 100% 100%;
  408. margin-top: 10px;
  409. margin-right: 41px;
  410. position: relative;
  411. > .information_number {
  412. position: absolute;
  413. width: 15px;
  414. height: 15px;
  415. background: #ed5050;
  416. color: #ffffff;
  417. border-radius: 50%;
  418. top: -35%;
  419. right: -30%;
  420. display: flex;
  421. align-items: center;
  422. justify-content: center;
  423. font-size: 12px;
  424. font-family: Microsoft YaHei;
  425. font-weight: 400;
  426. }
  427. }
  428. .user-avatar {
  429. cursor: pointer;
  430. width: 24px;
  431. height: 24px;
  432. border-radius: 50%;
  433. margin-right: 16px;
  434. }
  435. .username {
  436. // width: 200px;
  437. height: 40px;
  438. // margin-left: 5%;
  439. color: #ffffff;
  440. font-size: 16px;
  441. font-family: Microsoft YaHei;
  442. font-weight: bold;
  443. line-height: 40px;
  444. display: inline;
  445. }
  446. .el-icon-caret-bottom {
  447. cursor: pointer;
  448. position: absolute;
  449. right: -20px;
  450. top: 20px;
  451. font-size: 12px;
  452. }
  453. }
  454. }
  455. }
  456. }
  457. > .navbar_lower {
  458. width: 100%;
  459. height: 32px;
  460. display: flex;
  461. background: #ffffff;
  462. justify-content: space-between;
  463. align-items: center;
  464. padding-left: 220px;
  465. padding-right: 24px;
  466. ::v-deep .el-breadcrumb {
  467. font-size: 18px;
  468. font-family: Microsoft YaHei;
  469. font-weight: 400;
  470. // color: #ffffff;
  471. .is-link {
  472. font-size: 14px !important;
  473. // color: #ffffff !important;
  474. }
  475. .el-breadcrumb__item {
  476. .el-breadcrumb__inner {
  477. font-size: 14px;
  478. }
  479. }
  480. // .is-link {
  481. // font-size: 14px;
  482. // color: #ffffff !important;
  483. // }
  484. .btn-back {
  485. margin-left: -18px;
  486. margin-right: 10px;
  487. font-size: 14px;
  488. color: #2d67e3;
  489. cursor: pointer;
  490. }
  491. }
  492. > .newdata {
  493. font-size: 14px;
  494. font-family: DIN;
  495. font-weight: bold;
  496. min-width: 200px;
  497. text-align: right;
  498. // color: #ffffff;
  499. }
  500. }
  501. .hide_navbar_lower {
  502. padding-left: 48px;
  503. }
  504. }
  505. </style>