otherComponent.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <tab :data="tabData" @select="select" />
  3. <el-row>
  4. <el-col :span="3">
  5. <el-tree :data="elTreeData.data[currTab]" :props="elTreeData.defaultProps" @node-click="handleNodeClick"></el-tree>
  6. </el-col>
  7. <el-col :span="21">
  8. <tab :data="tabData2[currTab]" @select="select2" />
  9. <Fj v-if="currTab == 0" :currTab="currTab2" height="85vh"/>
  10. <Syz v-if="currTab == 1" :currTab="currTab2" height="85vh"/>
  11. </el-col>
  12. </el-row>
  13. </template>
  14. <script>
  15. import Tab from "../../components/coms/tabs/tab.vue";
  16. import Fj from "./otherComponentFj.vue";
  17. import Syz from "./otherComponentSyz.vue";
  18. export default {
  19. components: {Tab,Fj,Syz},
  20. data() {
  21. return {
  22. currTab: 0,
  23. currTab2: 0,
  24. tabData: [{
  25. id: "0",
  26. text: "风机",
  27. },
  28. {
  29. id: "1",
  30. text: "升压站",
  31. }
  32. ],
  33. tabData2: [
  34. [{
  35. id: "0",
  36. text: "位置",
  37. },
  38. {
  39. id: "1",
  40. text: "技术参数",
  41. },
  42. {
  43. id: "2",
  44. text: "预防性维护",
  45. },
  46. {
  47. id: "3",
  48. text: "设备历史",
  49. },
  50. {
  51. id: "4",
  52. text: "设备维护操作记录",
  53. }
  54. ],
  55. [{
  56. id: "0",
  57. text: "位置2",
  58. },
  59. {
  60. id: "1",
  61. text: "技术参数",
  62. },
  63. {
  64. id: "2",
  65. text: "预防性维护",
  66. },
  67. {
  68. id: "3",
  69. text: "设备历史",
  70. },
  71. {
  72. id: "4",
  73. text: "设备维护操作记录",
  74. }
  75. ],
  76. ],
  77. elTreeData: {
  78. data: [[{
  79. label: "一级 1",
  80. children: [{
  81. label: "二级 1-1",
  82. children: [{
  83. label: "三级 1-1-1",
  84. }, ],
  85. }, ],
  86. },
  87. {
  88. label: "一级 2",
  89. children: [{
  90. label: "二级 2-1",
  91. children: [{
  92. label: "三级 2-1-1",
  93. }, ],
  94. },
  95. {
  96. label: "二级 2-2",
  97. children: [{
  98. label: "三级 2-2-1",
  99. }, ],
  100. },
  101. ],
  102. },
  103. {
  104. label: "一级 3",
  105. children: [{
  106. label: "二级 3-1",
  107. children: [{
  108. label: "三级 3-1-1",
  109. }, ],
  110. },
  111. {
  112. label: "二级 3-2",
  113. children: [{
  114. label: "三级 3-2-1",
  115. }, ],
  116. },
  117. ],
  118. },
  119. ],
  120. [{
  121. label: "mw一级 1",
  122. children: [{
  123. label: "二级 1-1",
  124. children: [{
  125. label: "三级 1-1-1",
  126. }, ],
  127. }, ],
  128. },
  129. {
  130. label: "一级 2",
  131. children: [{
  132. label: "二级 2-1",
  133. children: [{
  134. label: "三级 2-1-1",
  135. }, ],
  136. },
  137. {
  138. label: "二级 2-2",
  139. children: [{
  140. label: "三级 2-2-1",
  141. }, ],
  142. },
  143. ],
  144. },
  145. {
  146. label: "一级 3",
  147. children: [{
  148. label: "二级 3-1",
  149. children: [{
  150. label: "三级 3-1-1",
  151. }, ],
  152. },
  153. {
  154. label: "二级 3-2",
  155. children: [{
  156. label: "三级 3-2-1",
  157. }, ],
  158. },
  159. ],
  160. },
  161. ]],
  162. defaultProps: {
  163. children: "children",
  164. label: "label",
  165. },
  166. },
  167. };
  168. },
  169. methods: {
  170. select(data) {
  171. if (data.id != this.currTab) {
  172. this.currTab = parseInt(data.id);
  173. this.currTab2 = 0;
  174. }
  175. },
  176. select2(data) {
  177. console.log(data)
  178. this.currTab2 = parseInt(data.id);
  179. },
  180. },
  181. created() {
  182. },
  183. mounted() {},
  184. };
  185. </script>
  186. <style lang="less" scoped>
  187. </style>