BoatPjyl.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. <template>
  2. <div class="boat-info" :class="{'bg-hxyl': bottomType==='preview'}">
  3. <div class="bi-header">
  4. <span class="bih-title">{{ props.boatInfo.shipNameCn || '未查到信息' }}</span>
  5. <div class="bih-btns">
  6. <span :class="{'highlight': cameraType==='down'}" @click="toggleCamera('down')">船身</span>
  7. <span :class="{'highlight': cameraType==='in'}" @click="toggleCamera('in')">船舱</span>
  8. <span :class="{'highlight': cameraType==='follow'}" @click="toggleCamera('follow')">船尾</span>
  9. </div>
  10. </div>
  11. <div class="dialog-tab bi-tab" :class="{'bottom-divider': currentTab==='lshb'}">
  12. <div :class="{'highlight': currentTab==='cbxx'}" @click="changeTab('cbxx')"><span>船舶信息</span></div>
  13. <div :class="{'highlight': currentTab==='lshb'}" @click="changeTab('lshb')"><span>历史航班</span></div>
  14. </div>
  15. <div class="content-cbxx" v-if="currentTab==='cbxx'">
  16. <div class="cbxx-top bottom-divider">
  17. <span>今日航班运营时间:</span><span>{{ props.boatInfo.scheduleTime? props.boatInfo.scheduleTime.slice(11,16) : '-'}}</span>
  18. </div>
  19. <ul class="boat-fields bottom-divider">
  20. <li><span>船舶编码:</span><span>{{ props.boatInfo.mmsi }}</span></li>
  21. <li><span>行驶速度:</span><span>{{ props.boatInfo.velocity }}节</span></li>
  22. <li><span>船舶长度:</span><span>{{ props.boatInfo.shipLength }}米</span></li>
  23. <li><span>船舶宽度:</span><span>{{ props.boatInfo.shipBreadth }}米</span></li>
  24. <li><span>船舶类型:</span><span>{{ props.boatInfo.shipTypeName }}</span></li>
  25. <li><span>航班类型:</span><span>{{ props.boatInfo.typeName || '-' }}</span></li>
  26. <li style="margin-bottom: 0;"><span>满载吃水:</span><span>{{ props.boatInfo.loadedDraft || '-' }}</span></li>
  27. <li style="margin-bottom: 0;"><span>空载吃水:</span><span>{{ props.boatInfo.noLoadedDraft || '-' }}</span></li>
  28. </ul>
  29. <div class="cbxx-sales bottom-divider">
  30. <div><span>本次航线售票数</span><span>{{ props.boatInfo.saleNum || '-' }}</span></div>
  31. <div><span>本次航线登船数</span><span>{{ props.boatInfo.checkNum || '-' }}</span></div>
  32. </div>
  33. <div class="boat-playback">
  34. <div class="cb-row1">
  35. <span :class="{'highlight': bottomType==='playback'}" @click="toggleBottom('playback')">轨迹回放</span>
  36. <span :class="{'highlight': bottomType==='preview'}" @click="toggleBottom('preview')">航线预览</span>
  37. </div>
  38. <template v-if="bottomType==='playback'">
  39. <div class="cb-time">
  40. <div>
  41. <i class="cbt-icon"></i>
  42. <el-date-picker
  43. v-model="timeRange.time1"
  44. type="datetime"
  45. placeholder="请选择"
  46. size="small"
  47. popper-class="date-popper"
  48. class="date-picker-custom1"
  49. value-format="YYYY-MM-DD HH:mm:ss"
  50. />
  51. </div>
  52. <div>
  53. <i class="cbt-icon"></i>
  54. <el-date-picker
  55. v-model="timeRange.time2"
  56. type="datetime"
  57. placeholder="请选择"
  58. size="small"
  59. popper-class="date-popper"
  60. class="date-picker-custom1"
  61. value-format="YYYY-MM-DD HH:mm:ss"
  62. />
  63. </div>
  64. </div>
  65. <div class="cb-play">
  66. <!-- <span class="speed" :class="{'selected': playSpeed===1.5}" @click="ChangePlaySpeed(1.5)">x1.5</span>-->
  67. <!-- <span class="speed" :class="{'selected': playSpeed===2}" @click="ChangePlaySpeed(2)">x2.0</span>-->
  68. <!-- <span class="speed" :class="{'selected': playSpeed===3}" @click="ChangePlaySpeed(3)">x3.0</span>-->
  69. <span class="play-btn" :class="{'btn-disabled': playJaShi===1}" v-show="playState<2" @click="preview_moni(true)">模拟驾驶</span>
  70. <span class="play-btn" :class="{'btn-disabled': playJaShi===0}" v-show="playState<2" @click="preview_moni(false)">关闭驾驶</span>
  71. <span class="play-btn" :class="{'btn-disabled': playState===-1}" v-show="playState<2" @click="track_play(1)">轨迹点</span>
  72. <span class="play-btn" v-show="playState<2" @click="track_play(2)">播放</span>
  73. <span class="play-btn" v-show="playState===2" @click="track_pause">暂停</span>
  74. <span class="play-btn" v-show="playState===3" @click="track_resume">继续</span>
  75. <span class="play-btn" v-show="playState===2||playState===3" @click="track_stop">停止</span>
  76. </div>
  77. </template>
  78. <div class="content-hxyl" v-else-if="bottomType==='preview'">
  79. <span class="play-btn" :class="{'btn-disabled': previewState===-1}" v-show="previewState<1" @click="preview_play">开始</span>
  80. <span class="play-btn" v-show="previewState===1||previewState===2" @click="preview_stop">结束</span>
  81. <span class="play-btn" v-show="previewState===1" @click="preview_pause">接管</span>
  82. <span class="play-btn" v-show="previewState===2" @click="preview_resume">托管</span>
  83. </div>
  84. </div>
  85. </div>
  86. <ul class="content-lshb" v-if="currentTab==='lshb'">
  87. <li v-for="item,index in historyList.value">
  88. <span>{{ formatIndex(index+1) }}</span>
  89. <div>
  90. <div>
  91. <div>
  92. <span>{{ item.routeType }}</span>
  93. <span>{{ item.routeTime }}</span>
  94. </div>
  95. <template v-if="historyCurrent===null || historyCurrent===index">
  96. <span class="cl-btn" :class="{'btn-disabled': historyState===-1}" v-show="historyState<1" @click="history_play(item,index)">预览</span>
  97. <span class="cl-btn" v-show="historyState===1||historyState===2" @click="history_stop">停止</span>
  98. </template>
  99. </div>
  100. <div>
  101. <div>
  102. <span>售票数</span>
  103. <span>{{ item.saleNum }}</span>
  104. <i></i>
  105. <span>登船数</span>
  106. <span>{{ item.checkNum }}</span>
  107. </div>
  108. <template v-if="historyCurrent===index">
  109. <span class="cl-btn" v-show="historyState===1" @click="history_pause">暂停</span>
  110. <span class="cl-btn" v-show="historyState===2" @click="history_resume">继续</span>
  111. </template>
  112. </div>
  113. </div>
  114. </li>
  115. </ul>
  116. </div>
  117. </template>
  118. <script>
  119. export default {
  120. name: 'BoatPjyl',
  121. }
  122. </script>
  123. <script setup>
  124. import { reactive, ref, watch, onBeforeUnmount } from 'vue'
  125. import { ElDatePicker,ElMessage } from 'element-plus'
  126. import 'element-plus/es/components/message/style/css'
  127. import { GetLshb } from '../../../../apis/ssky'
  128. import 'element-plus/es/components/date-picker/style/css'
  129. import bus from '@/utils/bus'
  130. import {boatDriving} from '@/utils/map/Boat'
  131. import {
  132. ueCallBoatGuiji, ueCallSetBoatDriveSpeed, ueCallBoatDrive, ueCallBoatCloseDrive, ueCallBoatStop, ueCallBoatContinue,
  133. ueCallInitAll, ueCallFindJinghua, ueCallRunJinghua, ueCallRunOpJinghua, ueCallFindZhuanhang, ueCallRunZhuanhang, ueCallRunOpZhuanhang,
  134. ueCallChangeTrackType, ueCallHistoryRun, ueCallHistoryStop, ueCallHistoryAgain, ueCallHistoryClear,ueCallClearAllAi
  135. } from '@/utils/UIInteractions'
  136. import { useDateFormat } from '@vueuse/core'
  137. const props = defineProps(['boat-info'])
  138. const cameraType = ref('follow')
  139. function toggleCamera(type) {
  140. cameraType.value = type
  141. ueCallChangeTrackType(type)
  142. }
  143. const currentTab = ref('cbxx')
  144. const timeRange = reactive({
  145. time1: '',
  146. time2: ''
  147. })
  148. bus.on('ueRec_boatGuiji', (data) => {
  149. if(data.isOk=='true') {
  150. playState.value=0
  151. }
  152. else {
  153. ElMessage({type: 'warning',message:'此船舶该时段未查到轨迹点'})
  154. }
  155. })
  156. const playJaShi = ref(0)
  157. function preview_moni(type)
  158. {
  159. if (type)
  160. {
  161. playJaShi.value=1
  162. }else {
  163. playJaShi.value=0
  164. }
  165. boatDriving(type)
  166. }
  167. const bottomType = ref('playback')
  168. bus.on('ueRec_pujiangInit', (data) => {
  169. if(data.isOk=='true') {
  170. previewState.value=0
  171. }
  172. })
  173. function toggleBottom(type) {
  174. bottomType.value = type
  175. if(type==='preview') {
  176. ueCallInitAll()
  177. previewState.value = -1
  178. }
  179. }
  180. const playSpeed = ref(1)
  181. const playState = ref(0) /* 0--未开始/已结束; 1--播放中; 2--已暂停; -1--禁用状态 */
  182. function ChangePlaySpeed(s) {
  183. playSpeed.value = s===playSpeed.value? 1: s
  184. ueCallSetBoatDriveSpeed(playSpeed.value)
  185. }
  186. function track_play() {
  187. if(timeRange.time1&&timeRange.time2) {
  188. playState.value=-1
  189. let data={
  190. mmsi: props.boatInfo.mmsi,
  191. startTime:timeRange.time1,
  192. endTime:timeRange.time2}
  193. if (types==1)
  194. {
  195. bus.emit('playBoatPath', data)
  196. }else {
  197. bus.emit('playBoatHistoryPath', 'start')
  198. }
  199. playState.value = 1
  200. // ueCallBoatGuiji(timeRange.time1, timeRange.time2)
  201. // let timer = setInterval(() => {
  202. // if(playState.value===-1) { return }
  203. // ueCallBoatDrive()
  204. // playState.value = 1
  205. // clearInterval(timer)
  206. // }, 300);
  207. }
  208. }
  209. function track_stop() {
  210. bus.emit('playBoatHistoryPath', 'stop')
  211. playState.value = 0
  212. }
  213. function track_pause() {
  214. bus.emit('playBoatHistoryPath', 'pause')
  215. playState.value = 3
  216. }
  217. function track_resume() {
  218. bus.emit('playBoatHistoryPath', 'resume')
  219. playState.value = 2
  220. }
  221. const previewState = ref(0) /* 0--未开始/已结束; 1--托管中; 2--接管中; -1--禁用状态 */
  222. function preview_play() {
  223. if(previewState.value===-1) { return }
  224. previewState.value = 1
  225. if(props.boatInfo.typeName==='经典游') {
  226. ueCallFindJinghua()
  227. ueCallRunJinghua()
  228. } else {
  229. ueCallFindZhuanhang()
  230. ueCallRunZhuanhang()
  231. }
  232. }
  233. function preview_stop() {
  234. previewState.value = 0
  235. ueCallInitAll()
  236. ueCallClearAllAi()
  237. }
  238. function preview_pause() {
  239. previewState.value = 2
  240. if(props.boatInfo.typeName==='经典游') {
  241. ueCallRunOpJinghua()
  242. }else {
  243. ueCallRunOpZhuanhang()
  244. }
  245. }
  246. function preview_resume() {
  247. previewState.value = 1
  248. if(props.boatInfo.typeName==='经典游') {
  249. ueCallRunOpJinghua()
  250. }else {
  251. ueCallRunOpZhuanhang()
  252. }
  253. }
  254. const historyList = reactive({value: []})
  255. function formatIndex(index) {
  256. return index.toString().padStart(2, '0')
  257. }
  258. const historyState = ref(0) /* 0--未开始/已结束; 1--播放中; 2--已暂停; -1--禁用状态 */
  259. const historyCurrent = ref(null)
  260. bus.on('ueRec_HistoryRun', (data) => {
  261. if(data.isOk=='true') {
  262. historyState.value=1
  263. }
  264. })
  265. function history_play(item,index) {
  266. if(previewState.value===-1) { return }
  267. historyCurrent.value = index
  268. historyState.value = -1
  269. ueCallHistoryRun(item.routeTypeId, item.mmsi, item.routeTime.slice(0,10)+'%20'+item.routeTime.slice(11))
  270. }
  271. function history_pause() {
  272. ueCallHistoryStop()
  273. historyState.value = 2
  274. }
  275. function history_resume() {
  276. ueCallHistoryAgain()
  277. historyState.value = 1
  278. }
  279. function history_stop() {
  280. ueCallHistoryClear()
  281. historyState.value = 0
  282. historyCurrent.value = null
  283. }
  284. watch(()=>props.boatInfo.mmsi, (val) => {
  285. GetLshb(val).then(res => {
  286. historyList.value = res.data.Rows.slice(0,4)
  287. timeRange.time1 = useDateFormat((new Date).getTime() - 30 * 60 * 1000, 'YYYY-MM-DD HH:mm:00').value
  288. timeRange.time2 = useDateFormat((new Date).getTime(), 'YYYY-MM-DD HH:mm:00').value
  289. })
  290. }, { immediate: true })
  291. const emit = defineEmits(['closeBoatInfo'])
  292. function changeTab(name) {
  293. currentTab.value = name
  294. }
  295. onBeforeUnmount(() => {
  296. bus.off('ueRec_boatGuiji')
  297. bus.off('ueRec_boatFockClear')
  298. bus.off('ueRec_pujiangInit')
  299. bus.off('ueRec_HistoryRun')
  300. // ueCallInitAll()
  301. ueCallBoatCloseDrive()
  302. ueCallHistoryClear()
  303. ueCallClearAllAi()
  304. })
  305. </script>
  306. <style lang="scss" scoped>
  307. .boat-info {
  308. box-sizing: border-box;
  309. width: 389px;
  310. height: 445px;
  311. background: url('@/assets/imgs/page_ssky/bg-pjylboat.png') no-repeat;
  312. background-size: contain;
  313. display: flex;
  314. flex-direction: column;
  315. &.bg-hxyl {
  316. height: 395px;
  317. background: url('@/assets/imgs/page_ssky/bg-boat.png') no-repeat;
  318. background-size: contain;
  319. }
  320. .dialog-close {
  321. top: 8px;
  322. }
  323. .bi-tab {
  324. padding-right: 20px;
  325. margin: 10px 0 14px;
  326. &>div.highlight::after {
  327. display: none;
  328. }
  329. }
  330. .content-cbxx {
  331. .cbxx-top {
  332. padding-left: 25px;
  333. margin-bottom: 20px;
  334. text-align: left;
  335. span:first-child {
  336. margin-right: 3px;
  337. font-size: 14px;
  338. color: #D9E6FF;
  339. }
  340. span:last-child {
  341. font-size: 14px;
  342. font-family: BarlowBold;
  343. color: #FFD400;
  344. }
  345. }
  346. .boat-fields {
  347. padding: 0 0 0 25px;
  348. }
  349. .cbxx-sales {
  350. box-sizing: border-box;
  351. padding-left: 25px;
  352. display: flex;
  353. align-items: center;
  354. margin: 20px 0 10px 0;
  355. &>div {
  356. width: 50%;
  357. display: flex;
  358. align-items: center;
  359. span:first-child {
  360. font-size: 14px;
  361. color: #D9E6FF;
  362. margin-right: 11px;
  363. }
  364. span:last-child {
  365. font-size: 14px;
  366. font-family: BarlowBold;
  367. color: #00FF95;
  368. }
  369. }
  370. }
  371. .boat-playback {
  372. .cb-time {
  373. padding: 0 30px 0 25px;
  374. }
  375. .cb-play {
  376. padding: 0 30px 0 30px;
  377. display: flex;
  378. justify-content: center;
  379. }
  380. }
  381. }
  382. .content-lshb {
  383. flex: 1;
  384. padding: 0 45px 20px 35px;
  385. display: flex;
  386. flex-direction: column;
  387. justify-content: space-around;
  388. &>li {
  389. height: 58px;
  390. width: 100%;
  391. display: flex;
  392. align-items: flex-start;
  393. background: url('@/assets/imgs/page_yyjg/ent-item-bg.png') no-repeat;
  394. background-size: 100% 2px;
  395. background-position: bottom;
  396. &>span {
  397. margin-right: 30px;
  398. font-size: 28px;
  399. font-family: BarlowBold;
  400. color: #FBFDFF;
  401. line-height: 28px;
  402. }
  403. &>div {
  404. flex: 1;
  405. .cl-btn {
  406. display: block;
  407. width: 55px;
  408. height: 20px;
  409. font-size: 13px;
  410. font-style: italic;
  411. color: #FFFFFF;
  412. line-height: 20px;
  413. text-align: center;
  414. background: url('@/assets/imgs/page_ssky/bg-btn-blue.png');
  415. background-size: contain;
  416. cursor: pointer;
  417. }
  418. &>div:first-child {
  419. display: flex;
  420. justify-content: space-between;
  421. align-items: center;
  422. height: 20px;
  423. &>div {
  424. display: flex;
  425. align-items: center;
  426. &>span:nth-child(1) {
  427. font-size: 14px;
  428. font-weight: bold;
  429. color: #FBFDFF;
  430. }
  431. &>span:nth-child(2) {
  432. margin-left: 10px;
  433. font-size: 14px;
  434. font-family: Barlow;
  435. color: rgba($color: #FBFDFF, $alpha: 0.6);
  436. }
  437. }
  438. }
  439. &>div:last-child {
  440. display: flex;
  441. justify-content: space-between;
  442. align-items: center;
  443. margin-top: 8px;
  444. height: 20px;
  445. &>div {
  446. display: flex;
  447. align-items: center;
  448. &>span:nth-child(1), &>span:nth-child(4) {
  449. margin-right: 7px;
  450. font-size: 14px;
  451. color: #FBFDFF;
  452. }
  453. &>span:nth-child(2), &>span:nth-child(5) {
  454. font-size: 14px;
  455. font-family: Barlow;
  456. color: #FFEA00;
  457. }
  458. &>i:nth-child(3) {
  459. display: block;
  460. height: 12px;
  461. border-right: 1px dashed #ddd;
  462. margin: 0 6px 0 20px;
  463. }
  464. }
  465. }
  466. }
  467. }
  468. }
  469. .content-hxyl {
  470. box-sizing: border-box;
  471. margin-top: 15px;
  472. display: flex;
  473. justify-content: center;
  474. align-items: center;
  475. &>span:not(.btn-disabled):hover {
  476. filter: brightness(1.3);
  477. }
  478. .play-btn {
  479. display: block;
  480. width: 79px;
  481. height: 30px;
  482. margin-left: 5px;
  483. background: url('@/assets/imgs/page_kkjk/bi-bg-btn2.png');
  484. background-size: contain;
  485. font-size: 13px;
  486. font-weight: 400;
  487. color: #ddd;
  488. text-align: center;
  489. line-height: 30px;
  490. cursor: pointer;
  491. }
  492. }
  493. }
  494. </style>