index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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 tabOptions"
  10. :key="item.key"
  11. :class="{ active: activeComp == item.key }"
  12. @click="activeComp = item.key"
  13. >
  14. {{ item.name }}
  15. <span v-if="item.count > 0">{{
  16. item.count > 99 ? '99+' : item.count
  17. }}</span>
  18. </li>
  19. </ul>
  20. </div>
  21. </div>
  22. <div class="content-wrapper" style="margin-left: 10px">
  23. <component :is="activeComp" @recount="setCount"></component>
  24. </div>
  25. </el-card>
  26. </div>
  27. </template>
  28. <script>
  29. import { statistics } from '@/api/bpm/components/inspectionManage';
  30. import patrolInspection from './patrolInspection';
  31. import maintenance from './maintenance';
  32. import delivery from './delivery';
  33. import repair from './repair';
  34. export default {
  35. components: {
  36. patrolInspection,
  37. maintenance,
  38. delivery,
  39. repair
  40. },
  41. data() {
  42. return {
  43. activeComp: 'patrolInspection',
  44. tabOptions: [
  45. { key: 'patrolInspection', name: '巡点检工单' },
  46. { key: 'maintenance', name: '保养工单' },
  47. // { key: 'delivery', name: '量具送检工单' },
  48. { key: 'repair', name: '维修工单' }
  49. // { key: 'repair', name: '计划性维修工单' },
  50. // { key: 'malfunction', name: '盘点工单' }
  51. ]
  52. };
  53. },
  54. mounted() {
  55. // this.setCount();
  56. switch (this.$route.query.title) {
  57. case '巡点检工单':
  58. this.activeComp = 'patrolInspection';
  59. break;
  60. case '保养工单':
  61. this.activeComp = 'maintenance';
  62. break;
  63. case '量具送检工单':
  64. this.activeComp = 'delivery';
  65. break;
  66. case '维修工单':
  67. this.activeComp = 'repair';
  68. break;
  69. default:
  70. break;
  71. }
  72. },
  73. methods: {
  74. setCount() {
  75. statistics().then((data) => {
  76. this.tabOptions = this.tabOptions.map((item) => {
  77. console.log(item);
  78. switch (item.key) {
  79. case 'maintenance':
  80. return { ...item, count: data.maintenanceNum };
  81. case 'patrolInspection':
  82. return { ...item, count: data.patrolInspection };
  83. case 'delivery':
  84. return { ...item, count: data.quantityNum };
  85. case 'repair':
  86. return { ...item, count: data.repairsNum };
  87. }
  88. });
  89. });
  90. }
  91. }
  92. };
  93. </script>
  94. <style lang="scss" scoped>
  95. .tickets_index {
  96. width: 100%;
  97. // height: calc(100vh - 96px);
  98. ::v-deep .el-card {
  99. height: 100%;
  100. width: 100%;
  101. .el-card__body {
  102. height: 100%;
  103. width: 100%;
  104. display: flex;
  105. flex-direction: column;
  106. .switch {
  107. flex: 0 0 50px;
  108. .switch_left > ul > li {
  109. display: flex;
  110. align-items: center;
  111. span {
  112. display: inline-block;
  113. width: 15px;
  114. height: 15px;
  115. line-height: 15px;
  116. background-color: red;
  117. color: #fff;
  118. border-radius: 50%;
  119. font-size: 10px;
  120. margin-left: 10px;
  121. }
  122. }
  123. }
  124. .content-wrapper {
  125. flex: 1;
  126. }
  127. }
  128. }
  129. }
  130. .content-wrapper {
  131. background-color: #fff;
  132. }
  133. .page-title {
  134. background: #fff;
  135. padding: 26px 10px 15px;
  136. border-bottom: 1px solid #eaeefb;
  137. }
  138. </style>