BoatPjyl.vue 15 KB

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