From 8d837b97ffb27e4e26f067c1febde353bfdf91cf Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 23 Apr 2021 09:16:27 +0800
Subject: [PATCH] Merge branch 'master' of http://s16s652780.51mypc.cn:49896/r/jfpt-Vue

---
 src/views/security/security.vue |   80 ++++++++++++++++++++++++++++++++--------
 1 files changed, 64 insertions(+), 16 deletions(-)

diff --git a/src/views/security/security.vue b/src/views/security/security.vue
index 17e28c7..981313f 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,15 +56,17 @@
   export default {
     data() {
       return {
+        baseUrl:"/map/index.html?ISinit=1",
         form: {},
         query: {},
         loading: true,
-        showMap: false,
+        showMap: true,
         page: {
           pageSize: 10,
           currentPage: 1,
           total: 0
         },
+        dialogVisible: false,
         selectionList: [],
         option: {
           height: 'auto',
@@ -61,7 +74,8 @@
           tip: false,
           searchShow: true,
           searchMenuSpan: 6,
-          border: true,
+          border: false,
+          stripe: true,
           index: true,
           viewBtn: true,
           selection: true,
@@ -94,6 +108,23 @@
                 message: "请输入名称",
                 trigger: "blur"
               }]
+            },
+            {
+              label: "所属部门",
+              prop: "deptName"
+            },
+            {
+              label: "在线状态",
+              prop: "online_status",
+              dicData: [{
+                label: "离线",
+                value: 0
+              },
+                {
+                  label: "在线",
+                  value: 1
+                },
+              ],
             },
             {
               label: "性别",
@@ -139,6 +170,7 @@
             {
               label: "创建时间",
               prop: "createTime",
+              width:160,
               display: false,
               rules: [{
                 required: true,
@@ -168,6 +200,9 @@
         });
         return ids.join(",");
       }
+    },
+    mounted() {
+      this.showMap = false;
     },
     methods: {
       rowSave(row, done, loading) {
@@ -213,19 +248,32 @@
             });
           });
       },
+      //打开地图
       handleMap(row) {
-        this.showMap = true;
-        console.log("row.id="+row.id);
-        console.log("row.wd="+row.wd);
-        this.$nextTick(() => {
-          this.$refs.mapDiv.onload = () => {
-            window.frames[0].init("SecurityMap", {
-              x: row.jd,
-              y: row.wd,
-              code:row.code
-            });
-          };
-        })
+        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) {
+            if(row.jd==""){
+              //如果处警员无位置信息,则赋值一个默认数据,否则地图无法加载
+              window.frames[0].init("SecurityMap", {
+                              x: "115.862321",
+                              y: "28.591108",
+                              code:row.code
+                          });
+            }else{
+              window.frames[0].init("SecurityMap", {
+                              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