BoatInfo.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <div class="boat-info">
  3. <i class="dialog-close" @click="handleClose"></i>
  4. <span class="bi-title">--</span>
  5. <div class="dialog-tab bi-tab">
  6. <div :class="{'highlight': currentTab==='cbxx'}" @click="changeTab('cbxx')"><span>船舶信息</span></div>
  7. <div :class="{'highlight': currentTab==='bgxx'}" @click="changeTab('bgxx')"><span>报港信息</span></div>
  8. </div>
  9. <div class="content-cbxx" v-if="currentTab==='cbxx'">
  10. <div class="cbxx-top bottom-divider">
  11. <span>驶入黄浦江时间:</span><span>2022-10-07 12:25:34</span>
  12. </div>
  13. <ul class="boat-fields bottom-divider">
  14. <li><span>船舶编码:</span><span>--</span></li>
  15. <li><span>行驶速度:</span><span>--</span></li>
  16. <li><span>船舶长度:</span><span>--</span></li>
  17. <li><span>船舶宽度:</span><span>--</span></li>
  18. <li><span>船舶类型:</span><span>--</span></li>
  19. <li><span>航班类型:</span><span>--</span></li>
  20. </ul>
  21. <div class="boat-playback">
  22. <div class="cb-row1">
  23. <span>轨迹回放</span>
  24. </div>
  25. <div class="cb-time">
  26. <div>
  27. <i class="cbt-icon"></i>
  28. <el-date-picker
  29. v-model="timeRange.time1"
  30. type="datetime"
  31. placeholder="请选择"
  32. size="small"
  33. popper-class="date-popper"
  34. class="date-picker-custom1"
  35. value-format="YYYY-MM-DD HH:mm:ss"
  36. @change="handlePickTime"
  37. />
  38. </div>
  39. <div>
  40. <i class="cbt-icon"></i>
  41. <el-date-picker
  42. v-model="timeRange.time2"
  43. type="datetime"
  44. placeholder="请选择"
  45. size="small"
  46. popper-class="date-popper"
  47. class="date-picker-custom1"
  48. value-format="YYYY-MM-DD HH:mm:ss"
  49. @change="handlePickTime"
  50. />
  51. </div>
  52. </div>
  53. <div class="cb-play">
  54. <span class="speed" :class="{'selected': playSpeed===1.5}" @click="ChangePlaySpeed(1.5)">x1.5</span>
  55. <span class="speed" :class="{'selected': playSpeed===2}" @click="ChangePlaySpeed(2)">x2.0</span>
  56. <span class="speed" :class="{'selected': playSpeed===3}" @click="ChangePlaySpeed(3)">x3.0</span>
  57. <span class="play-btn" :class="{'btn-disabled': playState===-1}" v-show="playState<1" @click="track_play">播放</span>
  58. <span class="play-btn" v-show="playState===1||playState===2" @click="track_stop">停止</span>
  59. <span class="play-btn" v-show="playState===1" @click="track_pause">暂停</span>
  60. <span class="play-btn" v-show="playState===2" @click="track_resume">继续</span>
  61. </div>
  62. </div>
  63. </div>
  64. <div class="content-bgxx" v-if="currentTab==='bgxx'">
  65. </div>
  66. </div>
  67. </template>
  68. <script>
  69. export default {
  70. name: 'BoatInfo',
  71. }
  72. </script>
  73. <script setup>
  74. import { defineProps, reactive, ref, watch, onBeforeUnmount } from 'vue'
  75. import { ElDatePicker } from 'element-plus'
  76. import 'element-plus/es/components/date-picker/style/css'
  77. import bus from '@/utils/bus';
  78. import { useDateFormat } from '@vueuse/core'
  79. const props = defineProps(['boat-info'])
  80. const currentTab = ref('cbxx')
  81. const timeRange = reactive({
  82. time1: '',
  83. time2: ''
  84. })
  85. bus.on('ueRec_boatGuiji', (data) => {
  86. if(data.isOk=='true') {
  87. playState.value=0
  88. }
  89. })
  90. onBeforeUnmount(() => {
  91. bus.off('ueRec_boatGuiji')
  92. })
  93. function handlePickTime() {
  94. if(timeRange.time1&&timeRange.time2) {
  95. playState.value=-1
  96. ueCallBoatGuiji(timeRange.time1, timeRange.time2)
  97. }
  98. }
  99. const playSpeed = ref(1)
  100. const playState = ref(0) /* 0--未开始/已结束; 1--播放中; 2--已暂停; -1--禁用状态 */
  101. function ChangePlaySpeed(s) {
  102. playSpeed.value = s===playSpeed.value? 1: s
  103. ueCallSetBoatDriveSpeed(playSpeed.value)
  104. }
  105. function track_play() {
  106. if(playState.value===-1) { return }
  107. playState.value = 1
  108. ueCallBoatDrive()
  109. }
  110. function track_stop() {
  111. playState.value = 0
  112. ueCallBoatCloseDrive()
  113. }
  114. function track_pause() {
  115. playState.value = 2
  116. ueCallBoatStop()
  117. }
  118. function track_resume() {
  119. playState.value = 1
  120. ueCallBoatContinue()
  121. }
  122. watch(()=>props.boatInfo, (val) => {
  123. timeRange.time1 = useDateFormat((new Date).getTime() - 30 * 60 * 1000, 'YYYY-MM-DD HH:mm:00').value
  124. timeRange.time2 = useDateFormat((new Date).getTime(), 'YYYY-MM-DD HH:mm:00').value
  125. handlePickTime()
  126. }, { immediate: true })
  127. const emit = defineEmits(['closeBoatInfo'])
  128. function handleClose() {
  129. emit('closeBoatInfo')
  130. }
  131. function changeTab(name) {
  132. currentTab.value = name
  133. }
  134. </script>
  135. <style lang="scss" scoped>
  136. .boat-info {
  137. box-sizing: border-box;
  138. width: 389px;
  139. height: 395px;
  140. position: absolute;
  141. top: 26vh;
  142. left: 350px;
  143. background: url('@/assets/imgs/page_ssky/bg-boat.png') no-repeat;
  144. background-size: contain;
  145. display: flex;
  146. flex-direction: column;
  147. .dialog-close {
  148. top: 8px;
  149. }
  150. .bi-title {
  151. display: block;
  152. width: fit-content;
  153. height: 34px;
  154. padding-left: 16px;
  155. font-size: 16px;
  156. line-height: 34px;
  157. font-weight: bold;
  158. font-style: italic;
  159. color: #FFFFFF;
  160. }
  161. .bi-tab {
  162. padding-right: 20px;
  163. margin: 10px 0 14px;
  164. &>div.highlight::after {
  165. display: none;
  166. }
  167. }
  168. .bottom-divider {
  169. position: relative;
  170. &::after {
  171. content: '';
  172. position: absolute;
  173. bottom: -10px;
  174. left: 0;
  175. display: block;
  176. width: calc(100% - 10px);
  177. height: 1px;
  178. background-color: rgba($color: #fff, $alpha: 0.2);
  179. }
  180. }
  181. .content-cbxx {
  182. .cbxx-top {
  183. padding: 0 0 5px 25px;
  184. margin-bottom: 20px;
  185. span:first-child {
  186. margin-right: 3px;
  187. font-size: 14px;
  188. color: #D9E6FF;
  189. }
  190. span:last-child {
  191. font-size: 14px;
  192. font-family: BarlowBold;
  193. color: #FFD400;
  194. }
  195. }
  196. .boat-fields {
  197. padding: 0 0 0 25px;
  198. }
  199. .boat-playback {
  200. margin-top: 10px;
  201. .cb-row1 {
  202. justify-content: center;
  203. }
  204. .cb-time {
  205. padding: 0 30px 0 25px;
  206. }
  207. .cb-play {
  208. padding: 0 30px 0 40px;
  209. }
  210. }
  211. }
  212. }
  213. </style>