Explorar o código

fix 点船定位

温红权 %!s(int64=3) %!d(string=hai) anos
pai
achega
276f58d157

+ 7 - 0
ruoyi-ui/src/api/data/deviceData.js

@@ -42,3 +42,10 @@ export function queryallShipData(query, urlc) {
         params: query,
     });
 }
+
+export function queryShipInfo(mmsi) {
+    return request({
+        url: "/gas/common/queryCurrentShip?mmsi=" + mmsi,
+        method: "get",
+    });
+}

+ 43 - 0
ruoyi-ui/src/views/components/table/homeTable.vue

@@ -257,6 +257,49 @@ export default {
     //  this.getChart();
   },
   methods: {
+    clickship(shipdata){
+
+       if (shipdata!=null && shipdata!=undefined) {
+          var ship = shipdata;
+          ship["shipName"] = ship.shipname_cn;
+          ship["locations"] = [[ship.lng, ship.lat]];
+          ship["type"] = 1;
+          ship["speed"] = ship.speed == null ? '-' : ship.speed;
+          ship["head"] = ship.head == null ? '-' : ship.head;
+          ship["course"] = ship.course == null ? '-' : ship.course;
+          ship["monitorPointName"] = '-';
+
+          var tt=[];
+          var obj = ship;
+          var img = 'zc.png'
+          if (obj.type == 2) {
+            img = 'xy.png'
+          } else if (obj.type == 3) {
+            img = 'wg.png'
+          }
+          var isin = false;
+          for(var i in this.ship){
+             if(this.ship[i]["mmsi"] == obj["mmsi"]){
+               this.ship[i] = obj;
+               isin = true;
+               break;
+             }
+          }
+          if(!isin){
+            this.ship.push(obj);
+          }
+          this.addshipPoint();
+          this.$refs.mapv.map.getView().setCenter(this.$refs.mapv.transpoints(obj["locations"], 0)[0]);
+          this.$refs.mapv.map.getView().setZoom(18);
+          this.$refs.mapv.shipShow = true;
+          this.$refs.mapv.deviceShow = false;
+          this.$refs.mapv.deviceTableShow = false
+          this.$refs.mapv.shipName = obj;
+          this.$refs.mapv.activeName = "first";
+       }
+
+
+    },
     stopgetall() {
       this.isstart = false;
     },

+ 11 - 1
ruoyi-ui/src/views/components/table/scroll.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="box">
     <div id="con1" ref="con1" :class="{anim:animate==true}" style="color:white" @mouseenter="mEnter" @mouseleave="mLeave">
-      <div v-for='item in items' style="font-size:3rem">
+      <div v-for='item in items' style="font-size:3rem" @click="clickship(item.mmsi)">
         <span>{{ item.name }}</span>
         <span style="margin-left:3rem;color:#A8A8A8">统计时间:{{ item.time }}</span>
       </div>
@@ -11,6 +11,7 @@
 
 <script>
 import {queryIllegalInfoList} from "@/api/data/staticalData";
+import {queryShipInfo} from "@/api/data/deviceData";
 
 export default {
   data() {
@@ -29,6 +30,15 @@ export default {
   },
 
   methods: {
+    clickship(mmsi){
+      // var ss = {"name": "三号船", "mmsi": "s1", "lng":118.639711,"lat":31.96622,"locations": [[118.639711, 31.96622]], 'type': 1, "head": 90};
+      // this.$parent.clickship(ss);
+
+      queryShipInfo(mmsi).then(data => {
+        this.$parent.clickship(data.data);
+      })
+
+    },
     queryIllegalInfoList() {
       queryIllegalInfoList({'illegalStatus': this.illegalStatus}).then(data => {
         this.items = data.data