terminalhome.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <div class="inner-container">
  3. <div class="tabBox">
  4. <el-tabs v-model="activeName" @tab-click="handleClick">
  5. <el-tab-pane
  6. v-for="(item, index) in routerList"
  7. :key="index"
  8. :name="item.path"
  9. :label="item.label"
  10. >
  11. </el-tab-pane>
  12. </el-tabs>
  13. </div>
  14. <div class="infoBox">
  15. <router-view />
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. activeName: "",
  24. showList: [],
  25. routerList: [
  26. {
  27. label: "测试终端管理",
  28. path: "/terminal",
  29. name: "terminal",
  30. },
  31. {
  32. label: "测试终端申请",
  33. path: "/terminalApply",
  34. name: "terminalApply",
  35. },
  36. {
  37. label: "终端型号管理",
  38. path: "/terminalModel",
  39. name: "terminalModel",
  40. },
  41. {
  42. label: "终端台账管理",
  43. path: "/terminalStandbook",
  44. name: "terminalStandbook",
  45. },
  46. ],
  47. };
  48. },
  49. computed: {
  50. menuList: function () {
  51. let arr = [];
  52. this.routerList.map((item) => {
  53. this.showList.map((row) => {
  54. if (item.path == row) {
  55. arr.push(item);
  56. }
  57. });
  58. });
  59. return arr;
  60. },
  61. },
  62. methods: {
  63. handleClick(val) {
  64. if (this.$route.path != this.activeName) {
  65. this.$router.push(this.activeName);
  66. }
  67. },
  68. },
  69. mounted() {
  70. this.activeName = this.$route.path;
  71. },
  72. created() {
  73. JSON.parse(sessionStorage.childrenMenus).map((item) => {
  74. this.showList.push(item.jspUrl);
  75. });
  76. },
  77. watch: {
  78. $route(to, from) {
  79. this.activeName = this.$route.path;
  80. },
  81. },
  82. };
  83. </script>
  84. <style lang="scss" scoped>
  85. .el-tabs__content {
  86. display: none;
  87. }
  88. .inner-container {
  89. // display: flex;
  90. // justify-content: space-between;
  91. }
  92. .tabBox {
  93. border-bottom: 1px solid #e1e1e1;
  94. height: 55px;
  95. margin-top: 10px;
  96. }
  97. .infoBox {
  98. background: #f4f4f4 !important;
  99. height: 100%;
  100. // width: calc(100% - 135px);
  101. margin-left: 20px;
  102. }
  103. ::v-deep .el-tabs__item {
  104. width: 166px;
  105. text-align: center;
  106. border-left: 10px solid #ffffff;
  107. border-right: 10px solid #ffffff;
  108. padding: 0;
  109. }
  110. ::v-deep .el-tabs__header {
  111. margin: 0px;
  112. background: #d8eaf6;
  113. color: black;
  114. margin-left: 20px;
  115. display: inline-block;
  116. }
  117. ::v-deep .is-active {
  118. background: #0583cd;
  119. color: white;
  120. }
  121. ::v-deep .el-tabs__item:hover {
  122. color: black;
  123. }
  124. ::v-deep .is-active:hover {
  125. background: #0583cd;
  126. color: white;
  127. }
  128. ::v-deep .el-tabs__active-bar{
  129. width: 0px !important;
  130. }
  131. </style>