systemFile.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <!-- 船员模块 体系管理 -->
  2. <template>
  3. <div class="frame">
  4. <div class="frameTitle">
  5. <el-menu :default-active="defaultIndex()"
  6. class="el-menu-demo"
  7. mode="horizontal"
  8. @select="handleSelect">
  9. <el-menu-item v-for="(item,id) in elMenu"
  10. :key="id"
  11. v-show="item.hp"
  12. :index="item.key">
  13. <span>{{ $t(item.value) }}</span>
  14. <span v-if="item.num >= 0">
  15. <span>{{ '(' }}</span>
  16. <span style="color: #e74c3c">{{ item.num }}</span>
  17. <span>{{ ')' }}</span>
  18. </span>
  19. </el-menu-item>
  20. </el-menu>
  21. </div>
  22. <div>
  23. <router-view />
  24. </div>
  25. </div>
  26. </template>
  27. <script>
  28. import { getHp } from '@/utils/getHasPermission'
  29. import { getWarnList } from '@/model/system'
  30. import { getFileOperationInfoWaitDealWithByPage } from '@/model/system'
  31. export default {
  32. name: 'systemFile',
  33. data () {
  34. return {
  35. elMenu: [
  36. {
  37. value: 'route.warn',
  38. key: '1',
  39. hp: getHp('ismManager.SystemOperation.systemOperationWarning'),
  40. num: 0
  41. },
  42. {
  43. value: 'route.systemOperation',
  44. key: '2',
  45. hp: getHp('ismManager.SystemOperation.systemOperationFile'),
  46. num: 0
  47. },
  48. {
  49. value: 'route.myFile',
  50. key: '3',
  51. hp: getHp('ismManager.SystemOperation.systemOperationFile')
  52. },
  53. {
  54. value: 'route.fileManage',
  55. key: '4',
  56. hp: getHp('ismManager.SystemOperation.fileManagement')
  57. },
  58. {
  59. value: 'route.archivedHistory',
  60. key: '5',
  61. hp: getHp('ismManager.SystemOperation.fileArchiveHistory')
  62. },
  63. ]
  64. }
  65. },
  66. watch: {
  67. '$route' (to, from) {
  68. // this.httpGetUserInfo(); // 这是我ajax获取用户信息的方法
  69. this.defaultIndex()
  70. this.handleSelect(this.defaultIndex())
  71. },
  72. '$store.state.app.systemOperationNum': function (newVal) {
  73. this.elMenu[1].num = newVal
  74. },
  75. '$store.state.app.systemWarnNum': function (newVal) {
  76. this.elMenu[0].num = newVal
  77. }
  78. },
  79. created () {
  80. // this.clickHistory()
  81. this.handleSelect(this.defaultIndex())
  82. this.getWarnNum()
  83. this.getFileNum()
  84. },
  85. methods: {
  86. getWarnNum () {
  87. getWarnList().toPromise().then(data => {
  88. this.elMenu[0].num = data.total
  89. this.$store.commit('app/SET_WARN_NUM', data.total)
  90. this.elMenu[0].num = this.$store.getters.systemWarnNum
  91. })
  92. },
  93. getFileNum () {
  94. getFileOperationInfoWaitDealWithByPage().toPromise().then(data => {
  95. this.$store.commit('app/SET_OPERATION_NUM', data.total)
  96. this.elMenu[1].num = this.$store.getters.systemOperationNum
  97. })
  98. },
  99. defaultIndex () {
  100. const allMenu = this.elMenu.filter(i => i.hp)
  101. if (allMenu.length > 0) {
  102. if (sessionStorage.getItem('ws-pf_systemFile')) {
  103. for (let i = 0; i < allMenu.length; i++) {
  104. if (allMenu[i].hp && allMenu[i].key === sessionStorage.getItem('ws-pf_systemFile')) {
  105. return sessionStorage.getItem('ws-pf_systemFile')
  106. }
  107. }
  108. return allMenu[0].key
  109. } else {
  110. for (let i = 0; i < allMenu.length; i++) {
  111. if (allMenu[i].hp) {
  112. return allMenu[i].key
  113. }
  114. }
  115. }
  116. }
  117. return ''
  118. },
  119. // 点击标签跳转
  120. handleSelect (key) {
  121. // sessionStorage.setItem('ws-pf_myAuthority', key)
  122. if (key === '1') {
  123. this.$router.push({ name: 'warn' })
  124. sessionStorage.setItem('ws-pf_systemFile', key)
  125. } else if (key === '2') {
  126. this.$router.push({ name: 'systemOperation' })
  127. sessionStorage.setItem('ws-pf_systemFile', key)
  128. } else if (key === '3') {
  129. this.$router.push({ name: 'myFile' })
  130. sessionStorage.setItem('ws-pf_systemFile', key)
  131. } else if (key === '4') {
  132. this.$router.push({ name: 'fileManage' })
  133. sessionStorage.setItem('ws-pf_systemFile', key)
  134. } else if (key === '5') {
  135. this.$router.push({ name: 'archivedHistory' })
  136. sessionStorage.setItem('ws-pf_systemFile', key)
  137. }
  138. },
  139. // // 记住切换选择
  140. // clickHistory() {
  141. // if (sessionStorage.getItem('ws-pf_myAuthority') === null) {
  142. // this.activeIndex = '1';
  143. // } else {
  144. // this.activeIndex = sessionStorage.getItem('ws-pf_myAuthority')
  145. // }
  146. // this.handleSelect(this.activeIndex)
  147. // }
  148. }
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .frameTitle {
  153. padding-left: 10px;
  154. background-color: #fff;
  155. border-top: 1px solid #eeeeee;
  156. }
  157. .frameCenter {
  158. background-color: #fff;
  159. padding: 0px 15px 15px 15px;
  160. height: calc(100vh - 100px);
  161. overflow-y: auto;
  162. }
  163. // .management {
  164. // background: #fff;
  165. // // margin-right:100px;
  166. // }
  167. // .title-line-height {
  168. // height: 50px;
  169. // }
  170. // .svg-icon-class {
  171. // float: left;
  172. // font-size: 20px;
  173. // color: #1d6ced;
  174. // margin: 16px 0 0 16px;
  175. // }
  176. </style>
  177. <!--<template>
  178. <div>
  179. <div class="tabsMain">
  180. <div class="navBar">
  181. <router-link class="navBtn" :to="{name:'warn'}" v-if="permissionIf">{{ $t('route.warn') }}</router-link>
  182. <router-link class="navBtn" :to="{name:'fileManage'}" v-if="permission">{{ $t('route.fileManage') }}</router-link>
  183. <router-link class="navBtn" :to="{name:'systemOperation'}" v-if="permission">{{ $t('route.systemOperation') }}</router-link>
  184. <router-link class="navBtn" :to="{name:'archivedHistory'}" v-if="permission">{{ $t('route.archivedHistory') }}</router-link>
  185. </div>
  186. <router-view />
  187. </div>
  188. </div>
  189. </template>
  190. <script>
  191. import {
  192. getHp
  193. } from '@/utils/getHasPermission';
  194. export default {
  195. data() {
  196. return {
  197. permission: getHp('configuration.announcementManagement.announcementType'),
  198. permissionIf: getHp('configuration.announcementManagement.announcement')
  199. }
  200. },
  201. methods: {
  202. }
  203. }
  204. </script>
  205. <style lang="scss" scoped>
  206. .active{
  207. color: #1D6CED !important;
  208. }
  209. .tabsMain .navBar{
  210. width: 100%;
  211. }
  212. </style>-->