SystemPage.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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" v-if="selectIndex == 0 || ourNum == 0">
  17. <LineTree @listBack="listBack" @volBack="volBack" @lineBack="lineBack" :selectIndex="selectIndex">
  18. </LineTree>
  19. <!--<ModuleTree v-if="selectIndex == 1 && ourNum == 1" @mtBack="mtBack"></ModuleTree>-->
  20. </div>
  21. <!-- 切换box -->
  22. <div class="changeBox" :style="selectIndex == 1 && ourNum == 1 ? 'width:96%' : ''" v-loading="loading">
  23. <LitLine v-if="selectIndex == 0" :fuckList="fuckList"></LitLine>
  24. <InsideModule v-if="selectIndex == 1 && ourNum == 1" :tfType="tfType" :insideNeed="insideNeed"
  25. :lineId="lineId" :setName="setName" :setId="setId" @closeDraw="closeDraw"></InsideModule>
  26. <SetModule v-if="selectIndex == 1 && ourNum == 0" @backNum="backNum" :linkstyleid="lineId"
  27. :volId="volId" :fuckList="fuckList"></SetModule>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </template>
  33. <script>
  34. import { ref, onMounted } from 'vue';
  35. import LitLine from './components/LitLine.vue'
  36. import LineTree from './components/LineTree.vue'
  37. import InsideModule from './components/InsideModule.vue';
  38. import ModuleTree from './components/ModuleTree.vue';
  39. import SetModule from './components/SetModule.vue'
  40. import blueBtn from '@/assets/image/btn_blue.png'
  41. import grayBtn from '@/assets/image/btn_gray.png'
  42. export default {
  43. setup() {
  44. let selectIndex = ref(0)
  45. let tagList = ref([
  46. {
  47. name: "接线方式维护",
  48. id: 1,
  49. noImg: grayBtn,
  50. isImg: blueBtn,
  51. isSelected: true, // 初始状态未选中
  52. },
  53. {
  54. name: "内置模型管理",
  55. id: 2,
  56. noImg: grayBtn,
  57. isImg: blueBtn,
  58. isSelected: false, // 初始状态未选中
  59. },
  60. ])//标签列表
  61. let fuckList = ref([])//公共list
  62. let ourNum = ref(0)//决定编辑图像的数字,0为不显示1为显示
  63. let tfType = ref(null)//判断画图状态
  64. let insideNeed = ref({})//画图返回数据
  65. let lineId = ref('')//linetree返回id
  66. let volId = ref('')
  67. let setName = ref('')//setmodule返回name
  68. let setId = ref('')
  69. let loading = ref(false)//加载动画
  70. function tagChange(row, num) {//标签切换
  71. selectIndex.value = num
  72. if (num == 1) {
  73. ourNum.value = 0
  74. }
  75. // 将当前点击的标签设为选中状态,其他标签设为非选中
  76. tagList.value.forEach((tag) => {
  77. tag.isSelected = tag.id === row.id;
  78. });
  79. }
  80. function listBack(data, id) {
  81. setTimeout(() => {
  82. fuckList.value = data
  83. lineId.value = id
  84. }, 1000)
  85. }
  86. function volBack(data, id) {
  87. setTimeout(() => {
  88. fuckList.value = data
  89. volId.value = id
  90. }, 1000)
  91. }
  92. function backNum(data, name, row) {
  93. ourNum.value = data
  94. setName.value = name
  95. setId.value = row
  96. }
  97. function mtBack(data, row) {
  98. insideNeed.value = row
  99. tfType.value = data
  100. }
  101. function closeDraw() {
  102. selectIndex.value = 1
  103. ourNum.value = 0
  104. }
  105. function lineBack(data) {
  106. loading.value = data
  107. setTimeout(() => {
  108. loading.value = false
  109. }, 1500)
  110. }
  111. onMounted(() => {
  112. })
  113. return {
  114. tagChange,//标签选择
  115. tagList,//标签列表
  116. listBack,
  117. volBack,
  118. closeDraw,
  119. fuckList,
  120. selectIndex,
  121. ourNum,
  122. backNum,
  123. tfType,
  124. mtBack,
  125. insideNeed,
  126. lineId,
  127. volId,
  128. setName,
  129. setId,
  130. loading,//加载动画
  131. lineBack,//lineTree.vue返回加载状态
  132. }
  133. },
  134. components: {
  135. LitLine,
  136. LineTree,
  137. InsideModule,
  138. ModuleTree,
  139. SetModule
  140. }
  141. }
  142. </script>
  143. <style scoped>
  144. .bigBox {
  145. width: 98%;
  146. height: 100%;
  147. margin-left: 10px;
  148. margin-top: 5px;
  149. }
  150. .tagLit {
  151. display: inline-block;
  152. width: 112px;
  153. height: 40px;
  154. /* border: 1px solid red; */
  155. text-align: center;
  156. line-height: 40px;
  157. margin-left: 10px;
  158. margin-top: 5px;
  159. font-size: 12px;
  160. }
  161. .setBox {
  162. width: 100%;
  163. height: calc(100vh - 150px);
  164. /* border: 1px solid saddlebrown; */
  165. display: flex;
  166. justify-content: space-evenly;
  167. align-items: center;
  168. margin-top: 10px;
  169. }
  170. .traBox {
  171. width: 15%;
  172. height: calc(100vh - 150px);
  173. border: 1px solid #ededed;
  174. background-color: #F7F8FB;
  175. }
  176. .changeBox {
  177. width: 80%;
  178. height: calc(100vh - 150px);
  179. /* border: 1px solid red; */
  180. }
  181. </style>