From 8aa3edd56c279100c9053576f3e90fa55459fe77 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Mon, 16 Jan 2023 16:15:55 +0800
Subject: [PATCH] 修改

---
 src/views/security/security.vue |   56 +++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/src/views/security/security.vue b/src/views/security/security.vue
index ab70287..7005301 100644
--- a/src/views/security/security.vue
+++ b/src/views/security/security.vue
@@ -60,7 +60,7 @@
         form: {},
         query: {},
         loading: true,
-        showMap: true,
+        showMap: false,
         page: {
           pageSize: 10,
           currentPage: 1,
@@ -70,7 +70,7 @@
         selectionList: [],
         option: {
           height: 'auto',
-          calcHeight: 30,
+          calcHeight: 54,
           tip: false,
           searchShow: true,
           searchMenuSpan: 6,
@@ -118,11 +118,11 @@
               prop: "online_status",
               dicData: [{
                 label: "离线",
-                value: 0
+                value: "0"
               },
                 {
                   label: "在线",
-                  value: 1
+                  value: "1"
                 },
               ],
             },
@@ -201,9 +201,6 @@
         return ids.join(",");
       }
     },
-    mounted() {
-      this.showMap = false;
-    },
     methods: {
       rowSave(row, done, loading) {
         add(row).then(() => {
@@ -248,24 +245,41 @@
             });
           });
       },
+      //打开地图
       handleMap(row) {
-        
         var that =this;
-        that.baseUrl = `/map/index.html?ISinit=1&openid=SecurityMap&jd=${row.jd}&wd=${row.wd}`;
         this.showMap=true;
-        console.log(this.$refs,111);
-        console.log(this.$refs.securityMap,222);
-        this.$refs.securityMap.onload = () => {
-          if (window.frames[0].init) {
-            window.frames[0].init("SecurityMap", {
-                x: row.jd,
-                y: row.wd,
-                code:row.code
-            });
-          } else {
-            console.log(`没有找到到window.frames[0].init`)
-          }
+        if(row.jd=="" || row.jd=="0.0"){
+          var rwjd = "115.862321";
+          var rwwd = "28.591108";
+          that.baseUrl = `/map/index.html?ISinit=1&openid=SecurityMap&jd=${rwjd}&wd=${rwwd}&code=${row.code}&name=${row.realName}`;
+        }else{
+          that.baseUrl = `/map/index.html?ISinit=1&openid=SecurityMap&jd=${row.jd}&wd=${row.wd}&code=${row.code}&name=${row.realName}`;
         }
+        
+        this.$nextTick(() => {
+          this.$refs.securityMap.onload = () => {
+            if (window.frames[1].init) {
+              if(row.jd=="" || row.jd=="0.0"){
+                //如果处警员无位置信息,则赋值一个默认数据,否则地图无法加载
+                window.frames[1].init("SecurityMap", {
+                                x: rwjd,
+                                y: rwwd,
+                                code:row.code
+                            });
+              }else{
+                window.frames[1].init("SecurityMap", {
+                                x: row.jd,
+                                y: row.wd,
+                                code:row.code
+                            });
+              }
+              
+            } else {
+              console.log(`没有找到到window.frames[1].init`)
+            }
+          }
+        });
       },
       handleDelete() {
         if (this.selectionList.length === 0) {

--
Gitblit v1.9.3