index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <div class="flex-align-center">
  3. <div class="nav-list">
  4. <div class="nav-top-item">
  5. <div class="logo-avatar">
  6. <img v-show="img.usetype === 'actionlogo'" v-for="img in siteinfo.attinfos" :key="img.index" style="width:100%" :src="img.url" alt="">
  7. </div>
  8. <div class="item" :class="routerName === '工作台'?'active':''" @click="($router.push('/home'),act_id = null)">
  9. <img width="30" src="../../assets/nav_icon/work_station.svg" alt="">
  10. <p>工作台</p>
  11. </div>
  12. <div class="item" :class="routerName === '消息中心'?'active':''" @click="($router.push('/message'),act_id = null)">
  13. <img width="30" src="../../assets/nav_icon/message.svg" alt="">
  14. <p>消息</p>
  15. </div>
  16. <div class="item" :class="item.systemmoduleid === act_id?'active':''" v-for="item in shortcutlist" :key="item.systemmoduleid" @click="redictToModules(item)">
  17. <p v-if="item.issystem === 0" class="close-shortcut" @click.stop="deleteShortcut(item)"><i class="el-icon-error"></i></p>
  18. <img width="30" :src="item.iconurl_mainnav" alt="">
  19. <p>{{item.systemmodulename}}</p>
  20. </div>
  21. </div>
  22. <!-- <div class="nav-bottom-item">
  23. <div class="item">
  24. <img width="30" src="../../assets/nav_icon/more.svg" alt="">
  25. </div>
  26. </div> -->
  27. </div>
  28. <el-container>
  29. <socket-message></socket-message>
  30. <el-header><myheader :siteinfo="siteinfo"></myheader></el-header>
  31. <div class="modules-panel flex-align-center flex-between">
  32. <p>{{routerName}}</p>
  33. <el-button size="mini" @click="$router.go(-1)">返 回</el-button>
  34. </div>
  35. <el-container class="mymain">
  36. <el-aside v-if="ast_nav" width="180px"><myaside ref="aside"></myaside></el-aside>
  37. <el-container>
  38. <el-main>
  39. <keep-alive include="agentIndex">
  40. <router-view></router-view>
  41. </keep-alive>
  42. </el-main>
  43. <!-- <el-footer class="flex-footer">
  44. <p>技术支持:XXXXXXX</p><br>
  45. </el-footer> -->
  46. </el-container>
  47. </el-container>
  48. </el-container>
  49. </div>
  50. </template>
  51. <script>
  52. import myheader from './modules/header.vue'
  53. import myaside from './modules/aside.vue'
  54. import socketMessage from '@/components/socketMessage/index.vue'
  55. import {mapGetters} from 'vuex'
  56. export default {
  57. components:{
  58. myheader,
  59. myaside,
  60. socketMessage
  61. },
  62. computed:{
  63. ...mapGetters({
  64. siteinfo:'siteinfo',
  65. shortcutlist:'shortcutlist'
  66. })
  67. },
  68. data () {
  69. return {
  70. routerName:'',
  71. modeuls:[],
  72. act_id:null
  73. }
  74. },
  75. mounted() {
  76. },
  77. methods:{
  78. siteInfos () {
  79. this.$store.dispatch('querySiteInfo',{
  80. "classname": "webmanage.site.site",
  81. "method": "querySite",
  82. "content": {}
  83. })
  84. },
  85. // 查询常用栏数据
  86. async query_usershortcuts () {
  87. this.$store.dispatch('setUsershortcuts')
  88. },
  89. redictToModules (item) {
  90. this.act_id = item.systemmoduleid
  91. // 保存当前进入的模块数据
  92. sessionStorage.setItem('active_modules',JSON.stringify(item))
  93. // 跳转
  94. this.$router.push({path:item.apps[0].path})
  95. window.sessionStorage.setItem('currentPath',item.apps[0].path)
  96. // 查询侧边栏应用数据
  97. setTimeout(() => {
  98. this.$refs['aside'].getAuthList()
  99. }, 0);
  100. },
  101. async deleteShortcut (item) {
  102. const res = await this.$api.requested({
  103. "classname": "sysmanage.develop.userauth.userauth",
  104. "method": "delete_usershortcuts",
  105. "content": {
  106. "systemmoduleid":item.systemmoduleid
  107. }
  108. })
  109. this.$store.dispatch('setUsershortcuts')
  110. // 若当前删除模块为激活红的模块则返回首页
  111. let systemmodulename = JSON.parse(sessionStorage.getItem('active_modules')).systemmodulename
  112. if (item.systemmodulename === systemmodulename) {
  113. this.$router.replace({path:'/home'})
  114. }
  115. }
  116. },
  117. created () {
  118. this.siteInfos()
  119. this.query_usershortcuts()
  120. this.routerName = this.$route.meta.title
  121. this.ast_nav = this.$route.meta.ast_nav
  122. },
  123. watch:{
  124. $route (val) {
  125. this.routerName = val.meta.title
  126. this.ast_nav = val.meta.ast_nav
  127. }
  128. }
  129. }
  130. </script>
  131. <style>
  132. </style>
  133. <style scoped>
  134. .nav-list{
  135. flex:0 0 auto;
  136. display: flex;
  137. flex-direction: column;
  138. justify-content: space-between;
  139. width: 80px;
  140. max-width: 80px;
  141. height: calc(100vh - 30px);
  142. padding:15px 0;
  143. background: #3874F6;
  144. }
  145. .logo-avatar{
  146. width: 50px;
  147. height: 50px;
  148. margin: 0 auto 30px auto;
  149. border-radius: 8px;
  150. background: #f1f2f3;
  151. overflow: hidden;
  152. }
  153. .nav-top-item{
  154. overflow-y: scroll;
  155. }
  156. .item{
  157. position: relative;
  158. width: 40px;
  159. padding: 10px;
  160. margin:0 auto 20px auto;
  161. cursor: pointer;
  162. text-align: center;
  163. }
  164. .item p{
  165. font-size: 10px;
  166. color: #fff;
  167. margin-top:5px
  168. }
  169. .active {
  170. border-radius: 8px;
  171. background: #095DE0;
  172. }
  173. .item:hover {
  174. border-radius: 8px;
  175. background: #095DE0;
  176. }
  177. .close-shortcut {
  178. position: absolute;
  179. display: none;
  180. top:-10px;
  181. right:-5px;
  182. }
  183. .item:hover .close-shortcut {
  184. display: block;
  185. }
  186. .close-shortcut i{
  187. font-size: 20px;
  188. }
  189. .mymain{
  190. height: calc(100vh - 99px);
  191. }
  192. .el-header{
  193. padding: 0;
  194. border-bottom: 1px solid #f1f2f3;
  195. z-index: 999;
  196. }
  197. .el-main{
  198. position: relative;
  199. padding: 0;
  200. /* background: #f1f2f3; */
  201. }
  202. .flex-footer{
  203. display: flex;
  204. align-items: center;
  205. justify-content: center;
  206. flex-wrap: wrap;
  207. font-size: 14px;
  208. color: #999;
  209. padding: 10px 0;
  210. border-top:1px solid #f1f2f3;
  211. }
  212. .flex-footer p{
  213. width: 100%;
  214. text-align: center;
  215. }
  216. .modules-panel{
  217. height: 48px;
  218. padding: 0 16px;
  219. border-bottom: 1px solid #f1f2f3;
  220. background: #fff;
  221. }
  222. .nav-top-item::-webkit-scrollbar{
  223. display:none !important;
  224. }
  225. </style>