lzRealtimeWatch.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <view class="realtimeWatch">
  3. <map-container
  4. ref="mapContainerRef"
  5. :pointsData="pointsData"
  6. @handleMarkerClick="handleMarkerClick">
  7. </map-container>
  8. <!--
  9. <view class="counts">
  10. <u-row>
  11. <u-col :span="3" class="counts-item" v-for="(item, index) in countInfo" :key="index" :class="item.class">
  12. <view class="counts-item-label" :style="item.style">{{ item.label }}</view>
  13. <view class="counts-item-value" :style="item.style">{{ item.value }}</view>
  14. </u-col>
  15. </u-row>
  16. </view> -->
  17. <view class="options">
  18. <view class="options-item" @click="showSatelliteLayer">
  19. <image
  20. style="width: 100%; height: 100%"
  21. :src="$getImages('/assetsMobile/images/map/icon/weixing.png')" />
  22. </view>
  23. <!-- <view class="options-item" @click="showPanel">
  24. <image
  25. style="width: 100%; height: 100%"
  26. :src="$getImages('/assetsMobile/images/map/icon/boxselection.png')" />
  27. </view>
  28. <view class="options-item" @click="queryLocation">
  29. <image
  30. style="width: 100%; height: 100%"
  31. :src="$getImages('/assetsMobile/images/map/icon/position.png')" />
  32. </view> -->
  33. </view>
  34. <panel ref="panelRef"></panel>
  35. <veh-info ref="vehInfoRef"></veh-info>
  36. </view>
  37. </template>
  38. <script>
  39. // import MapContainer from '@/components/MapContainer'
  40. import panel from './panel.vue'
  41. import vehInfo from './vehInfo.vue'
  42. export default {
  43. components: {
  44. // MapContainer,
  45. panel,
  46. vehInfo,
  47. },
  48. data() {
  49. return {
  50. //卫星图层
  51. isShowStelliteLayer: false,
  52. pointsData: []
  53. }
  54. },
  55. computed: {
  56. countInfo() {
  57. return this.$store.state.realtimeWatch.countInfo
  58. },
  59. },
  60. onLoad() {
  61. this.pointsData = [
  62. {
  63. "lnglat": [
  64. "113.335408",
  65. "23.13245"
  66. ],
  67. "item": {
  68. "parentId": "925205682749837312",
  69. "routeKey": "lzRealtimeWatch",
  70. "id": "925264144057896960",
  71. "vehicleId": "925264144057896960",
  72. "plate": "19223346989",
  73. "deptName": "设备测试",
  74. "isDevice": 1,
  75. "isVideo": 0,
  76. "isConcern": 0,
  77. "remark": null,
  78. "posDeviceId": "19223346989",
  79. "vehType": 25,
  80. "vehTypeName": "轿车",
  81. "driverName": null,
  82. "driverTel": null,
  83. "workTypeName": null,
  84. "workQuery": null,
  85. "lng": "113.335408",
  86. "lat": "23.13245",
  87. "location": "未获取到位置信息",
  88. "gspTime": "2024-03-06 19:09:42",
  89. "online": "0",
  90. "engineStatus": "1",
  91. "isAlarm": 0,
  92. "alarmTypeName": "长时间停车",
  93. "speed": 17,
  94. "direction": 140,
  95. "oil": 0,
  96. "water": 0,
  97. "position": "1",
  98. "pin2": "0",
  99. "icon": "/dev-api/img/upload/vehIcon/list/1_3.png",
  100. "img": "/dev-api/img/upload/vehIcon/plat/1_3.png",
  101. "tips": "离线",
  102. "filterStatus": "3",
  103. "label": "19223346989",
  104. "positionName": "定位",
  105. "pin2Name": "关",
  106. "code": "vehicle",
  107. "disabled": false
  108. }
  109. }
  110. ]
  111. },
  112. onReady() {
  113. },
  114. methods: {
  115. // 查询自身位置
  116. queryLocation() {
  117. uni.getLocation({
  118. type: "gcj02",
  119. success: (res) => {
  120. const { latitude, longitude } = res
  121. this.$refs.mapContainerRef.setZoomAndCenter(12, [longitude, latitude], true)
  122. },
  123. fail: (res) => {
  124. console.log('定位失败', JSON.stringify(res));
  125. }
  126. });
  127. },
  128. //选车辆
  129. showPanel() {
  130. this.$refs.panelRef.show()
  131. },
  132. //展示卫星图层
  133. showSatelliteLayer() {
  134. this.isShowStelliteLayer = !this.isShowStelliteLayer
  135. if (this.$refs.mapContainerRef) this.$refs.mapContainerRef.setStelliteLayer(this.isShowStelliteLayer)
  136. },
  137. //点击标注点
  138. handleMarkerClick(e) {
  139. // console.log(e,'handleMarkerClick')
  140. const { cluster } = e
  141. let item = cluster.p.item
  142. this.$refs.vehInfoRef.show(item)
  143. }
  144. },
  145. beforeDestroy() {
  146. this.$store.dispatch('setVheicleCheckArr', [])
  147. this.$store.dispatch('setPeopleCheckArr', [])
  148. }
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .realtimeWatch {
  153. width: 100%;
  154. height: 100vh;
  155. position: relative;
  156. #map {
  157. width: 750rpx;
  158. height: 100%;
  159. }
  160. .counts {
  161. position: absolute;
  162. left: 2%;
  163. top: 20rpx;
  164. width: 96%;
  165. background: #fff;
  166. border-radius: 10rpx;
  167. box-shadow: 0 2px 6px #3f57c252;
  168. // margin: 10rpx;
  169. .counts-item {
  170. padding: 14rpx 10rpx;
  171. display: flex;
  172. justify-content: center;
  173. align-items: center;
  174. flex-direction: column;
  175. .counts-item-label {
  176. font-size: 24rpx;
  177. font-family: PingFangSC-Medium, PingFang SC;
  178. font-weight: 400;
  179. color: #333333;
  180. text-align: center;
  181. }
  182. .counts-item-value {
  183. margin-top: 10rpx;
  184. font-size: 26rpx;
  185. font-family: PingFangSC-Regular, PingFang SC;
  186. font-weight: 600;
  187. color: #333333;
  188. text-align: center;
  189. }
  190. }
  191. }
  192. .options {
  193. position: absolute;
  194. width: 72rpx;
  195. right: 30rpx;
  196. bottom: 156rpx;
  197. // box-shadow: 0px 3px 30px 0px rgba(0, 0, 0, 0.15);
  198. z-index: 9999;
  199. .options-item {
  200. height: 72rpx;
  201. }
  202. .options-item+.options-item {
  203. margin-top: 20rpx;
  204. }
  205. }
  206. }
  207. </style>