index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <div class="tickets_index">
  3. <el-card :body-style="{ padding: 10 }">
  4. <!-- tab切换 -->
  5. <div class="switch">
  6. <div class="switch_left">
  7. <ul>
  8. <li
  9. v-for="item in permittedTabs"
  10. :key="item.key"
  11. :class="{ active: activeComp == item.key }"
  12. @click="activeComp = item.key"
  13. >
  14. {{ item.name }}
  15. </li>
  16. </ul>
  17. </div>
  18. </div>
  19. <div class="content-wrapper" style="margin-left: 10px">
  20. <component :is="activeComp" way="done"></component>
  21. </div>
  22. </el-card>
  23. </div>
  24. </template>
  25. <script>
  26. import patrolInspection from './patrolInspection';
  27. import service from './service';
  28. import maintenance from './maintenance';
  29. import delivery from './delivery';
  30. import repair from './repair';
  31. import inspectionWork from '@/views/bpm/tickets/inspectionWork/index.vue';
  32. import productions from '@/views/bpm/tickets/productions/index.vue';
  33. import work from '@/views/bpm/tickets/work/index.vue';
  34. export default {
  35. components: {
  36. patrolInspection,
  37. maintenance,
  38. delivery,
  39. repair,service,
  40. inspectionWork,
  41. productions,
  42. work
  43. },
  44. data() {
  45. return {
  46. activeComp: 'patrolInspection',
  47. tabOptions: [
  48. { key: 'patrolInspection', name: '巡点检工单', permission: 'wt:ticketstab:xdjgd' },
  49. { key: 'maintenance', name: '保养工单', permission: 'wt:ticketstab:bygd' },
  50. { key: 'service', name: '检修工单', permission: 'wt:ticketstab:jxgd' },
  51. { key: 'repair', name: '维修工单', permission: 'wt:ticketstab:wxgd' },
  52. { key: 'productions', name: '生产工单', permission: 'wt:ticketstab:scgd' },
  53. { key: 'inspectionWork', name: '质检工单', permission: 'wt:ticketstab:zjgd' },
  54. { key: 'work', name: '盘点工单', permission: 'wt:ticketstab:pdgd' }
  55. // { key: 'delivery', name: '量具送检工单' }
  56. // { key: 'repair', name: '计划性维修工单' },
  57. // { key: 'malfunction', name: '盘点工单' }
  58. ]
  59. };
  60. },
  61. computed: {
  62. permittedTabs() {
  63. return this.tabOptions.filter(
  64. (item) => this.$hasPermission(item.permission)
  65. );
  66. }
  67. },
  68. created() {
  69. // 确保 activeComp 指向有权 Tab
  70. if (this.permittedTabs.length > 0) {
  71. this.activeComp = this.permittedTabs[0].key;
  72. }
  73. },
  74. mounted() {
  75. switch (this.$route.query.title) {
  76. case '巡点检工单':
  77. this.activeComp = 'patrolInspection';
  78. break;
  79. case '保养工单':
  80. this.activeComp = 'maintenance';
  81. break;
  82. case '检修工单':
  83. this.activeComp = 'service';
  84. break;
  85. case '量具送检工单':
  86. this.activeComp = 'delivery';
  87. break;
  88. case '质检工单':
  89. this.activeComp = 'inspectionWork';
  90. break;
  91. case '盘点工单':
  92. this.activeComp = 'work';
  93. break;
  94. case '生产工单':
  95. this.activeComp = 'productions';
  96. break;
  97. default:
  98. break;
  99. }
  100. }
  101. };
  102. </script>
  103. <style lang="scss" scoped>
  104. .tickets_index {
  105. width: 100%;
  106. height: calc(100vh - 96px);
  107. ::v-deep .el-card {
  108. height: 100%;
  109. width: 100%;
  110. .el-card__body {
  111. height: 100%;
  112. width: 100%;
  113. display: flex;
  114. flex-direction: column;
  115. .switch {
  116. flex: 0 0 50px;
  117. }
  118. .content-wrapper {
  119. flex: 1;
  120. }
  121. }
  122. }
  123. }
  124. .content-wrapper {
  125. background-color: #fff;
  126. }
  127. .page-title {
  128. background: #fff;
  129. padding: 26px 10px 15px;
  130. border-bottom: 1px solid #eaeefb;
  131. }
  132. </style>