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 |  235 +++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 132 insertions(+), 103 deletions(-)

diff --git a/src/views/security/security.vue b/src/views/security/security.vue
index ff5efda..7005301 100644
--- a/src/views/security/security.vue
+++ b/src/views/security/security.vue
@@ -1,86 +1,62 @@
 <template>
   <basic-container>
-    <avue-crud :option="option"
-               :table-loading="loading"
-               :data="data"
-               :page="page"
-               :permission="permissionList"
-               :before-open="beforeOpen"
-               v-model="form"
-               ref="crud"
-               @row-update="rowUpdate"
-               @row-save="rowSave"
-               @row-del="rowDel"
-               @search-change="searchChange"
-               @search-reset="searchReset"
-               @selection-change="selectionChange"
-               @current-change="currentChange"
-               @size-change="sizeChange"
-               @refresh-change="refreshChange"
-               @on-load="onLoad">
+    <avue-crud :option="option" :table-loading="loading" :data="data" :page="page" :permission="permissionList"
+               :before-open="beforeOpen" v-model="form" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @row-del="rowDel"
+               @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange" @current-change="currentChange"
+               @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
       <template slot="menuLeft">
-        <el-button type="danger"
-                   size="small"
-                   icon="el-icon-delete"
-                   plain
-                   v-if="permission.security_delete"
-                   @click="handleDelete">删 除
+        <el-button type="danger" size="small" icon="el-icon-delete" plain v-if="permission.security_delete" @click="handleDelete">删
+          除
         </el-button>
       </template>
-	  <template slot="menuLeft">
-	    <el-button
-	      type="danger"
-	      size="small"
-	      icon="el-icon-delete"
-	      plain
-	      v-if="permission.real_delete"
-	      @click="handleDelete"
-	    >删 除
-	    </el-button>
-	  </template>
 
-	  <template slot-scope="{ row }" slot="jtype">
-	    <el-tag>{{
-	      row.jtype == "0" ? "否" : row.jtype == "1" ? "是" : "无"
-	      }}
-	    </el-tag>
-	  </template>
+      <template slot-scope="{ row }" slot="jtype">
+        <el-tag>{{
+          row.jtype == "0" ? "否" : row.jtype == "1" ? "是" : "无"
+          }}
+        </el-tag>
+      </template>
 
-	  <template slot-scope="{ type, size, row }" slot="menu">
-	    <el-button
-	      icon="el-icon-location-outline"
-	      :size="size"
-	      :type="type"
-	      @click.stop="handleMap(row)"
-	    >定位
-	    </el-button>
-	  </template>
+      <template slot-scope="{ type, size, row }" slot="menu">
+        <el-button icon="el-icon-location-outline" :size="size" :type="type" @click.stop="handleMap(row)">编辑电子围栏
+        </el-button>
+      </template>
     </avue-crud>
 
-    <el-drawer
-      title="电子地图"
-      append-to-body="true"
-      :visible.sync="showMap"
-    >
+    <!-- <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="mapDiv"
-        ref="mapDiv"
-        src="/map/index.html?openid=APoliceTeam"
-        frameborder="0"
-        width="100%"
-        height="100%"
-      ></iframe>
+                id="securityMap"
+                ref="securityMap"
+                :src="baseUrl"
+                frameborder="0"
+                width="100%"
+                height="100%"
+                name="securityMap"
+              ></iframe>
     </el-drawer>
   </basic-container>
 </template>
 
 <script>
-  import {getList, getDetail, add, update, remove} from "@/api/security/security";
-  import {mapGetters} from "vuex";
+  import {
+    getList,
+    getDetail,
+    add,
+    update,
+    remove
+  } from "@/api/security/security";
+  import {
+    mapGetters
+  } from "vuex";
 
   export default {
     data() {
       return {
+        baseUrl:"/map/index.html?ISinit=1",
         form: {},
         query: {},
         loading: true,
@@ -90,22 +66,32 @@
           currentPage: 1,
           total: 0
         },
+        dialogVisible: false,
         selectionList: [],
         option: {
-          height:'auto',
-          calcHeight: 30,
+          height: 'auto',
+          calcHeight: 54,
           tip: false,
           searchShow: true,
           searchMenuSpan: 6,
-          border: true,
+          border: false,
+          stripe: true,
           index: true,
           viewBtn: true,
           selection: true,
           dialogClickModal: false,
-          column: [
+          column: [{
+            label: "账号",
+            prop: "account",
+            rules: [{
+              required: true,
+              message: "请输入账号",
+              trigger: "blur"
+            }]
+          },
             {
               label: "人员编号",
-              prop: "snumber",
+              prop: "code",
               search: true,
               rules: [{
                 required: true,
@@ -114,8 +100,8 @@
               }]
             },
             {
-              label: "人员名称",
-              prop: "sname",
+              label: "人员姓名",
+              prop: "realName",
               search: true,
               rules: [{
                 required: true,
@@ -124,28 +110,35 @@
               }]
             },
             {
-              label: "性别",
-              prop: "sex",
-              type: "select",
-              dicData: [
+              label: "所属部门",
+              prop: "deptName"
+            },
+            {
+              label: "在线状态",
+              prop: "online_status",
+              dicData: [{
+                label: "离线",
+                value: "0"
+              },
                 {
-                  label: "男",
-                  value: "0"
-                },
-                {
-                  label: "女",
+                  label: "在线",
                   value: "1"
                 },
               ],
             },
             {
-              label: "年龄",
-              prop: "age",
-              rules: [{
-                required: true,
-                message: "请输入年龄",
-                trigger: "blur"
-              }]
+              label: "性别",
+              prop: "sex",
+              type: "select",
+              dicData: [{
+                label: "男",
+                value: 1
+              },
+                {
+                  label: "女",
+                  value: 2
+                },
+              ],
             },
             {
               label: "联系电话",
@@ -157,24 +150,34 @@
               }]
             },
             {
-              label: "家庭住址",
-              prop: "address",
+              label: "邮箱",
+              prop: "email",
               rules: [{
                 required: true,
-                message: "请输入家庭住址",
+                message: "请输入邮箱",
                 trigger: "blur"
               }]
             },
             {
-              label: "录用时间",
-              prop: "stime",
-              display: false,
+              label: "生日",
+              prop: "birthday",
               rules: [{
                 required: true,
-                message: "请输入录用时间",
+                message: "请选择",
                 trigger: "blur"
               }]
             },
+            {
+              label: "创建时间",
+              prop: "createTime",
+              width:160,
+              display: false,
+              rules: [{
+                required: true,
+                message: "请选择创建时间",
+                trigger: "blur"
+              }]
+            }
           ]
         },
         data: []
@@ -242,15 +245,41 @@
             });
           });
       },
+      //打开地图
       handleMap(row) {
-        debugger
-        this.showMap = true;
+        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(null,{x: row.jd, y: row.wd});
-            
-          };
-        })
+          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) {
@@ -299,10 +328,10 @@
         this.selectionList = [];
         this.$refs.crud.toggleSelection();
       },
-      currentChange(currentPage){
+      currentChange(currentPage) {
         this.page.currentPage = currentPage;
       },
-      sizeChange(pageSize){
+      sizeChange(pageSize) {
         this.page.pageSize = pageSize;
       },
       refreshChange() {

--
Gitblit v1.9.3