Browse Source

fix 图层&跳转&范围经纬

温红权 3 years ago
parent
commit
8e36c22e1e

+ 2 - 2
ruoyi-ui/src/api/data/deviceData.js

@@ -35,9 +35,9 @@ export function queryShipData(query) {
     });
 }
 
-export function queryallShipData(query) {
+export function queryallShipData(query, urlc) {
     return request({
-        url: "/gas/common/queryRdsShipList",
+        url: "/gas/common/queryRdsShipList?" + urlc,
         method: "get",
         params: query,
     });

+ 46 - 6
ruoyi-ui/src/components/map/index.vue

@@ -325,6 +325,12 @@
       </el-radio-group>
     </div>
 
+    <div class="layer_div" style="max-width:44rem">
+      <el-checkbox-group v-model="cselect" @change="clickly">
+        <el-checkbox v-for="item in layersgroup" :key="item.name" :label="item.name"></el-checkbox>
+      </el-checkbox-group>
+    </div>
+
     <div class="shipDiv" v-show="deviceTableShow">
       <div class="shipTitle">
         <span style="float:left">{{ pointDevice.name }}</span>
@@ -405,6 +411,7 @@ export default {
     return {
       map: null,
       shipName: '',
+      layersgroup:[{name:"普通船",label:"普通船"}],
       deviceShow: false,
       deviceData: '',
       showvideos: false,
@@ -436,6 +443,7 @@ export default {
       tableData: {minor: [], main: []},
       addrlist: [{name: "南京四桥", location: [1, 1]}],
       caddr: "南京四桥",
+      cselect:[],
       shipShow: false,
       shipdata: {},
     };
@@ -506,6 +514,11 @@ export default {
 
     },1000)
 
+    window.getmapviewlatlng = function () {
+      var pps = mapv.getView().calculateExtent(mapv.getSize());
+     return( that.transpoints([[pps[0],pps[1]],[pps[2],pps[3]]],1));
+    }
+
 
 
 
@@ -541,9 +554,8 @@ export default {
 
     },
     clickcg: (value) => {
-      console.log(that.deviceList);
+
       that.pointDevice.list = that.deviceList[value];
-      console.log(that.pointDevice);
       that.deviceTableShow = true;
       that.pointDevice.name = value;
       that.addrlist.forEach(element => {
@@ -555,6 +567,24 @@ export default {
       });
 
     },
+    clickly:(value)=>{
+      if(value.indexOf('普通船')!=-1){
+        that.$parent.startgetall();
+        console.log(that.posints)
+
+      }else{
+        that.$parent.stopgetall();
+         for (const key in that.posints) {
+           var lays = that.posints[key];
+           if(lays== null) continue;
+           lays.disposeInternal();
+           that.map.removeLayer(lays);
+           that.posints[key]=null;
+         }
+
+      }
+
+    },
     setaddrlist(list) {
       this.addrlist = list;
       this.caddr = list[0].name;
@@ -881,7 +911,7 @@ export default {
 
     },
 
-    addpoint: function (addrArry, data, img, type, rotation = 0, zindex = 3) {
+    addpoint: function (addrArry, data, img, type, rotation = 0, zindex = 3,shipl="ship_") {
       var lnglat = this.transpoints(addrArry, 0)[0];
       var lnglats = null;
 
@@ -920,14 +950,14 @@ export default {
         }),
         zIndex: zindex
       });
-      var last1 = this.posints["ship_" + data["mmsi"]];
+      var last1 = this.posints[shipl + data["mmsi"]];
       if (last1 != undefined && last1 != null) {
         last1.setSource(new SourceVec({
           features: [tamarker] //这里放的就是之前的那个点,如果要放置多个点直接push到这里面就行了
         }));
       } else {
         if (data["mmsi"] != undefined) {
-          this.posints["ship_" + data["mmsi"]] = markerta;
+          this.posints[shipl + data["mmsi"]] = markerta;
         }
         this.map.addLayer(markerta); //这里是执行,执行之后点就出来了
 
@@ -940,7 +970,7 @@ export default {
 
         function addlayers(indexp) {
 
-          var last = that.posints["ship_" + data["mmsi"]];
+          var last = that.posints[shipl + data["mmsi"]];
 
 
           let tamarker = new Feature({
@@ -1081,6 +1111,16 @@ export default {
   background-color: white;
   padding-right: 4rem;
 }
+.layer_div{
+  position: absolute;
+  top: 55rem;
+  right: 160rem;
+  padding-top: 4rem;
+  padding-left: 5rem;
+  padding-right: 4rem;
+   background-color: white;
+   padding-bottom: 5rem;
+}
 
 .radio_div > div {
   line-height: 10rem;

+ 26 - 6
ruoyi-ui/src/views/components/table/homeTable.vue

@@ -144,6 +144,7 @@ export default {
       normalCount: 1,
       dialogVisibleShip: false,
       beginTime: '',
+      isstart:false,
       so2TimeData: {},
       endTime: '',
       deviceList: [],
@@ -202,7 +203,8 @@ export default {
         {"name": "润扬大桥光谱2", "locations": [[119.369724, 32.204459]]},
       ],
       allship:[],
-      ship: [
+      ship:[],
+      ship1: [
         {"name": "一号船", "mmsi": "s", "locations": [[118.643133, 31.969894]], 'type': 1, "head": 0, "lnglats": [[118.649711, 31.98602], [118.639711, 31.98602], [118.629711, 31.98602], [118.619711, 31.98602]]},
         // {"name": "二号船", "locations": [[118.639711, 31.96602]], 'type': 2,"head":60},
         {"name": "三号船", "mmsi": "s1", "locations": [[118.639711, 31.96622]], 'type': 1, "head": 90},
@@ -219,7 +221,8 @@ export default {
     this.getIllegalShipStatic();
     this.getshipData();
 
-    this.getallshipData();
+
+    // this.getallshipData();
 
     var that = this;
     setInterval(() => {
@@ -227,7 +230,10 @@ export default {
     }, 120000);
 
     setInterval(() => {
-      that.getallshipData();
+      if(that.isstart){
+         that.getallshipData();
+      }
+
     }, 5*60*1000);
 
     this.getThresholdList();
@@ -240,6 +246,14 @@ export default {
     //  this.getChart();
   },
   methods: {
+    stopgetall(){
+      this.isstart = false;
+    },
+    startgetall(){
+      this.isstart = true;
+      this.getallshipData();
+
+    },
     getThresholdList() {
       getThresholdList({type: 'bridge'}).then(response => {
         console.log(response);
@@ -296,7 +310,7 @@ export default {
           ship["type"] = ship.illegalStatus;
           shipdatalist.push(ship);
         }
-        // this.ship = shipdatalist;
+        this.ship = shipdatalist;
         this.addshipPoint();
       });
 
@@ -304,9 +318,14 @@ export default {
     },
 
     getallshipData() {
+    //    this.allship = this.ship1;
+    //  this.addshipPointall();
 
+    // console.log( this.$refs.mapv.map.getView().calculateExtent( this.$refs.mapv.map.getSize()));
 
-      queryallShipData().then(data => {
+      var sc = window.getmapviewlatlng();
+      var urlc = `areaLatitude1=${sc[0][1]}&areaLatitude2=${sc[1][1]}&areaLongitude1=${sc[0][0]}&areaLongitude2=${sc[1][0]}`;
+      queryallShipData({},urlc).then(data => {
         var shipdatalist = [];
         for (var key in data.data) {
           var ship = data.data[key];
@@ -315,6 +334,7 @@ export default {
           ship["type"] = 1;
           shipdatalist.push(ship);
         }
+        // this.allship = this.ship1;
         this.allship = shipdatalist;
         this.addshipPointall();
       });
@@ -362,7 +382,7 @@ export default {
         } else if (obj.type == 3) {
           img = 'wg.png'
         }
-        this.$refs.mapv.addpoint(obj.locations, obj, img, 'ship', ((obj.head == null ? 0 : parseFloat(obj.head)) - 90) * Math.PI / 180,1);
+        this.$refs.mapv.addpoint(obj.locations, obj, img, 'ship', ((obj.head == null ? 0 : parseFloat(obj.head)) - 90) * Math.PI / 180,1,"ship_normal_");
       }
     },
     getSo2Time() {

+ 3 - 3
ruoyi-ui/src/views/home.vue

@@ -106,10 +106,10 @@
       </div>
     </div>
     <div style="position: absolute;right: 0;color: #3FC9FD;top: 28rem;font-size: 9rem;">
-      <div style="display: inline-block;margin-right:6rem"><a :href="gosubsys('http://198.17.188.56:82','admin','111111',1)"><img style="width:20px;vertical-align: middle;margin-right:2px" src="../assets/images/txsb_selected@2x.png"/>光谱</a></div>
+      <div style="display: inline-block;margin-right:6rem"><a target="view_window" :href="gosubsys('http://198.17.188.56:82','admin','111111',1)"><img style="width:20px;vertical-align: middle;margin-right:2px" src="../assets/images/txsb_selected@2x.png"/>光谱</a></div>
       <div
-        style="display: inline-block;margin-right:6rem"><a :href="gosubsys('http://198.17.188.2:83/index.html','js_admin','js@123456',1)"><img style="width:20px;vertical-align: middle;margin-right:2px" src="../assets/images/gpsb@2x.png"/>嗅探</a></div>
-      <div style="display: inline-block;margin-right:20rem"><a :href="gosubsys('http://198.17.23.29:8090','admin','word',1)"><img style="width:20px;vertical-align: middle;margin-right:2px" src="../assets/images/heiyan@2x.png"/>黑烟</a></div>
+        style="display: inline-block;margin-right:6rem"><a target="view_window" :href="gosubsys('http://198.17.188.2:83/index.html','js_admin','js@123456',1)"><img style="width:20px;vertical-align: middle;margin-right:2px" src="../assets/images/gpsb@2x.png"/>嗅探</a></div>
+      <div style="display: inline-block;margin-right:20rem"><a  target="view_window" :href="gosubsys('http://198.17.23.29:8090','admin','word',1)"><img style="width:20px;vertical-align: middle;margin-right:2px" src="../assets/images/heiyan@2x.png"/>黑烟</a></div>
     </div>
     <div class="center_content">