index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <script setup>
  2. import Logo from '../Logo/index.vue'
  3. import { useSettingStore } from '@/store/settings.js'
  4. import { usePermissionStore } from '@/store/permission.js'
  5. import sideBarItem from './sideBarItem.vue'
  6. import { watchEffect } from 'vue'
  7. const route = useRoute()
  8. const router = useRouter()
  9. const { collapse } = storeToRefs(useSettingStore())
  10. const sidebarRouters = computed(() => usePermissionStore().sidebarRouters)
  11. const theme = computed(() => useSettingStore().theme)
  12. const activeMenu = computed(() => {
  13. const { meta, path } = route
  14. if (meta.activeMenu) {
  15. return meta.activeMenu
  16. }
  17. let dealPath= decodeURIComponent(path)
  18. if(dealPath.startsWith('/workflow')){
  19. dealPath = '/tjmchild'+dealPath
  20. return dealPath
  21. }
  22. return path
  23. })
  24. </script>
  25. <template>
  26. <div class="tjm_sidebar_container" :class="{ 'is-collapse': !collapse }">
  27. <Logo />
  28. <el-scrollbar style="height: calc(100% - 60px)">
  29. <el-menu
  30. :default-active="activeMenu"
  31. :collapse="collapse"
  32. background-color="#283a5e"
  33. text-color="#fff"
  34. :unique-opened="true"
  35. :active-text-color="theme"
  36. :collapse-transition="false"
  37. mode="vertical"
  38. >
  39. <sideBarItem
  40. v-for="(route, index) in sidebarRouters"
  41. :key="route.path + index"
  42. :item="route"
  43. />
  44. </el-menu>
  45. </el-scrollbar>
  46. </div>
  47. </template>
  48. <style lang="scss" scoped>
  49. @mixin active {
  50. // &:hover {
  51. // color: $base-color-white;
  52. // }
  53. // &.is-active {
  54. // color: $base-color-white;
  55. // background-color: var(--el-color-primary) !important;
  56. // }
  57. }
  58. .tjm_sidebar_container {
  59. position: fixed;
  60. top: 0;
  61. bottom: 0;
  62. left: 0;
  63. z-index: $base-z-index;
  64. // width: $base-sidebar-width;
  65. height: 100vh;
  66. box-shadow: 2px 0 6px rgb(0 21 41 / 35%);
  67. border-right: 1px solid #ccc;
  68. background: $base-sidebar-menu-background;
  69. transition: width $base-transition-time;
  70. &.is-collapse {
  71. width: $base-sidebar-width;
  72. border-right: 0;
  73. }
  74. :deep(.el-scrollbar__wrap) {
  75. overflow-x: hidden;
  76. .el-menu {
  77. border: 0;
  78. }
  79. .el-sub-menu.is-active > .el-sub-menu__title{
  80. color: #409EFF !important;
  81. }
  82. .el-menu-item,
  83. .el-submenu__title {
  84. height: $base-sidebar-menu-item-height;
  85. overflow: hidden;
  86. line-height: $base-sidebar-menu-item-height;
  87. text-overflow: ellipsis;
  88. white-space: nowrap;
  89. vertical-align: middle;
  90. }
  91. .el-menu-item {
  92. @include active;
  93. }
  94. }
  95. }
  96. </style>