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 |   84 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 69 insertions(+), 15 deletions(-)

diff --git a/src/views/security/security.vue b/src/views/security/security.vue
index 17e28c7..7005301 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,6 +56,7 @@
   export default {
     data() {
       return {
+        baseUrl:"/map/index.html?ISinit=1",
         form: {},
         query: {},
         loading: true,
@@ -54,14 +66,16 @@
           currentPage: 1,
           total: 0
         },
+        dialogVisible: false,
         selectionList: [],
         option: {
           height: 'auto',
-          calcHeight: 30,
+          calcHeight: 54,
           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,
@@ -213,19 +245,41 @@
             });
           });
       },
+      //打开地图
       handleMap(row) {
-        this.showMap = true;
-        console.log("row.id="+row.id);
-        console.log("row.wd="+row.wd);
+        var that =this;
+        this.showMap=true;
+        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.mapDiv.onload = () => {
-            window.frames[0].init("SecurityMap", {
-              x: row.jd,
-              y: row.wd,
-              code:row.code
-            });
-          };
-        })
+          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