home.vue 2.5 KB

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