Browse Source

提交统一查看船舶面板并定位,增加旅游资源回调函数

zk 1 year ago
parent
commit
38b80da763

+ 11 - 0
src/utils/map/Boat.js

@@ -7,6 +7,7 @@ import { fullExtent, clearMap, calculation, changeMap, setCamera,
     getMapScale
 } from '@/utils/map/ArcgisUtil'
 import {GetHpjShip} from "@/apis/ship";
+import {nextTick} from "vue";
 
 let boatInterval;
 let showBoat = false;
@@ -99,6 +100,16 @@ function onLocationBoat(){
     })
 }
 
+
+export  function playBoatPath(data) {
+    nextTick(() => {
+        setBoatPath(data)
+    },{immediate: true});
+    nextTick(() => {
+        playBoatHistoryPath('start')
+    },{immediate: true})
+}
+
 // 设置船舶历史轨迹
 export function setBoatPath(data){
     GetBoatAISHistoryByMMSI({

+ 9 - 0
src/views/home/ComPage.vue

@@ -20,15 +20,24 @@ import BoatPanel from './cpns/boatPanel/Index.vue'
 import SceneBox from './cpns/SceneBox.vue';
 import PicViewer from './cpns/PicViewer.vue';
 import UnderWaterLegend from './cpns/UnderWaterLegend.vue';
+import {locationBoat} from "@/utils/map/Boat";
 
 const boatPanelShow = ref(false)
 
 const boatPanelInfo = reactive({value: {}})
 
+//船舶面板显示-增加定位
 bus.on('ueRec_BoatClick', (data) => {
   boatPanelInfo.value = data
   boatPanelShow.value = true
+  locationBoat(data.mmsi,true)
+  bus.emit('closeAllBoatDockList')
 })
+watch(boatPanelShow, (newValue, oldValue) => {
+ if (!newValue){
+   locationBoat( null,false)
+ }
+});
 
 bus.on('ueRec_BoatNotFound', (data) => {
   boatPanelInfo.value = data

+ 0 - 2
src/views/home/SelectForUnit.vue

@@ -32,7 +32,6 @@
     import 'element-plus/es/components/option/style/css'
     import {GetSelectInfo} from "@/apis/other"
     import bus from '@/utils/bus'
-    import {locationBoat} from "@/utils/map/Boat";
 
     const  selectType=ref([{key:'1',name:"企业"},{key:'2',name:"船舶"}])
     const showSelect = ref(false)
@@ -95,7 +94,6 @@
 
             inputValue.value=item.shipName
             inputKey.value=item.mmsi
-            locationBoat(item.mmsi)
             bus.emit('ueRec_BoatClick',{'mmsi':item.mmsi})
         }
 

+ 17 - 7
src/views/home/cpns/boatPanel/BoatGeneral.vue

@@ -131,6 +131,9 @@ export default {
   import { ueCallBoatGuiji, ueCallSetBoatDriveSpeed, ueCallBoatDrive, ueCallBoatCloseDrive, ueCallBoatStop, ueCallBoatContinue, ueCallChangeTrackType} from '@/utils/UIInteractions'
   import {GetBoatNum} from '@/apis/boats'
 
+
+  import {playBoatPath,playBoatHistoryPath} from '@/utils/map/Boat'
+
   const tableData = reactive({value: []})
 
   const props = defineProps(['boat-info'])
@@ -169,17 +172,24 @@ export default {
     playSpeed.value = s===playSpeed.value? 1: s
     ueCallSetBoatDriveSpeed(playSpeed.value)
   }
+  // import {playBoatPath,playBoatHistoryPath} from '@/utils/map/Boat'
 
   function track_play() {
     if(timeRange.time1&&timeRange.time2) {
       playState.value=-1
-      ueCallBoatGuiji(timeRange.time1, timeRange.time2)
-      let timer = setInterval(() => {
-        if(playState.value===-1) { return }
-        ueCallBoatDrive()
-        playState.value = 1
-        clearInterval(timer)
-      }, 300);
+      // ueCallBoatGuiji(timeRange.time1, timeRange.time2)
+      console.log('轨迹回放'+ props.boatInfo.mmsi)
+      let data={
+        deviceId:  props.boatInfo.mmsi,
+        startTime:timeRange.time1,
+        endTime:timeRange.time2}
+      playBoatPath(data)
+      // let timer = setInterval(() => {
+      //   if(playState.value===-1) { return }
+      //   ueCallBoatDrive()
+      //   playState.value = 1
+      //   clearInterval(timer)
+      // }, 300);
     }
   }
   function track_stop() {

+ 4 - 3
src/views/home/cpns/boatPanel/Index.vue

@@ -26,6 +26,7 @@ import BoatDjld from './BoatDjld.vue';
 import { GetBoatInfo, GetBoatInfoByEventCode } from '@/apis/other'
 import { ueCallCloseBoat, ueCallClearAllAi, ueCallInitAll } from '@/utils/UIInteractions'
 import bus from '@/utils/bus';
+import {locationBoat} from "@/utils/map/Boat";
 
 const props = defineProps(['boat-info'])
 
@@ -74,10 +75,10 @@ watch(()=>props.boatInfo, (val) => {
 },{immediate: true})
 
 function handleClose() {
-  ueCallCloseBoat()
+  // ueCallCloseBoat()
   emit('closeBoatPanel')
-  ueCallInitAll()
-  ueCallClearAllAi()
+  // ueCallInitAll()
+  // ueCallClearAllAi()
 }
 
 </script>

+ 2 - 2
src/views/jtaq/cpns/KeyBoatList.vue

@@ -31,13 +31,13 @@ export default {
   import { ueCallPositionByType } from '@/utils/UIInteractions'
 
   import {locationBoat} from "@/utils/map/Boat";
+  import bus from "@/utils/bus";
   const props = defineProps(['list-data', 'list-title'])
 
   const list = ref(null)
 
   function handleClick(item) {
-    // ueCallPositionByType('boat',item.mmsi)
-    locationBoat(item.mmsi)
+    bus.emit('ueRec_BoatClick',{'mmsi':item.mmsi})
     setTimeout(() => {
       handleClose()
     }, 100);

+ 6 - 1
src/views/ssky/Index.vue

@@ -180,8 +180,13 @@ export default {
 
   let timer
 
+  //关闭船舶后列表选择状态
+  bus.on('closeAllBoatDockList', (state) => {
+    youlanSource.value.data.forEach(i=>i.click=false)
+
+  })
+
   bus.on('boatPanelShow', (state) => {
-    console.log(boatDockListShow.value)
     if(state&&boatDockListShow.value.toString().indexOf('ylzy')!==-1) {
       boatDockListShow.value = false
     }

+ 1 - 5
src/views/ssky/cpns/BoatDockList.vue

@@ -43,9 +43,6 @@ export default {
   import { ElMessage } from 'element-plus'
   import 'element-plus/es/components/message/style/css'
   const props = defineProps(['list-data', 'list-title'])
-
-
-  import {locationBoat} from "@/utils/map/Boat";
   // const listSlice = reactive({value: []})
 
   // onMounted(() => {
@@ -109,7 +106,6 @@ export default {
       default:
         position_type = 'boat'
         position_name = item.mmsi
-        locationBoat(item.mmsi)
         bus.emit('ueRec_BoatClick',{'mmsi':item.mmsi})
     }
 
@@ -120,8 +116,8 @@ export default {
   const emit = defineEmits(['closeBoatList'])
 
   function handleClose() {
-    clearMap({is_draw: false, is_search:true, layers: []})
     emit('closeBoatList')
+    clearMap({is_draw: false, is_search:true, layers: []})
   }
 
   function formatIndex(index) {