Pārlūkot izejas kodu

地图页面修改

lihongxiao 2 gadi atpakaļ
vecāks
revīzija
87062bc927

+ 2 - 2
config/dev.env.js

@@ -5,7 +5,7 @@ const prodEnv = require('./prod.env')
 module.exports = merge(prodEnv, {
   NODE_ENV: '"development"',
   ENV_CONFIG: '"dev"',
-  // BASE_URL: '"https://test.baoxianzhanggui.com/web-api"',//测试服务器
+  BASE_URL: '"https://test.baoxianzhanggui.com/web-api"',//测试服务器
   // BASE_URL:'"https://sxzgkj.baoxianzhanggui.com/web-api"',//正式服务器
   // BASE_URL:'"https://sxzgkj.baoxianzhanggui.com/web-api"'//正式服务器
   // BASE_URL: '"http://192.168.0.115:8080/"', //凯森
@@ -17,7 +17,7 @@ module.exports = merge(prodEnv, {
   // BASE_URL: '"http://192.168.1.101:8080/"',
   // BASE_URL: '"http://192.168.0.250:8080/"',//
   // BASE_URL: '"http:///192.168.0.103:8080/"',//霍续亮
-  BASE_URL: '"http://192.168.0.52:8080/"',//贺礼霄
+  // BASE_URL: '"http://192.168.0.52:8080/"',//贺礼霄
   // BASE_URL: '"http:///192.168.0.55:8080/"',// 董鑫
   CONSOLE_BASE_URL: '"http://localhost:8080/"', //控制台测试服务器
   // CONSOLE_BASE_URL: '"https://test.baoxianzhanggui.com/console-api"' //控制台正式服务器

+ 2 - 2
src/utils/websocket.js

@@ -14,7 +14,7 @@ function websocketonmessage (e) {
  * 发起websocket连接
  * @param {Object} agentData 需要向后台传递的参数数据
  */
-function websocketSend (agentData) {
+export function websocketSend (agentData) {
   // 加延迟是为了尽量让ws连接状态变为OPEN
   setTimeout(() => {
     // 添加状态判断,当为OPEN时,发送消息
@@ -56,7 +56,7 @@ function websocketOpen (e) {
 }
 
 // 初始化weosocket
-function initWebSocket (wsUrl) {
+  function initWebSocket (wsUrl) {
   if (typeof (WebSocket) === 'undefined') {
     Message.error('您的浏览器不支持WebSocket,无法获取数据')
     return false

+ 51 - 18
src/views/Home.vue

@@ -1,11 +1,11 @@
 <template>
   <div class="container">
-      <!-- 导航菜单栏 -->
-      <nav-bar></nav-bar>
-      <!-- 头部区域 -->
-      <head-bar></head-bar>
-      <!-- 主内容区域 -->
-      <main-content></main-content>
+    <!-- 导航菜单栏 -->
+    <nav-bar></nav-bar>
+    <!-- 头部区域 -->
+    <head-bar></head-bar>
+    <!-- 主内容区域 -->
+    <main-content></main-content>
   </div>
 </template>
 
@@ -13,22 +13,55 @@
 import HeadBar from "./HeadBar/HeadBar"
 import NavBar from "./NavBar/NavBar"
 import MainContent from "./MainContent/MainContent"
+import {
+  getUserIP,
+  getUserLocation,
+  getAddressLocation,
+} from "@/utils/ipAndAddress.js";
+import Cookies from "js-cookie";
+import { websocketSend, closeWebsocket } from "@/utils/websocket.js";
 export default {
-  components:{
-        HeadBar,
-        NavBar,
-        MainContent
+  components: {
+    HeadBar,
+    NavBar,
+    MainContent
+  },
+  created() {
+    setInterval(() => {
+      setTimeout(() => {
+        if (Cookies.get("token")) {
+          getUserIP((ip) => {
+            getAddressLocation(ip, (info) => {
+              let data = {
+                ...info,
+                systemType: '1',
+              };
+              websocketSend(
+                data
+              );
+            });
+          })
+        }
+        else {
+          closeWebsocket()
+        }
+      }, 0);
+      // // }, 2 * 60 * 60000); // 两个小时
+      }, 30 * 60000); // 半小时
+    // }, 10000); // 半小时
+
   }
+
 };
 </script>
 
 <style scoped lang="scss">
-  .container {
-    position:absolute;
-    top: 0px;
-    left: 0px;
-    right: 0px;
-    bottom: 0px;
-    // background: rgba(224, 234, 235, 0.1);
-  }
+.container {
+  position: absolute;
+  top: 0px;
+  left: 0px;
+  right: 0px;
+  bottom: 0px;
+  // background: rgba(224, 234, 235, 0.1);
+}
 </style>  

+ 16 - 14
src/views/PeopleManage/PcLoginRecord.vue

@@ -20,7 +20,7 @@
             :value="option.code"></el-option>
         </el-select>
         <el-button size="small" type="primary" @click="onSearch">搜索</el-button>
-        <el-button size="small" type="primary" @click="deptPeopleVisible=true;getUserDeptTreeFun()">机构人员树</el-button>
+        <el-button size="small" type="primary" @click="getUserDeptTreeFun()">机构人员树</el-button>
         <!-- <el-button size="small" type="primary" @click="onCircular">圆形定位</el-button> -->
         <!-- <el-button size="small" type="primary" @click="map.remove(circle)">删除定位</el-button> -->
       </div>
@@ -49,7 +49,7 @@
       </div>
        <!-- <MobileZoomDiv> -->
         <div v-if="personnelVisible">
-        <vdr title="人员详情" @visiblefun="personnelVisible = false" :width="700" >
+        <vdr title="人员详情" @visiblefun="personnelVisible = false" :width="700" :height="370">
           <el-table :data="personnelData" border style="width: 100%; " :header-cell-style="{
             background: '#F7F7F9',
             fontWeight: '700',
@@ -63,13 +63,13 @@
                 <span v-else style="text-decoration-line: underline;">{{ scope.$index + 1 }}</span>
               </template>
             </el-table-column>
-            <el-table-column prop="userName" label="姓名" width="100">
+            <el-table-column prop="userName" label="姓名">
             </el-table-column>
-            <el-table-column prop="userId" label="工号">
+            <el-table-column prop="userId" label="工号" width="120">
             </el-table-column>
             <el-table-column prop="address" label="地址">
             </el-table-column>
-            <el-table-column prop="operationTime" label="登录时间">
+            <el-table-column prop="operationTime" label="登录时间"> 
             </el-table-column>
             <el-table-column prop="source" label="分类">
               <template slot-scope="scope">
@@ -82,7 +82,7 @@
                   size="small">
                   历史记录
                 </el-button>
-                <el-button style="color:#3865E9 " @click.native.prevent="operatelRecords(scope.row)" type="text"
+                <el-button  @click.native.prevent="operatelRecords(scope.row)" type="text"
                   size="small">
                   操作记录
                 </el-button>
@@ -94,7 +94,7 @@
             </div>
           </el-table>
           <div class="bottomFixed">
-            <el-pagination @current-change="handlePersonnelChange" :current-page="personnelPageNum" :page-size="5"
+            <el-pagination @current-change="handlePersonnelChange" :current-page="personnelPageNum" :page-size="3"
               layout="total, prev, pager, next" :total="personnelTotalSize">
             </el-pagination>
           </div>
@@ -103,7 +103,7 @@
       <!-- </MobileZoomDiv> -->
       <!-- <MobileZoomDivTR> -->
       <div v-if="infoWindowVisible">
-        <vdr title="历史记录" @visiblefun="infoWindowVisible = false"  >
+        <vdr title="历史记录" @visiblefun="infoWindowVisible = false"  :width="600" :height="430">
           <el-table :data="tableData" border style="width: 98%; max-height: 45vh;
             overflow-y: auto; " :cell-style="{ padding: '3px 8px' }" :header-cell-style="{
               background: '#F2F7FC',
@@ -111,13 +111,13 @@
               color: '#606266',
 
             }">
-          <el-table-column prop="userId" label="工号" width="150">
+          <el-table-column prop="userId" label="工号" width="130">
           </el-table-column>
           <el-table-column prop="userName" label="姓名" width="80">
           </el-table-column>
-          <el-table-column prop="address" label="地址">
+          <el-table-column prop="address" label="地址" >
           </el-table-column>
-          <el-table-column prop="operationTime" label="登录时间">
+          <el-table-column prop="operationTime" label="登录时间" width="120">
           </el-table-column>
         </el-table>
         <div class="bottomFixed">
@@ -203,7 +203,7 @@
       </MobileZoomDivR>
      
       <div v-if="operatelVisible">
-        <vdr title="操作记录" @visiblefun="operatelVisible = false">
+        <vdr title="操作记录" @visiblefun="operatelVisible = false"  :width="600"  :height="250">
           <div style="margin-bottom: 10px;">
             <span style="color: #262626;font-weight: 700;font-size: 14px;">时间筛选 </span>
             <el-date-picker v-model="operateDate" type="datetimerange" size="small" @change="operateDateFun"
@@ -396,6 +396,7 @@ export default {
           if (res.code == 200) {
             this.ztreeNodes = res.data.deptList;
             this.ztreeNodeAll = res.data;
+            this.deptPeopleVisible=true;
           }
         });
     },
@@ -570,7 +571,7 @@ export default {
       this.$api.user[api]({
         queryId: this.deptPeopleId,
         type: this.deptPeopleType,
-        lng: this.position[0], lat: this.position[1], source: this.source, pageSize: 5,
+        lng: this.position[0], lat: this.position[1], source: this.source, pageSize: 3,
         pageNum: this.personnelPageNum, ...data
       })
         .then(res => {
@@ -1009,7 +1010,7 @@ export default {
       this.$api.user[api]({
         queryId: this.deptPeopleId,
         type: this.deptPeopleType,
-        lng: e.target._position[0], lat: e.target._position[1], source: this.source, pageSize: 5,
+        lng: e.target._position[0], lat: e.target._position[1], source: this.source, pageSize: 3,
         pageNum: this.personnelPageNum, ...data
       })
         .then(res => {
@@ -1107,6 +1108,7 @@ export default {
   background-color: white;
   padding: 10px;
   width: 500px;
+  height: 250px;
   box-sizing: border-box;
   box-shadow: 0px 5px 10px #ddd;
   // max-height: 57vh;

+ 22 - 27
src/views/PeopleManage/UserMap.vue

@@ -18,7 +18,7 @@
           :value="option.code"></el-option>
       </el-select>
       <el-button size="small" type="primary" @click="onSearch">搜索</el-button>
-      <el-button size="small" type="primary" @click="deptPeopleVisible=true;getUserDeptTreeFun()">机构人员树</el-button>
+      <el-button size="small" type="primary" @click="getUserDeptTreeFun()">机构人员树</el-button>
     </div>
     <div class="line-window">
       <span><i style=" background: #54B569 ;"></i>在线</span>
@@ -50,7 +50,7 @@
      <!-- <MobileZoomDiv> -->
       <!-- 人员详情 -->
       <div v-if="personnelVisible">
-      <vdr title="人员详情" @visiblefun="personnelVisible = false" :width="770" >
+      <vdr title="人员详情" @visiblefun="personnelVisible = false" :width="900" :height="350">
         <el-table :data="personnelData" border style="width: 100%; " :header-cell-style="{
           background: '#F7F7F9',
           fontWeight: '700',
@@ -72,7 +72,7 @@
           </el-table-column>
           <el-table-column prop="leaderName" label="管理人">
           </el-table-column>
-          <el-table-column prop="address" label="地址">
+          <el-table-column prop="address" label="地址" width="150">
           </el-table-column>
           <el-table-column prop="createTime" label="登录时间">
           </el-table-column>
@@ -87,7 +87,7 @@
                 size="small">
                 历史记录
               </el-button>
-              <el-button st yle="color:#3865E9 " @click.native.prevent="operatelRecords(scope.row)" type="text"
+              <el-button  @click.native.prevent="operatelRecords(scope.row)" type="text"
                 size="small">
                 操作记录
               </el-button>
@@ -108,27 +108,27 @@
     <!-- </MobileZoomDiv> -->
     <!-- <MobileZoomDivTR> -->
     <div v-if="infoWindowVisible">
-      <vdr title="历史记录" @visiblefun="infoWindowVisible = false"  :width="720">
+      <vdr title="历史记录" @visiblefun="infoWindowVisible = false"  :width="780" :height="450">
         <el-table :data="tableData" border style="width: 98%; max-height: 45vh;
-    overflow-y: auto;" :cell-style="{ padding: '3px 8px' }" :header-cell-style="{
-      background: '#F2F7FC',
-      fontWeight: '700',
-      color: '#606266',
-    }">
-          <el-table-column prop="userId" label="工号" width="150">
+          overflow-y: auto;" :cell-style="{ padding: '3px 8px' }" :header-cell-style="{
+            background: '#F2F7FC',
+            fontWeight: '700',
+            color: '#606266',
+          }">
+          <el-table-column prop="userId" label="工号" width="130">
           </el-table-column>
           <el-table-column prop="userName" label="姓名" width="100">
           </el-table-column>
-          <el-table-column prop="deptName" label="所属机构"  width="150">
+          <el-table-column prop="deptName" label="所属机构"  width="250">
           </el-table-column>
-          <el-table-column prop="address" label="地址">
+          <el-table-column prop="address" label="地址"  width="150">
           </el-table-column>
           <el-table-column prop="createTime" label="登录时间">
           </el-table-column>
         </el-table>
         <div class="bottomFixed">
           <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageNum"
-            :page-sizes="[5, 10, 20, 30, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next"
+            :page-sizes="[3,5, 10, 20, 30, 50, 100]" :page-size="pageSize" layout="total, sizes, prev, pager, next"
             :total="totalSum">
           </el-pagination>
         </div>
@@ -209,7 +209,7 @@
 
    
     <div v-if="operatelVisible">
-      <vdr title="操作记录" @visiblefun="operatelVisible = false" :width="800">
+      <vdr title="操作记录" @visiblefun="operatelVisible = false" :width="820" :height="300">
         <div style="margin-bottom: 10px;">
           <span style="color: #262626;font-weight: 700;font-size: 14px;">时间筛选 </span>
           <el-date-picker v-model="operateDate" type="datetimerange" size="small" @change="operateDateFun"
@@ -228,7 +228,7 @@
           </el-table-column>
           <el-table-column prop="userName" label="姓名">
           </el-table-column>
-          <el-table-column prop="deptName" label="所属机构" width="150">
+          <el-table-column prop="deptName" label="所属机构" width="200">
           </el-table-column>
           <el-table-column prop="carNumber" label="车险录单">
             <template slot-scope="scope">
@@ -303,6 +303,8 @@ import AMapLoader from "@amap/amap-jsapi-loader";
 window._AMapSecurityConfig = {
   securityJsCode: 'd62687dd438cfadd859bbab66d8e41a2',		//安全密钥
 }
+import { websocketSend, closeWebsocket } from "@/utils/websocket.js";
+
 var myChart;
 export default {
   data() {
@@ -314,7 +316,7 @@ export default {
       ztreeNodeAll:{},
       deptPeopleValue:true,
       pageNum: 1, //当前页面
-      pageSize: 5, //每页显示条数
+      pageSize: 3, //每页显示条数
       totalSum: 0, //全部的数据条数
       tableData: [],
       marker: null,
@@ -388,14 +390,6 @@ export default {
     window.personnelclick = () => {
       this.personnelVisible = true;
     };
-    this.$api.user
-        .getUserDeptTree()
-        .then(res => {
-          if (res.code == 200) {
-            this.ztreeNodes = res.data.deptList;
-            this.ztreeNodeAll = res.data;
-          }
-        });
   },
   destroyed() {
     // 销毁地图,并清空地图容器.该方法执行后,地图对象被注销,内存释放,地图容器被清空。
@@ -409,6 +403,7 @@ export default {
           if (res.code == 200) {
             this.ztreeNodes = res.data.deptList;
             this.ztreeNodeAll = res.data;
+            this.deptPeopleVisible=true;
           }
         });
     },
@@ -588,7 +583,7 @@ export default {
         .queryGeographyInfo({
           queryId: this.deptPeopleId,
           type: this.deptPeopleType,
-          lng: this.position[0], lat: this.position[1], pageSize: 5,
+          lng: this.position[0], lat: this.position[1], pageSize: 3,
           pageNum: this.personnelPageNum, ...data
         })
         .then(res => {
@@ -936,7 +931,7 @@ export default {
       this.$api.user[api]({
         queryId: this.deptPeopleId,
         type: this.deptPeopleType,
-        lng: e.target._position[0], lat: e.target._position[1], pageSize: 5,
+        lng: e.target._position[0], lat: e.target._position[1], pageSize: 3,
         pageNum: this.personnelPageNum, ...data
       })
         .then(res => {

+ 12 - 5
src/views/PeopleManage/vdr.vue

@@ -1,19 +1,20 @@
 <template>
-    <vdr :w="operateWidth" :h="operateHight"    :active="true"
+    <vdr :w="operateWidth"  :min-height="operateHight" :h="operateHight"    :active="true" 
     @resizing="onResize"  :x="operateX" :y="operateY"
-    @dragging="onDrag" style="z-index:999" class-name="my-class"
-        class="infohis-window">
+    @dragging="onDrag" style="z-index:999" class-name="my-class" class="infohis-window"
+        >
         <div class="close flex j-s" style="padding:15px 0" v-if="title">
             <span>{{ title }}</span>
             <div>
-                <span class="el-icon-close" style="color: #c3c3c3;cursor: pointer" @click="visiblefun"></span>
                 <span v-if="isOperate==false" style="color: #c3c3c3;font-size:18px;cursor: pointer"
                     @click="operateWidthFun()" class="el-icon-rank"> </span>
                 <span v-else style="color: #c3c3c3;font-size:18px;cursor: pointer"
                     @click="isOperate=false;operateWidth=width;operateHight=height || 'auto'" class="el-icon-top-left"> </span>
+                <span class="el-icon-close" style="color: #c3c3c3;cursor: pointer" @click="visiblefun"></span>
+
             </div>
         </div>
-        <slot></slot>
+            <slot></slot>
     </vdr>
 </template>  
 <script>
@@ -45,12 +46,17 @@ export default {
  
     methods: {
         onResize(x, y, width, height) {
+            // if(height>this.operateHight){
+
+            // }
             this.operateWidth = Math.min(window.innerWidth - x, width); // 保证宽度不超出容器宽度
             this.operateHight = Math.min(window.innerHeight - y, height); // 保证宽度不超出容器宽度
+            // console.log(height, this.operateHight,11111111);
         },
         onDrag(x, y) {
             this.operateX = x; // 更新x位置
             this.operateY = y; // 更新x位置
+
         },
         visiblefun() {
             this.$emit("visiblefun")
@@ -72,5 +78,6 @@ export default {
     font-size: 16px;
     font-weight: bold;
 }
+
 </style>