Index.vue 3.2 KB

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