SystemPage.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <div>
  3. <div class="bigBox">
  4. <!-- 标签 -->
  5. <div class="tagBox">
  6. <template v-for="(item, index) in tagList">
  7. <span class="tagLit" @click="tagChange(item, index)" :style="{
  8. background: `url(${item.isSelected ? item.isImg : item.noImg})`,
  9. color: item.isSelected ? 'white' : 'black',
  10. }">{{ item.name }}</span>
  11. </template>
  12. </div>
  13. <!-- 设置盒子 -->
  14. <div class="setBox">
  15. <!-- 公共组件box -->
  16. <div class="traBox">
  17. <LineTree v-if="selectIndex == 0" @listBack="listBack"></LineTree>
  18. <ModuleTree v-if="selectIndex == 1"></ModuleTree>
  19. </div>
  20. <!-- 切换box -->
  21. <div class="changeBox">
  22. <LitLine v-if="selectIndex == 0" :fuckList="fuckList"></LitLine>
  23. <InsideModule v-if="selectIndex == 1"></InsideModule>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. </template>
  29. <script>
  30. import { ref, onMounted } from 'vue';
  31. import LitLine from './components/LitLine.vue'
  32. import LineTree from './components/LineTree.vue'
  33. import InsideModule from './components/InsideModule.vue';
  34. import ModuleTree from './components/ModuleTree.vue';
  35. import blueBtn from '@/assets/image/btn_blue.png'
  36. import grayBtn from '@/assets/image/btn_gray.png'
  37. export default {
  38. setup() {
  39. let selectIndex = ref(0)
  40. let tagList = ref([
  41. {
  42. name: "接线方式维护",
  43. id: 1,
  44. noImg: grayBtn,
  45. isImg: blueBtn,
  46. isSelected: true, // 初始状态未选中
  47. },
  48. {
  49. name: "内置模型管理",
  50. id: 2,
  51. noImg: grayBtn,
  52. isImg: blueBtn,
  53. isSelected: false, // 初始状态未选中
  54. },
  55. ])
  56. let fuckList = ref([])//公共list
  57. function tagChange(row, num) {
  58. selectIndex.value = num
  59. // 将当前点击的标签设为选中状态,其他标签设为非选中
  60. tagList.value.forEach((tag) => {
  61. tag.isSelected = tag.id === row.id;
  62. });
  63. }
  64. function listBack(data) {
  65. fuckList.value = data
  66. console.log(fuckList.value, 'fuck');
  67. }
  68. onMounted(() => {
  69. })
  70. return {
  71. tagChange,//标签选择
  72. tagList,//标签列表
  73. listBack,
  74. fuckList,
  75. selectIndex,
  76. }
  77. },
  78. components: {
  79. LitLine,
  80. LineTree,
  81. InsideModule,
  82. ModuleTree,
  83. }
  84. }
  85. </script>
  86. <style scoped>
  87. .bigBox {
  88. width: 98%;
  89. height: 100%;
  90. margin-left: 10px;
  91. margin-top: 5px;
  92. }
  93. .tagLit {
  94. display: inline-block;
  95. width: 112px;
  96. height: 40px;
  97. /* border: 1px solid red; */
  98. text-align: center;
  99. line-height: 40px;
  100. margin-left: 10px;
  101. margin-top: 5px;
  102. font-size: 12px;
  103. }
  104. .setBox {
  105. width: 100%;
  106. height: calc(100vh - 150px);
  107. /* border: 1px solid saddlebrown; */
  108. display: flex;
  109. justify-content: space-evenly;
  110. align-items: center;
  111. margin-top: 10px;
  112. }
  113. .traBox {
  114. width: 15%;
  115. height: calc(100vh - 150px);
  116. /* border: 1px solid green; */
  117. background-color: #F7F8FB;
  118. }
  119. .changeBox {
  120. width: 80%;
  121. height: calc(100vh - 150px);
  122. /* border: 1px solid red; */
  123. }
  124. </style>