home.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div class="inner-container">
  3. <div class="tabBox">
  4. <el-tabs tab-position="top" v-model="activeName" @tab-click="handleClick" type="card">
  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. { label: "我接收的", path: "/documentCollectionApproval", name: "incomeExcelTemplate" },
  22. { label: "我发起的", path: "/documentCollectionApprovalIssuedCollect", name: "incomeExcelView" },
  23. { label: "模板管理", path: "/documentCollectionApprovalIssuedMoud", name: "incomeExcelIssued" },
  24. // { label: "收入附件收集", path: "/incomeExcelAppendixs", name: "incomeExcelAppendix" }
  25. ],
  26. };
  27. },
  28. computed: {
  29. menuList: function () {
  30. let arr = [];
  31. this.routerList.map((item) => {
  32. this.showList.map((row) => {
  33. if (item.path == row) {
  34. arr.push(item);
  35. }
  36. });
  37. });
  38. return arr;
  39. },
  40. },
  41. methods: {
  42. handleClick(val) {
  43. if (this.$route.path != this.activeName) {
  44. console.log(this.activeName);
  45. this.$router.push(this.activeName);
  46. }
  47. },
  48. },
  49. mounted() {
  50. this.activeName = this.$route.path;
  51. },
  52. created() {
  53. JSON.parse(sessionStorage.childrenMenus).map((item) => {
  54. this.showList.push(item.jspUrl);
  55. });
  56. },
  57. watch: {
  58. $route(to, from) {
  59. this.activeName = this.$route.path;
  60. },
  61. },
  62. };
  63. </script>
  64. <style lang="scss" scoped>
  65. .el-tabs__content {
  66. display: none;
  67. }
  68. .inner-container {
  69. background: #ffffff;
  70. padding-top: 20px;
  71. margin: 15px;
  72. overflow: auto;
  73. width: calc(100% - 30px);
  74. max-width: calc(100% - 30px);
  75. height: 100%;
  76. overflow-x: hidden;
  77. &-viewport {
  78. width: 100%;
  79. overflow: auto;
  80. }
  81. }
  82. .tabBox {
  83. border-bottom: 1px solid #e1e1e1;
  84. height: 60px;
  85. }
  86. .infoBox {
  87. background: #f4f4f4 !important;
  88. height: 100%;
  89. width: calc(100%)
  90. }
  91. ::v-deep .el-tabs__item {
  92. width: 166px;
  93. text-align: center;
  94. border-left: 10px solid #ffffff;
  95. border-right: 10px solid #ffffff;
  96. }
  97. ::v-deep .el-tabs__header {
  98. margin: 0px;
  99. background: #d8eaf6;
  100. color: black;
  101. margin-left: 20px;
  102. display: inline-block;
  103. border: 0px
  104. }
  105. ::v-deep .is-active {
  106. background: #0583cd;
  107. color: white;
  108. }
  109. ::v-deep .el-tabs__item:hover {
  110. color: black;
  111. }
  112. ::v-deep .is-active:hover {
  113. background: #0583cd;
  114. color: white;
  115. }
  116. ::v-deep .el-tabs--card>.el-tabs__header .el-tabs__nav {
  117. border: 0px
  118. }
  119. </style>