Index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <div class="map-ditu">
  3. <Tmap ref="map" @feature-click="featureClick"></Tmap>
  4. <div class="ledata">
  5. <el-input v-model="treeval" @focus="showTree = true"></el-input>
  6. <div class="Showtree">
  7. <el-tree
  8. v-if="showTree"
  9. :data="treeData"
  10. @node-click="handleNodeClick"
  11. ></el-tree>
  12. </div>
  13. <p><span class="SpText">风场总数:</span>20 个</p>
  14. <p><span class="SpText">已分析风场:</span>10 个</p>
  15. <p><span class="SpText">未分析风场:</span>10个</p>
  16. <p><span class="SpText">风机数量:</span>10 个</p>
  17. <p>
  18. <span class="SpText">风机状态:</span>
  19. <span class="red"></span>
  20. <span class="yellow"></span>
  21. <span class="green"></span>
  22. </p>
  23. <el-switch
  24. v-model="value1"
  25. active-text="显示"
  26. inactive-text="隐藏"
  27. @change="handleSwitchChange"
  28. >
  29. </el-switch>
  30. </div>
  31. <Rightdata v-show="ShowRi" class="ridata"></Rightdata>
  32. <router-view></router-view>
  33. </div>
  34. </template>
  35. <script>
  36. import Tmap from "@/components/map";
  37. import Rightdata from "./component/rightdata.vue";
  38. export default {
  39. name: "Index",
  40. components: {
  41. Tmap,
  42. Rightdata,
  43. },
  44. data() {
  45. return {
  46. ShowRi: true,
  47. treeval: "",
  48. value1: true,
  49. treeval: "", // 绑定的输入框值
  50. showTree: false, // 控制树列表显示
  51. treeData: [
  52. // 树列表数据,根据实际需求自行替换
  53. {
  54. id: 1,
  55. label: "Node 1",
  56. children: [
  57. {
  58. id: 2,
  59. label: "Node 1-1",
  60. },
  61. ],
  62. },
  63. {
  64. id: 3,
  65. label: "Node 2",
  66. },
  67. ],
  68. };
  69. },
  70. mounted() {
  71. //模拟地图上的点位
  72. const data = [{ point: [120.2, 30.35] }];
  73. data.forEach((element) => {
  74. console.log(element);
  75. this.$refs.map.addMarker(element);
  76. });
  77. },
  78. methods: {
  79. clickEvent(data) {
  80. console.log(data);
  81. this.$router.push({ name: "about" });
  82. },
  83. handleSwitchChange() {
  84. this.ShowRi = !this.ShowRi;
  85. },
  86. handleNodeClick(data) {
  87. // 将点击的节点值赋给输入框
  88. this.treeval = data.label;
  89. // 隐藏树列表
  90. this.showTree = false;
  91. },
  92. featureClick() {
  93. this.$router.push("cockpitManage/electronic-map");
  94. //点击事件 跳转B页面
  95. },
  96. },
  97. };
  98. </script>
  99. <style lang="scss" scoped>
  100. .map-ditu {
  101. min-width: 86.9vw;
  102. max-width: 94.9vw;
  103. height: 93.4vh;
  104. position: relative;
  105. }
  106. .ridata {
  107. position: absolute;
  108. top: 20px;
  109. right: 20px;
  110. }
  111. .ledata {
  112. font-size: 14px;
  113. width: 300px;
  114. position: absolute;
  115. top: 20px;
  116. left: 60px;
  117. background: #008080;
  118. padding: 10px;
  119. color: #fff;
  120. border-radius: 5px;
  121. p {
  122. line-height: 24px;
  123. .SpText {
  124. display: inline-block;
  125. width: 90px;
  126. text-align: right;
  127. }
  128. .red,
  129. .yellow,
  130. .green {
  131. display: inline-block;
  132. width: 30px;
  133. height: 12px;
  134. margin-right: 5px;
  135. }
  136. .red {
  137. background-color: #e16757;
  138. }
  139. .yellow {
  140. background-color: #eecb5f;
  141. }
  142. .green {
  143. background-color: #7ecf51;
  144. }
  145. }
  146. }
  147. .Showtree {
  148. position: absolute;
  149. top: 55px;
  150. left: 10px;
  151. width: 280px;
  152. }
  153. </style>