温红权 3 years ago
parent
commit
bf56358e36

+ 52 - 39
ruoyi-ui/src/components/map/index.vue

@@ -195,16 +195,16 @@
                                 <template slot-scope="scope">
                       <div v-if="scope.row.so2Percent!=null && scope.row.so2Percent > normalPer" style="color:red">{{ scope.row.so2Percent }}% ↑ {{ ((scope.row.so2Percent - normalPer) / normalPer * 100).toFixed(0) }}%</div>
                       <div v-if="scope.row.so2Percent!=null && scope.row.so2Percent <= normalPer">{{ scope.row.so2Percent }}%</div>
-</template>
+                    </template>
               </el-table-column>
               <el-table-column
                 :label="'黑度'">
-<template slot-scope="scope">
-    <div v-if="scope.row.rcgSoot!=null && scope.row.rcgSoot > normalCount" style="color:red">
-        {{ scope.row.rcgSoot }}度 ↑ {{ ((scope.row.rcgSoot - normalCount) / normalCount * 100).toFixed(0) }}%
-    </div>
-    <div v-if="scope.row.rcgSoot!=null &&  scope.row.rcgSoot <= normalCount">{{ scope.row.rcgSoot }}度</div>
-</template>
+                  <template slot-scope="scope">
+                      <div v-if="scope.row.rcgSoot!=null && scope.row.rcgSoot > normalCount" style="color:red">
+                          {{ scope.row.rcgSoot }}度 ↑ {{ ((scope.row.rcgSoot - normalCount) / normalCount * 100).toFixed(0) }}%
+                      </div>
+                      <div v-if="scope.row.rcgSoot!=null &&  scope.row.rcgSoot <= normalCount">{{ scope.row.rcgSoot }}度</div>
+                  </template>
               </el-table-column>
               <el-table-column
                 property="createTime"
@@ -236,41 +236,41 @@
               <el-table-column
                 :label="'SO2浓度'"
               >
-<template slot-scope="scope">
-    <div v-if="scope.row.so2Concentration!=null && scope.row.so2Concentration > normalPer" style="color:red">
-        {{ scope.row.so2Concentration }}% ↑
-    </div>
-    <div v-if="scope.row.so2Concentration!=null && scope.row.so2Concentration <= normalPer">{{ scope.row.so2Concentration }}%</div>
-</template>
+                 <template slot-scope="scope">
+                     <div v-if="scope.row.so2Concentration!=null && scope.row.so2Concentration > normalPer" style="color:red">
+                         {{ scope.row.so2Concentration }}% ↑
+                     </div>
+                     <div v-if="scope.row.so2Concentration!=null && scope.row.so2Concentration <= normalPer">{{ scope.row.so2Concentration }}%</div>
+                 </template>
               </el-table-column>
               <el-table-column
                 :label="'NO2浓度'"
               >
-<template slot-scope="scope">
-    <div v-if="scope.row.no2Concentration!=null && scope.row.no2Concentration > normalPer" style="color:red">
-        {{ scope.row.no2Concentration }}% ↑
-    </div>
-    <div v-if="scope.row.no2Concentration!=null && scope.row.no2Concentration <= normalPer">{{ scope.row.no2Concentration }}%</div>
-</template>
+                 <template slot-scope="scope">
+                     <div v-if="scope.row.no2Concentration!=null && scope.row.no2Concentration > normalPer" style="color:red">
+                         {{ scope.row.no2Concentration }}% ↑
+                     </div>
+                     <div v-if="scope.row.no2Concentration!=null && scope.row.no2Concentration <= normalPer">{{ scope.row.no2Concentration }}%</div>
+                 </template>
               </el-table-column>
               <el-table-column
                 :label="'CO2浓度'"
               >
-<template slot-scope="scope">
-    <div v-if="scope.row.co2Concentration!=null &&  scope.row.co2Concentration > normalPer" style="color:red">
-        {{ scope.row.co2Concentration }}% ↑
-    </div>
-    <div v-if=" scope.row.co2Concentration!=null && scope.row.co2Concentration <= normalPer">{{ scope.row.co2Concentration }}%</div>
-</template>
+                 <template slot-scope="scope">
+                     <div v-if="scope.row.co2Concentration!=null &&  scope.row.co2Concentration > normalPer" style="color:red">
+                         {{ scope.row.co2Concentration }}% ↑
+                     </div>
+                     <div v-if=" scope.row.co2Concentration!=null && scope.row.co2Concentration <= normalPer">{{ scope.row.co2Concentration }}%</div>
+                 </template>
               </el-table-column>
               <el-table-column
                 :label="'硫碳比'">
-<template slot-scope="scope">
-    <div v-if="scope.row.so2Percent!=null && scope.row.so2Percent > normalCount" style="color:red">
-        {{ scope.row.so2Percent }}度 ↑
-    </div>
-    <div v-if="scope.row.so2Percent!=null &&  scope.row.so2Percent <= normalCount">{{ scope.row.so2Percent }}度</div>
-</template>
+                  <template slot-scope="scope">
+                      <div v-if="scope.row.so2Percent!=null && scope.row.so2Percent > normalCount" style="color:red">
+                          {{ scope.row.so2Percent }}度 ↑
+                      </div>
+                      <div v-if="scope.row.so2Percent!=null &&  scope.row.so2Percent <= normalCount">{{ scope.row.so2Percent }}度</div>
+                  </template>
               </el-table-column>
               <el-table-column
                 property="createTime"
@@ -506,9 +506,22 @@ export default {
             }
         });
 
-        this.map.on("change", function(e) {
-            that.$parent.getallshipData();
-        });
+
+        var view=this.map.getView();
+
+    view.on('change:resolution',function(e){
+        that.$parent.getallshipData();
+    });
+    view.on('change:center',function(e){
+        that.$parent.getallshipData();
+    });
+    this.map.on('moveend',function(e){
+         that.$parent.getallshipData();
+    });
+        // this.map.on("change:resolution", function(e) {
+        //    console.log('size改变!');
+        //     that.$parent.getallshipData();
+        // });
         //  this.addpoint();
         //  this.addline();
 
@@ -1024,7 +1037,7 @@ export default {
             // }
 
         },
-        addpoints: function(datas) {
+        addpoints: function(datas,name="ship_normal_") {
 
             var tt = [];
             for (const ip in datas) {
@@ -1080,15 +1093,15 @@ export default {
                 zIndex: zindex
             });
 
-            var last1 = this.posints["ship_normal_" + 1];
+            var last1 = this.posints[name + 1];
             if (last1 != undefined && last1 != null) {
                 last1.setSource(new SourceVec({
                     features: tt //这里放的就是之前的那个点,如果要放置多个点直接push到这里面就行了
                 }));
             } else {
-                if (data["mmsi"] != undefined) {
-                    this.posints["ship_normal_" + 1] = markerta;
-                }
+                // if (data["mmsi"] != undefined) {
+                   this.posints[name + 1] = markerta;
+                // }
                 this.map.addLayer(markerta); //这里是执行,执行之后点就出来了
 
             }

+ 3 - 1
ruoyi-ui/src/views/components/table/homeTable.vue

@@ -378,6 +378,7 @@ export default {
     //       }
     // },
     addshipPoint() {
+      var tt = [];
       for (var index in this.ship) {
         var obj = this.ship[index]
         var img = 'zc.png'
@@ -386,8 +387,9 @@ 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);
+        tt.push([obj.locations, obj, img, 'ship', ((obj.head == null ? 0 : parseFloat(obj.head)) - 90) * Math.PI / 180,1]);
       }
+       this.$refs.mapv.addpoints(tt,"ship");
     },
 
     addshipPointall() {