sbyxjc.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <script setup>
  2. import {
  3. inject
  4. } from "vue";
  5. const getMapInstance = inject("getMapInstance");
  6. jt3d = getMapInstance();
  7. </script>
  8. <template>
  9. <div id="main5">
  10. <div class="chushuikou">
  11. <div class="chushuikou1">
  12. <div class="chushuikou1-1">
  13. <label>区域</label>
  14. <label>水泵电流</label>
  15. <label>机井压力</label>
  16. <label>实时流量</label>
  17. <label>运行状态</label>
  18. </div>
  19. </div>
  20. <div class="chushuikou2">
  21. <div class="chushuikou2-1">
  22. <label>1号机井</label>
  23. <label style="color:'#ecec66';">200A</label>
  24. <label>150kpa</label>
  25. <label>80m³/h</label>
  26. <button @click="flyto(1)"
  27. style="background-color: rgb(40,170,230);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500;margin-top:-4rem ">正常</button>
  28. </div>
  29. </div>
  30. <div class="chushuikou3">
  31. <div class="chushuikou2-1">
  32. <label>2号机井</label>
  33. <label style="color:'#ecec66';">10A</label>
  34. <label>100kpa</label>
  35. <label>10m³/h</label>
  36. <button @click="flyto(2)"
  37. style="background-color: rgb(238,80,80);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500; margin-top:-4rem">异常</button>
  38. </div>
  39. </div>
  40. <div class="chushuikou4">
  41. <div class="chushuikou2-1">
  42. <label>3号机井</label>
  43. <label style="color:'#ecec66';">200A</label>
  44. <label>150kpa</label>
  45. <label>80m³/h</label>
  46. <button @click="flyto(3)"
  47. style="background-color: rgb(40,170,230);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500; margin-top:-4rem">正常</button>
  48. </div>
  49. </div>
  50. <div class="chushuikou5">
  51. <div class="chushuikou2-1">
  52. <label>4号机井</label>
  53. <label style="color:'#ecec66';">200A</label>
  54. <label>150kpa</label>
  55. <label>80m³/h</label>
  56. <button @click="flyto(4)"
  57. style="background-color: rgb(40,170,230);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500; margin-top:-4rem">正常</button>
  58. </div>
  59. </div>
  60. <div class="chushuikou4">
  61. <div class="chushuikou2-1">
  62. <label>5号机井</label>
  63. <label style="color:'#ecec66';">200A</label>
  64. <label>150kpa</label>
  65. <label>80m³/h</label>
  66. <button @click="flyto(5)"
  67. style="background-color: rgb(40,170,230);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500; margin-top:-4rem">正常</button>
  68. </div>
  69. </div>
  70. <div class="chushuikou5">
  71. <div class="chushuikou2-1">
  72. <label>6号机井</label>
  73. <label style="color:'#ecec66';">200A</label>
  74. <label>150kpa</label>
  75. <label>80m³/h</label>
  76. <button @click="flyto(6)"
  77. style="background-color: rgb(40,170,230);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500;margin-top:-4rem ">正常</button>
  78. </div>
  79. </div>
  80. <div class="chushuikou4">
  81. <div class="chushuikou2-1">
  82. <label>7号机井</label>
  83. <label style="color:'#ecec66';">200A</label>
  84. <label>150kpa</label>
  85. <label>80m³/h</label>
  86. <button @click="flyto(7)"
  87. style="background-color: rgb(40,170,230);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500;margin-top:-4rem ">正常</button>
  88. </div>
  89. </div>
  90. <div class="chushuikou5">
  91. <div class="chushuikou2-1">
  92. <label>8号机井</label>
  93. <label style="color:'#ecec66';">20A</label>
  94. <label>10kpa</label>
  95. <label>10m³/h</label>
  96. <button @click="flyto(8)"
  97. style="background-color: rgb(238,80,80);width: 50rem;height: 20rem;color: #fff;font-size: 14rem;border: 0;font-weight:500;margin-top:-4rem ">异常</button>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. </template>
  103. <script>
  104. let jt3d = undefined;
  105. import map_xzqh_zj from '@/assets/dataFile/map_xzqh_zj.json';
  106. export default {
  107. data() {
  108. return {
  109. // viewersName: '', //视角标签名称
  110. // ImgurlList: [], //截图地址列表
  111. entity: '',
  112. }
  113. },
  114. methods: {
  115. flyto(num) {
  116. return
  117. let terrainProvider = jt3d._viewer.terrainProvider;
  118. //异步函数
  119. let lon = 116.30
  120. let lat = 36.88
  121. let that = this
  122. if (that.entity) {
  123. jt3d._viewer.entities.remove(that.entity)
  124. }
  125. // if that.entity && jt3d._viewer.entities.remove(that.entity)
  126. // console.log('高度', updatedPositions)
  127. let height = 1000
  128. that.entity1 = new Cesium.Entity({
  129. name: "add billboard",
  130. //位置
  131. position: Cesium.Cartesian3.fromDegrees(120.623, 36.9157, 100),
  132. //图片标签
  133. billboard: {
  134. image: 'jt3dSDK/imgs/point/point.png',
  135. horizontalOrigin: Cesium.HorizontalOrigin.CENTER, //水平
  136. verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直位置
  137. // scale: billboard.scale, //尺寸
  138. // pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
  139. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  140. scale: 1,
  141. // scaleByDistance: new Cesium.NearFarScalar(1.5e2, 1, 2400,
  142. // 0
  143. // ) //按距离缩放,即距离大于180米时,图标不显示 Cesium.NearFarScalar(near, nearValue, far, farValue)相机范围的下界。相机范围下界的值。相机范围的上限。该值位于摄像机范围的上界。
  144. }
  145. // point:{
  146. // pixelSize:20,
  147. // color:Cesium.Color.RED,
  148. // }
  149. });
  150. var entity = jt3d._viewer.entities.add(that.entity1, {
  151. // range: 1000
  152. });
  153. jt3d.LocateUtil.flyToEntity(that.entity)
  154. setTimeout(res=>{
  155. console.log('定位')
  156. console.log('实体', entity)
  157. jt3d.LocateUtil.flyToEntity(that.entity)
  158. jt3d._viewer.flyTo(entity,{
  159. duration:5.0,
  160. maximumHeight:1500
  161. }).then(res=>{
  162. console.log('定位结束' + res)
  163. }).catch(err=>{
  164. console.log("err" + err);
  165. })
  166. // jt3d._viewer.camera.flyTo({
  167. // destination : Cesium.Cartesian3.fromDegrees(120.623, 36.9157, 1500)
  168. // });
  169. },2000)
  170. // let lng = Number(114.22) + Number(num)
  171. // this.entity = new Cesium.Entity({
  172. // name: "add billboard",
  173. // //位置
  174. // position: Cesium.Cartesian3.fromDegrees(116.33, 37.66, 500),
  175. // //图片标签
  176. // billboard: {
  177. // image: 'jt3dSDK/imgs/point/point.png',
  178. // horizontalOrigin: Cesium.HorizontalOrigin.CENTER, //水平
  179. // verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直位置
  180. // // scale: billboard.scale, //尺寸
  181. // // pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
  182. // disableDepthTestDistance: Number.POSITIVE_INFINITY,
  183. // scale: 1,
  184. // scaleByDistance: new Cesium.NearFarScalar(1.5e2, 1, 2400, 0) //按距离缩放,即距离大于180米时,图标不显示 Cesium.NearFarScalar(near, nearValue, far, farValue)相机范围的下界。相机范围下界的值。相机范围的上限。该值位于摄像机范围的上界。
  185. // }
  186. // });
  187. // jt3d._viewer.entities.add(this.entity, {
  188. // range: 1000
  189. // });
  190. }
  191. },
  192. mounted() {
  193. // jt3d.PolylineObject.drawPolylineByGeoJson(map_xzqh_zj, {
  194. // width: 5,
  195. // color: '#04FFFF',
  196. // isImageAlpha: true, //用图片自带颜色
  197. // duration: 3000,
  198. // imgUrl: "/jt3dSDK/imgs/polylinematerial/spriteline1.png"
  199. // });
  200. }
  201. }
  202. </script>
  203. <style lang="scss" scoped>
  204. #main5 {
  205. width: calc(100% - 20rem);
  206. height: calc(100% - 20rem);
  207. margin: 10rem;
  208. .chushuikou {
  209. width: 100%;
  210. height: 175rem;
  211. margin-top: 10rem;
  212. // margin-left: 5rem;
  213. }
  214. .chushuikou1 {
  215. width: 100%;
  216. height: 35rem;
  217. background-color: rgba(61, 198, 255, 0.4);
  218. display: flex;
  219. align-items: center;
  220. }
  221. .chushuikou1-1 {
  222. font-family: SimHei;
  223. font-size: 14rem;
  224. color: #C8daf5;
  225. width: 100%;
  226. height: 13rem;
  227. display: flex;
  228. justify-content: space-around;
  229. margin: auto;
  230. }
  231. .chushuikou2-1 {
  232. font-family: SimHei;
  233. font-size: 13rem;
  234. color: #C8daf5;
  235. width: 100%;
  236. height: 13rem;
  237. display: flex;
  238. justify-content: space-around;
  239. margin: auto;
  240. // margin-left: 30rem;
  241. }
  242. .chushuikou2-2 {
  243. font-family: SimHei;
  244. font-size: 13rem;
  245. color: #C8daf5;
  246. width: 100%;
  247. height: 13rem;
  248. display: flex;
  249. justify-content: space-between;
  250. margin: auto;
  251. // margin-left: 30rem;
  252. }
  253. .chushuikou2 {
  254. width: 100%;
  255. height: 35rem;
  256. display: flex;
  257. align-items: center;
  258. }
  259. .chushuikou3 {
  260. width: 100%;
  261. height: 35rem;
  262. background-color: rgba(0, 37, 98, 0.4);
  263. display: flex;
  264. align-items: center;
  265. }
  266. .chushuikou4 {
  267. width: 100%;
  268. height: 35rem;
  269. display: flex;
  270. align-items: center;
  271. }
  272. .chushuikou5 {
  273. width: 100%;
  274. height: 35rem;
  275. background-color: rgba(0, 37, 98, 0.4);
  276. display: flex;
  277. align-items: center;
  278. }
  279. }
  280. </style>