index.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <template>
  2. <div class="analysis-table">
  3. <div class="module-navs-container">
  4. <div>
  5. <div v-for="(item) in navList" :key="'key_' + item.id" class="item-nav" :class="{'nav-active': item.isActive}" @click="changeModule(item.id)">
  6. <NavTable v-if="item.imgType === 'table'"/>
  7. <NavApply v-if="item.imgType === 'apply'"/>
  8. <NavGantt v-if="item.imgType === 'gantt'"/>
  9. <div>{{item.name}}</div>
  10. </div>
  11. </div>
  12. </div>
  13. <div class="module">
  14. <CoreDeviceReport v-if="curModule.id === 1"/>
  15. <SpecificationUpdateRecord v-if="curModule.id === 2" />
  16. <GanttChart v-if="curModule.id === 3" />
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. import NavTable from '../../assets/svg/table.svg';
  22. import NavApply from '../../assets/svg/apply.svg';
  23. import NavGantt from '../../assets/svg/gantt_chart.svg';
  24. import CoreDeviceReport from './CoreDeviceReport';
  25. import SpecificationUpdateRecord from './SpecificationUpdateRecord';
  26. import GanttChart from './GanttChart';
  27. import _ from 'lodash';
  28. export default {
  29. data() {
  30. return {
  31. navList: [
  32. {id: 1, name: '核心设备报表', imgType: 'table', isActive: true},
  33. {id: 2, name: '说明书更新记录', imgType: 'apply', isActive: false},
  34. {id: 3, name: '事项甘特图', imgType: 'gantt', isActive: false},
  35. ],
  36. curModule: {}, // 当前选中的模块
  37. }
  38. },
  39. components: {
  40. NavTable,
  41. NavApply,
  42. NavGantt,
  43. CoreDeviceReport,
  44. SpecificationUpdateRecord,
  45. GanttChart
  46. },
  47. mounted() {
  48. const { query } = this.$route;
  49. if (!_.isEmpty(query)) {
  50. if (query.module === 'specification') {
  51. _.map(this.navList, (o) => {return o.isActive = o.id === 2});
  52. } else if (query.module === 'gantt') {
  53. _.map(this.navList, (o) => {return o.isActive = o.id === 3});
  54. }
  55. }
  56. this.findCurModule();
  57. },
  58. methods: {
  59. /**
  60. * 查询当前选中模块
  61. */
  62. findCurModule() {
  63. this.curModule = _.find(this.navList, (item) => {return item.isActive});
  64. },
  65. /**
  66. * 切换模块
  67. */
  68. changeModule(id) {
  69. _.map(this.navList, (item) => {return item.isActive = item.id === id});
  70. this.findCurModule();
  71. }
  72. }
  73. };
  74. </script>
  75. <style lang="less" scoped>
  76. .analysis-table{
  77. height: calc(100% - 48px);
  78. background: #F2F5F7;
  79. .module-navs-container{
  80. margin: 12px 0;
  81. display: flex;
  82. justify-content: center;
  83. >div{
  84. display: flex;
  85. }
  86. }
  87. .item-nav{
  88. padding-top: 12px;
  89. padding-bottom: 12px;
  90. padding-left: 20px;
  91. padding-right: 16px;
  92. display: flex;
  93. align-items: center;
  94. background: #fff;
  95. cursor: pointer;
  96. >svg{
  97. margin-right: 6px;
  98. }
  99. >div:last-child{
  100. font-size: 16px;
  101. color: #1F2429;
  102. line-height: 22px;
  103. }
  104. }
  105. .nav-active{
  106. background: linear-gradient(360deg,rgba(2,91,170,.1) 0%,rgba(2,91,170,0) 100%);
  107. >svg{
  108. stroke: #025BAA;
  109. }
  110. >div:last-child{
  111. color: #025BAA;
  112. }
  113. }
  114. .module{
  115. width: 100%;
  116. height: calc(100% - 70px);
  117. }
  118. }
  119. </style>