From c6796cb12ca7aa0717349ca185ece091acdd2bbc Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Tue, 20 Apr 2021 15:32:01 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/jfpt-Vue

---
 src/views/security/security.vue |   42 +++++++++++++++++++++++++++++++-----------
 1 files changed, 31 insertions(+), 11 deletions(-)

diff --git a/src/views/security/security.vue b/src/views/security/security.vue
index cbda06b..62f4cdb 100644
--- a/src/views/security/security.vue
+++ b/src/views/security/security.vue
@@ -23,9 +23,20 @@
       </template>
     </avue-crud>
 
-    <el-drawer title="电子地图" append-to-body="true" :visible.sync="showMap">
-      <iframe id="mapDiv" ref="mapDiv" src="/map/index.html?openid=scurityMap&ISinit=1" frameborder="0" width="100%"
+    <!-- <el-drawer title="电子地图" append-to-body="true" :visible.sync="showMap">
+      <iframe id="mapDiv" ref="mapDiv" src="/map/index.html?ISinit=1&openid=SecurityMap" frameborder="0" width="100%"
               height="100%"></iframe>
+    </el-drawer> -->
+    <el-drawer title="电子地图" append-to-body="true" :visible.sync="showMap">
+      <iframe
+                id="securityMap"
+                ref="securityMap"
+                :src="baseUrl"
+                frameborder="0"
+                width="100%"
+                height="100%"
+                name="securityMap"
+              ></iframe>
     </el-drawer>
   </basic-container>
 </template>
@@ -45,10 +56,11 @@
   export default {
     data() {
       return {
+        baseUrl:"/map/index.html?ISinit=1",
         form: {},
         query: {},
         loading: true,
-        showMap: false,
+        showMap: true,
         page: {
           pageSize: 10,
           currentPage: 1,
@@ -189,6 +201,9 @@
         return ids.join(",");
       }
     },
+    mounted() {
+      this.showMap = false;
+    },
     methods: {
       rowSave(row, done, loading) {
         add(row).then(() => {
@@ -233,17 +248,22 @@
             });
           });
       },
+      //打开地图
       handleMap(row) {
-        this.showMap = true;
-        this.$nextTick(() => {
-          this.$refs.mapDiv.onload = () => {
+        var that =this;
+        that.baseUrl = `/map/index.html?ISinit=1&openid=SecurityMap&jd=${row.jd}&wd=${row.wd}&code=${row.code}&name=${row.realName}`;
+        this.showMap=true;
+        this.$refs.securityMap.onload = () => {
+          if (window.frames[0].init) {
             window.frames[0].init("SecurityMap", {
-              x: row.jd,
-              y: row.wd,
-              code:row.code
+                x: row.jd,
+                y: row.wd,
+                code:row.code
             });
-          };
-        })
+          } else {
+            console.log(`没有找到到window.frames[0].init`)
+          }
+        }
       },
       handleDelete() {
         if (this.selectionList.length === 0) {

--
Gitblit v1.9.3