BoatPjyl.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  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': playState===-1}" v-show="playState<1" @click="track_play">播放</span>
  70. <span class="play-btn" v-show="playState===1||playState===2" @click="track_stop">停止</span>
  71. <span class="play-btn" v-show="playState===1" @click="track_pause">暂停</span>
  72. <span class="play-btn" v-show="playState===2" @click="track_resume">继续</span>
  73. </div>
  74. </template>
  75. <div class="content-hxyl" v-else-if="bottomType==='preview'">
  76. <span class="play-btn" :class="{'btn-disabled': previewState===-1}" v-show="previewState<1" @click="preview_play">开始</span>
  77. <span class="play-btn" v-show="previewState===1||previewState===2" @click="preview_stop">结束</span>
  78. <span class="play-btn" v-show="previewState===1" @click="preview_pause">接管</span>
  79. <span class="play-btn" v-show="previewState===2" @click="preview_resume">托管</span>
  80. </div>
  81. </div>
  82. </div>
  83. <ul class="content-lshb" v-if="currentTab==='lshb'">
  84. <li v-for="item,index in historyList.value">
  85. <span>{{ formatIndex(index+1) }}</span>
  86. <div>
  87. <div>
  88. <div>
  89. <span>{{ item.routeType }}</span>
  90. <span>{{ item.routeTime }}</span>
  91. </div>
  92. <template v-if="historyCurrent===null || historyCurrent===index">
  93. <span class="cl-btn" :class="{'btn-disabled': historyState===-1}" v-show="historyState<1" @click="history_play(item,index)">预览</span>
  94. <span class="cl-btn" v-show="historyState===1||historyState===2" @click="history_stop">停止</span>
  95. </template>
  96. </div>
  97. <div>
  98. <div>
  99. <span>售票数</span>
  100. <span>{{ item.saleNum }}</span>
  101. <i></i>
  102. <span>登船数</span>
  103. <span>{{ item.checkNum }}</span>
  104. </div>
  105. <template v-if="historyCurrent===index">
  106. <span class="cl-btn" v-show="historyState===1" @click="history_pause">暂停</span>
  107. <span class="cl-btn" v-show="historyState===2" @click="history_resume">继续</span>
  108. </template>
  109. </div>
  110. </div>
  111. </li>
  112. </ul>
  113. </div>
  114. </template>
  115. <script>
  116. export default {
  117. name: 'BoatPjyl',
  118. }
  119. </script>
  120. <script setup>
  121. import { reactive, ref, watch, onBeforeUnmount } from 'vue'
  122. import { ElDatePicker } from 'element-plus'
  123. import { GetLshb } from '../../../../apis/ssky'
  124. import 'element-plus/es/components/date-picker/style/css'
  125. import bus from '@/utils/bus'
  126. import {
  127. ueCallBoatGuiji, ueCallSetBoatDriveSpeed, ueCallBoatDrive, ueCallBoatCloseDrive, ueCallBoatStop, ueCallBoatContinue,
  128. ueCallInitAll, ueCallFindJinghua, ueCallRunJinghua, ueCallRunOpJinghua, ueCallFindZhuanhang, ueCallRunZhuanhang, ueCallRunOpZhuanhang,
  129. ueCallChangeTrackType, ueCallHistoryRun, ueCallHistoryStop, ueCallHistoryAgain, ueCallHistoryClear,ueCallClearAllAi
  130. } from '@/utils/UIInteractions'
  131. import { useDateFormat } from '@vueuse/core'
  132. const props = defineProps(['boat-info'])
  133. const cameraType = ref('follow')
  134. function toggleCamera(type) {
  135. cameraType.value = type
  136. ueCallChangeTrackType(type)
  137. }
  138. const currentTab = ref('cbxx')
  139. const timeRange = reactive({
  140. time1: '',
  141. time2: ''
  142. })
  143. bus.on('ueRec_boatGuiji', (data) => {
  144. if(data.isOk=='true') {
  145. playState.value=0
  146. }
  147. })
  148. const bottomType = ref('playback')
  149. bus.on('ueRec_pujiangInit', (data) => {
  150. if(data.isOk=='true') {
  151. previewState.value=0
  152. }
  153. })
  154. function toggleBottom(type) {
  155. bottomType.value = type
  156. if(type==='preview') {
  157. ueCallInitAll()
  158. previewState.value = -1
  159. }
  160. }
  161. const playSpeed = ref(1)
  162. const playState = ref(0) /* 0--未开始/已结束; 1--播放中; 2--已暂停; -1--禁用状态 */
  163. function ChangePlaySpeed(s) {
  164. playSpeed.value = s===playSpeed.value? 1: s
  165. ueCallSetBoatDriveSpeed(playSpeed.value)
  166. }
  167. function track_play() {
  168. if(timeRange.time1&&timeRange.time2) {
  169. playState.value=-1
  170. ueCallBoatGuiji(timeRange.time1, timeRange.time2)
  171. let timer = setInterval(() => {
  172. if(playState.value===-1) { return }
  173. ueCallBoatDrive()
  174. playState.value = 1
  175. clearInterval(timer)
  176. }, 300);
  177. }
  178. }
  179. function track_stop() {
  180. playState.value = 0
  181. ueCallBoatCloseDrive()
  182. }
  183. function track_pause() {
  184. playState.value = 2
  185. ueCallBoatStop()
  186. }
  187. function track_resume() {
  188. playState.value = 1
  189. ueCallBoatContinue()
  190. }
  191. const previewState = ref(0) /* 0--未开始/已结束; 1--托管中; 2--接管中; -1--禁用状态 */
  192. function preview_play() {
  193. if(previewState.value===-1) { return }
  194. previewState.value = 1
  195. if(props.boatInfo.typeName==='经典游') {
  196. ueCallFindJinghua()
  197. ueCallRunJinghua()
  198. } else {
  199. ueCallFindZhuanhang()
  200. ueCallRunZhuanhang()
  201. }
  202. }
  203. function preview_stop() {
  204. previewState.value = 0
  205. ueCallInitAll()
  206. ueCallClearAllAi()
  207. }
  208. function preview_pause() {
  209. previewState.value = 2
  210. if(props.boatInfo.typeName==='经典游') {
  211. ueCallRunOpJinghua()
  212. }else {
  213. ueCallRunOpZhuanhang()
  214. }
  215. }
  216. function preview_resume() {
  217. previewState.value = 1
  218. if(props.boatInfo.typeName==='经典游') {
  219. ueCallRunOpJinghua()
  220. }else {
  221. ueCallRunOpZhuanhang()
  222. }
  223. }
  224. const historyList = reactive({value: []})
  225. function formatIndex(index) {
  226. return index.toString().padStart(2, '0')
  227. }
  228. const historyState = ref(0) /* 0--未开始/已结束; 1--播放中; 2--已暂停; -1--禁用状态 */
  229. const historyCurrent = ref(null)
  230. bus.on('ueRec_HistoryRun', (data) => {
  231. if(data.isOk=='true') {
  232. historyState.value=1
  233. }
  234. })
  235. function history_play(item,index) {
  236. if(previewState.value===-1) { return }
  237. historyCurrent.value = index
  238. historyState.value = -1
  239. ueCallHistoryRun(item.routeTypeId, item.mmsi, item.routeTime.slice(0,10)+'%20'+item.routeTime.slice(11))
  240. }
  241. function history_pause() {
  242. ueCallHistoryStop()
  243. historyState.value = 2
  244. }
  245. function history_resume() {
  246. ueCallHistoryAgain()
  247. historyState.value = 1
  248. }
  249. function history_stop() {
  250. ueCallHistoryClear()
  251. historyState.value = 0
  252. historyCurrent.value = null
  253. }
  254. watch(()=>props.boatInfo.mmsi, (val) => {
  255. GetLshb(val).then(res => {
  256. historyList.value = res.data.Rows.slice(0,4)
  257. timeRange.time1 = useDateFormat((new Date).getTime() - 30 * 60 * 1000, 'YYYY-MM-DD HH:mm:00').value
  258. timeRange.time2 = useDateFormat((new Date).getTime(), 'YYYY-MM-DD HH:mm:00').value
  259. })
  260. }, { immediate: true })
  261. const emit = defineEmits(['closeBoatInfo'])
  262. function changeTab(name) {
  263. currentTab.value = name
  264. }
  265. onBeforeUnmount(() => {
  266. bus.off('ueRec_boatGuiji')
  267. bus.off('ueRec_boatFockClear')
  268. bus.off('ueRec_pujiangInit')
  269. bus.off('ueRec_HistoryRun')
  270. // ueCallInitAll()
  271. ueCallBoatCloseDrive()
  272. ueCallHistoryClear()
  273. ueCallClearAllAi()
  274. })
  275. </script>
  276. <style lang="scss" scoped>
  277. .boat-info {
  278. box-sizing: border-box;
  279. width: 389px;
  280. height: 445px;
  281. background: url('@/assets/imgs/page_ssky/bg-pjylboat.png') no-repeat;
  282. background-size: contain;
  283. display: flex;
  284. flex-direction: column;
  285. &.bg-hxyl {
  286. height: 395px;
  287. background: url('@/assets/imgs/page_ssky/bg-boat.png') no-repeat;
  288. background-size: contain;
  289. }
  290. .dialog-close {
  291. top: 8px;
  292. }
  293. .bi-tab {
  294. padding-right: 20px;
  295. margin: 10px 0 14px;
  296. &>div.highlight::after {
  297. display: none;
  298. }
  299. }
  300. .content-cbxx {
  301. .cbxx-top {
  302. padding-left: 25px;
  303. margin-bottom: 20px;
  304. text-align: left;
  305. span:first-child {
  306. margin-right: 3px;
  307. font-size: 14px;
  308. color: #D9E6FF;
  309. }
  310. span:last-child {
  311. font-size: 14px;
  312. font-family: BarlowBold;
  313. color: #FFD400;
  314. }
  315. }
  316. .boat-fields {
  317. padding: 0 0 0 25px;
  318. }
  319. .cbxx-sales {
  320. box-sizing: border-box;
  321. padding-left: 25px;
  322. display: flex;
  323. align-items: center;
  324. margin: 20px 0 10px 0;
  325. &>div {
  326. width: 50%;
  327. display: flex;
  328. align-items: center;
  329. span:first-child {
  330. font-size: 14px;
  331. color: #D9E6FF;
  332. margin-right: 11px;
  333. }
  334. span:last-child {
  335. font-size: 14px;
  336. font-family: BarlowBold;
  337. color: #00FF95;
  338. }
  339. }
  340. }
  341. .boat-playback {
  342. .cb-time {
  343. padding: 0 30px 0 25px;
  344. }
  345. .cb-play {
  346. padding: 0 30px 0 40px;
  347. }
  348. }
  349. }
  350. .content-lshb {
  351. flex: 1;
  352. padding: 0 45px 20px 35px;
  353. display: flex;
  354. flex-direction: column;
  355. justify-content: space-around;
  356. &>li {
  357. height: 58px;
  358. width: 100%;
  359. display: flex;
  360. align-items: flex-start;
  361. background: url('@/assets/imgs/page_yyjg/ent-item-bg.png') no-repeat;
  362. background-size: 100% 2px;
  363. background-position: bottom;
  364. &>span {
  365. margin-right: 30px;
  366. font-size: 28px;
  367. font-family: BarlowBold;
  368. color: #FBFDFF;
  369. line-height: 28px;
  370. }
  371. &>div {
  372. flex: 1;
  373. .cl-btn {
  374. display: block;
  375. width: 55px;
  376. height: 20px;
  377. font-size: 13px;
  378. font-style: italic;
  379. color: #FFFFFF;
  380. line-height: 20px;
  381. text-align: center;
  382. background: url('@/assets/imgs/page_ssky/bg-btn-blue.png');
  383. background-size: contain;
  384. cursor: pointer;
  385. }
  386. &>div:first-child {
  387. display: flex;
  388. justify-content: space-between;
  389. align-items: center;
  390. height: 20px;
  391. &>div {
  392. display: flex;
  393. align-items: center;
  394. &>span:nth-child(1) {
  395. font-size: 14px;
  396. font-weight: bold;
  397. color: #FBFDFF;
  398. }
  399. &>span:nth-child(2) {
  400. margin-left: 10px;
  401. font-size: 14px;
  402. font-family: Barlow;
  403. color: rgba($color: #FBFDFF, $alpha: 0.6);
  404. }
  405. }
  406. }
  407. &>div:last-child {
  408. display: flex;
  409. justify-content: space-between;
  410. align-items: center;
  411. margin-top: 8px;
  412. height: 20px;
  413. &>div {
  414. display: flex;
  415. align-items: center;
  416. &>span:nth-child(1), &>span:nth-child(4) {
  417. margin-right: 7px;
  418. font-size: 14px;
  419. color: #FBFDFF;
  420. }
  421. &>span:nth-child(2), &>span:nth-child(5) {
  422. font-size: 14px;
  423. font-family: Barlow;
  424. color: #FFEA00;
  425. }
  426. &>i:nth-child(3) {
  427. display: block;
  428. height: 12px;
  429. border-right: 1px dashed #ddd;
  430. margin: 0 6px 0 20px;
  431. }
  432. }
  433. }
  434. }
  435. }
  436. }
  437. .content-hxyl {
  438. box-sizing: border-box;
  439. margin-top: 15px;
  440. display: flex;
  441. justify-content: center;
  442. align-items: center;
  443. &>span:not(.btn-disabled):hover {
  444. filter: brightness(1.3);
  445. }
  446. .play-btn {
  447. display: block;
  448. width: 79px;
  449. height: 30px;
  450. margin-left: 5px;
  451. background: url('@/assets/imgs/page_kkjk/bi-bg-btn2.png');
  452. background-size: contain;
  453. font-size: 13px;
  454. font-weight: 400;
  455. color: #ddd;
  456. text-align: center;
  457. line-height: 30px;
  458. cursor: pointer;
  459. }
  460. }
  461. }
  462. </style>