terminalhome.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <div class="inner-container">
  3. <div class="tabBox">
  4. <el-tabs tab-position="left" v-model="activeName" @tab-click="handleClick">
  5. <el-tab-pane v-for="(item, index) in routerList" :key="index" :name="item.path" :label="item.label">
  6. </el-tab-pane>
  7. </el-tabs>
  8. </div>
  9. <div class="infoBox">
  10. <router-view />
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. data() {
  17. return {
  18. activeName: "",
  19. showList: [],
  20. routerList: [
  21. {
  22. label: "测试终端管理",
  23. path: "/terminal",
  24. name: "terminal"
  25. },
  26. {
  27. label: "测试终端申请",
  28. path: "/terminalApply",
  29. name: "terminalApply"
  30. },
  31. {
  32. label: "终端型号管理",
  33. path: "/terminalModel",
  34. name: "terminalModel"
  35. },
  36. {
  37. label: "终端台账管理",
  38. path: "/terminalStandbook",
  39. name: "terminalStandbook"
  40. },
  41. ],
  42. };
  43. },
  44. computed: {
  45. menuList: function() {
  46. let arr = [];
  47. this.routerList.map((item) => {
  48. this.showList.map((row) => {
  49. if (item.path == row) {
  50. arr.push(item);
  51. }
  52. });
  53. });
  54. return arr;
  55. },
  56. },
  57. methods: {
  58. handleClick(val) {
  59. if (this.$route.path != this.activeName) {
  60. this.$router.push(this.activeName);
  61. }
  62. },
  63. },
  64. mounted() {
  65. this.activeName = this.$route.path;
  66. },
  67. created() {
  68. JSON.parse(sessionStorage.childrenMenus).map((item) => {
  69. this.showList.push(item.jspUrl);
  70. });
  71. },
  72. watch: {
  73. $route(to, from) {
  74. this.activeName = this.$route.path;
  75. },
  76. },
  77. };
  78. </script>
  79. <style>
  80. .el-tabs__content {
  81. display: none;
  82. }
  83. .inner-container{
  84. display: flex;
  85. justify-content: space-between;
  86. }
  87. .tabBox{
  88. width: 135px;
  89. }
  90. .infoBox{
  91. background: #f4f4f4!important;
  92. height: 100%;
  93. width: calc(100% - 135px)
  94. }
  95. </style>