Browse Source

fix: 修复部分显示问题

TwoKe945 1 year ago
parent
commit
f9de5136ec

+ 8 - 0
app/src/api/map.js

@@ -8,3 +8,11 @@ export function getZy(params) {
     params,
   });
 }
+
+export function getCarInfo(params) {
+  return request({
+    url: "/system/ddzcjdwb/jdjc/carInfo",
+    methods: "get",
+    params,
+  });
+}

+ 100 - 8
app/src/components/Map.vue

@@ -125,7 +125,7 @@ import mapIconFire from "../assets/images/map-icon-fire.png"; // 着火点
 import mapIconSzxhs from "../assets/images/map-icon-szxhs.png"; // 市政消火栓
 import mapIconTrsy from "../assets/images/map-icon-trsy.png"; // 天然水源
 import mapIconSfsc from "../assets/images/map-icon-xfsc.png"; // 消防水池
-import { getZy } from "@/api/map.js";
+import { getZy, getCarInfo } from "@/api/map.js";
 export default {
   name: "MapContainer",
   components: {},
@@ -200,16 +200,17 @@ export default {
         jzKey: [],
         xfzKey: [],
         jgKey: [],
-        xfcKey: [],
       },
+      xfcKey: [],
       legendWindow: null,
       infoWindow: null,
+      AMap: null,
+      timer: null
     };
   },
   props: {
     id: {
-      type: Number,
-      default: 1,
+      type: String
     },
     data: {
       type: Object,
@@ -236,6 +237,7 @@ export default {
     // this.$refs.map.addEventListener('click', () => {
     //   this.$refs.mapLegend.close();
     // })
+    this.loadCarInfo();
   },
   methods: {
     changeType(type) {
@@ -243,6 +245,16 @@ export default {
         return;
       }
       let showType = JSON.parse(JSON.stringify(this.showType));
+      if (type === 'xfcKey') {
+        if (showType.indexOf(type) >= 0) {
+          showType = showType.filter((p) => p !== type);
+        } else {
+          showType.push(type);
+        }
+        this.showType = showType;
+        return;
+      }
+
       // console.log(this.markerCache);
       if (showType.indexOf(type) >= 0) {
         showType = showType.filter((p) => p !== type);
@@ -335,6 +347,76 @@ export default {
         }
       });
     },
+    loadCarInfo() {
+      console.log("=----------------------",window.timer)
+      if (window.timer) {
+        window.clearInterval(window.timer);
+        window.timer = null;
+      }
+      const id = this.id;
+      window.timer = setInterval(() => {
+        this.loadCarOps(id)
+      }, 1000)
+      console.log(window.timer)
+    },
+    loadCarOps(id) {
+      getCarInfo({
+        ajid: id
+      }).then(res => {
+        // console.log(res)
+        if( this.AMap && res.data && res.data.length > 0 && this.showType.indexOf('xfcKey') >= 0) {
+          if (this.xfcKey && this.xfcKey.length >= 0) {
+            this.xfcKey.forEach(marker => this.map.remove(marker))
+            this.xfcKey = []
+          }
+
+          res.data.forEach(item => {
+            const icon = JSON.parse(JSON.stringify(this.icons['xfcKey']));
+            const AMap = this.AMap;
+            icon.size = new AMap.Size(icon.size[0], icon.size[1]);
+            icon.imageSize = new AMap.Size(
+              icon.imageSize[0],
+              icon.imageSize[1]
+            );
+            const p = {
+              icon: 'xfcKey',
+              position: [item.longitude, item.latitude],
+              anchor: "bottom-center",
+              data: item,
+            }
+            // 消息框
+            p.icon = new AMap.Icon(icon);
+            var marker = new AMap.Marker(p);
+            let infoContent = [];
+            infoContent.push(item.cph);
+            infoContent.push(item.speed + "公里/小时");
+            let content = [
+                "<div class='info_box_contant' style=\"line-height: 30px;min-width: 250px; padding: 20px; font-size: 20px; color: #7ea2ff; font-family: 'Abel';  background: rgba(0, 0, 0, 0.82);\">" +
+                  infoContent.join("<br />") +
+                  " </div>",
+              ];
+            const infoWindow = new AMap.InfoWindow({
+              isCustom: true, //使用自定义窗体
+              content: content.join("<br>"),
+              offset: new AMap.Pixel(0, -70),
+            });
+
+            marker.on("mouseover", (e) => {
+              infoWindow.open(this.map, p.position); //后面的参数指的是经纬度,在此显示窗口
+            });
+
+            marker.on("mouseout", (e) => {
+              infoWindow.close();
+            });
+            this.xfcKey.push(marker)
+            this.map.add(marker)
+          })
+        } else if (this.xfcKey && this.xfcKey.length >= 0) {
+          this.xfcKey.forEach(marker => this.map.remove(marker))
+          this.xfcKey = []
+        }
+      })
+    },
     //刷新地图
     refershMap(val){
       if(this.radius==val) return
@@ -344,6 +426,7 @@ export default {
     addClass(item){
      return this.radius==item?'map-num active':'map-num '
     },
+
     async initMap() {
       await AMapLoader.load({
         key: "4776c927b5ebe35e9e33e5b14ec78b8f", // 申请好的Web端开发者Key,首次调用 load 时必填
@@ -351,6 +434,7 @@ export default {
         plugins: [""], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
       })
         .then((AMap) => {
+          this.AMap = AMap;
           this.map = new AMap.Map("map-container", {
             //设置地图容器id
             // viewMode: "3D", //是否为3D地图模式
@@ -363,6 +447,7 @@ export default {
             const markers = [];
             this.markers.forEach((p, i) => {
               const type = p.icon;
+              if (type == 'xfcKey') return;
               let infoContent = [];
               if (type === "jzKey" || type === "currentJzKey") {
                 infoContent.push(p.data.gcjzmc);
@@ -386,10 +471,12 @@ export default {
                 infoContent.push(p.data.code);
                 infoContent.push(p.data.sylx);
                 infoContent.push(p.data.address);
-              } else if (type === "xfcKey") {
-                infoContent.push(p.data.cph);
-                infoContent.push(p.data.speed + "公里/小时");
-              } else if (type === "lldKey") {
+              } 
+              // else if (type === "xfcKey") {
+              //   infoContent.push(p.data.cph);
+              //   infoContent.push(p.data.speed + "公里/小时");
+              // }
+              else if (type === "lldKey") {
                 infoContent.push(p.data.deviceName);
                 infoContent.push(p.data.cameraType);
               } else if (type === "xfzKey") {
@@ -731,6 +818,11 @@ export default {
       immediate: true,
       deep: true,
     },
+    id: {
+      handler() {
+        console.log("打印", this.timer)
+      }
+    }
   },
 };
 </script>

+ 10 - 0
app/src/views/Detail/components/GementUnit.vue

@@ -149,6 +149,16 @@ export default {
         console.log(res);
         if (res.data.rows) {
           this.gldw = res.data.rows.find((p) => p.rzxs === "管理单位");
+          if (!this.gldw) {
+            this.gldw = {
+              dwmc: this.detail.glzthztjzd,
+              xfaqgly: this.detail.xfaqglr,
+              xfaqglysjh: this.detail.lxfs,
+              xfaqfzr: this.detail.xfaqzrr,
+              xfaqfzrsjh: '无',
+            }
+          }
+
           this.wbdw = res.data.rows.find((p) => p.rzxs === "管理单位");
           this.list = res.data.rows.filter((p) => p.rzxs !== "管理单位");
           console.log(this.list);

+ 2 - 2
app/src/views/PoliceSituation/components/MobilizeStrength.vue

@@ -30,12 +30,12 @@ white-space: nowrap;">{{ item.yjddsj || '-'}}</span>
 			</VueSeamlessScroll>
 		</div>
 		<div class="btn">火场文书</div>
-		<div class="writ">
+		<div class="writ on">
 			<div class="writTab">
 				<div class="wenshuTxt">最新文书</div>
 				<img src="../../../assets/images/img14.png" />
 			</div>
-			<div class="content">
+			<div class="content on">
 				<div>
 					<div style="" v-if="hcws1">
 						<div class="contFlex" style="margin: 5px 0;">

+ 3 - 1
app/src/views/PoliceSituation/index.vue

@@ -39,7 +39,7 @@
         v-if="middleType === '720'"
       ></iframe>
       <div style="height: 100%; width: 100%; position: relative" v-else>
-        <Map :data="mapData" v-if="mapData && Mapflag == false" />
+        <Map :id="params.id" :data="mapData" v-if="mapData && Mapflag == false" />
         <img
           v-if="Mapflag == true"
           class="map-null"
@@ -205,6 +205,8 @@ export default {
       // 火场文书
       const hcwsId = {
         jqTywysbm: this.params.id,
+        pageNum: 1,
+        pageSize: 1000
       };
       getHcws(hcwsId).then((res) => {
         this.hcws1 = res.data.rows[0];