index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. this.findCurModule();
  49. },
  50. methods: {
  51. /**
  52. * 查询当前选中模块
  53. */
  54. findCurModule() {
  55. this.curModule = _.find(this.navList, (item) => {return item.isActive});
  56. },
  57. /**
  58. * 切换模块
  59. */
  60. changeModule(id) {
  61. _.map(this.navList, (item) => {return item.isActive = item.id === id});
  62. this.findCurModule();
  63. }
  64. }
  65. };
  66. </script>
  67. <style lang="less" scoped>
  68. .analysis-table{
  69. height: calc(100% - 48px);
  70. background: #F2F5F7;
  71. .module-navs-container{
  72. margin: 12px 0;
  73. display: flex;
  74. justify-content: center;
  75. >div{
  76. display: flex;
  77. }
  78. }
  79. .item-nav{
  80. padding-top: 12px;
  81. padding-bottom: 12px;
  82. padding-left: 20px;
  83. padding-right: 16px;
  84. display: flex;
  85. align-items: center;
  86. background: #fff;
  87. cursor: pointer;
  88. >svg{
  89. margin-right: 6px;
  90. }
  91. >div:last-child{
  92. font-size: 16px;
  93. color: #1F2429;
  94. line-height: 22px;
  95. }
  96. }
  97. .nav-active{
  98. background: linear-gradient(360deg,rgba(2,91,170,.1) 0%,rgba(2,91,170,0) 100%);
  99. >svg{
  100. stroke: #025BAA;
  101. }
  102. >div:last-child{
  103. color: #025BAA;
  104. }
  105. }
  106. .module{
  107. width: 100%;
  108. height: calc(100% - 70px);
  109. }
  110. }
  111. </style>