Browse Source

Merge remote-tracking branch 'origin/visu_water' into visu_water

wang_xy 2 năm trước cách đây
mục cha
commit
4f093c331a

+ 15 - 0
src/api/forest.js

@@ -1,5 +1,20 @@
 import request from '@/utils/request'
 
+// 获取绑定的事件类型
+export function getMenuEventType() {
+  return request({
+    url: '/center-water/WaterController/getMenuEventType',
+    method: 'get',
+  })
+}
+// 获取事件详情
+export function getEventPush(param) {
+  return request({
+    url: '/center-water/WaterController/getEventPush',
+    method: 'post',
+    data: param
+  })
+}
 // 左侧获取部门信息
 export function getBaseInfo() {
   return request({

+ 11 - 11
src/components/vBottomMenu.vue

@@ -433,17 +433,17 @@
 						icon: 'iconfont sj-icon-clgj',
 						click: 'editableLayers'
 					},
-					{
-						name: '林班',
-						icon: 'iconfont sj-icon-lbzy',
-						click: 'forestban'
-					},
-
-					{
-						name: '林场',
-						icon: 'iconfont sj-icon-lczy',
-						click: 'forestchang'
-					},
+					// {
+					// 	name: '林班',
+					// 	icon: 'iconfont sj-icon-lbzy',
+					// 	click: 'forestban'
+					// },
+          //
+					// {
+					// 	name: '林场',
+					// 	icon: 'iconfont sj-icon-lczy',
+					// 	click: 'forestchang'
+					// },
 					{
 						name: '电视墙',
 						icon: 'el-icon-s-grid',

+ 1 - 0
src/store/getters.js

@@ -5,6 +5,7 @@ const getters = {
   visitedViews: state => state.tagsView.visitedViews,
   cachedViews: state => state.tagsView.cachedViews,
   token: state => state.user.token,
+  userId: state => state.user.id,
   avatar: state => state.user.avatar,
   name: state => state.user.name,
   introduction: state => state.user.introduction,

+ 6 - 1
src/store/modules/user.js

@@ -6,6 +6,7 @@ const user = {
     token: getToken(),
     name: '',
     avatar: '',
+    userId: '',
     roles: [],
     permissions: []
   },
@@ -28,6 +29,9 @@ const user = {
     },
     SET_PERMISSIONS: (state, permissions) => {
       state.permissions = permissions
+    },
+    SET_USERID: (state, userId) => {
+      state.userId = userId
     }
   },
 
@@ -65,6 +69,7 @@ const user = {
             commit('SET_ROLES', ['ROLE_DEFAULT'])
           }
           commit('SET_NAME', user.userName)
+          commit('SET_USERID', user.id)
           commit('SET_AVATAR', avatar)
           resolve(res)
         }).catch(error => {
@@ -85,7 +90,7 @@ const user = {
         })
       })
     },
-    
+
     // 退出系统
     LogOut({ commit, state }) {
       return new Promise((resolve, reject) => {

+ 3 - 5
src/views/from/dvCapsuleChart.vue

@@ -3,19 +3,17 @@
     <template v-if="mergedConfig">
       <div class="label-column">
         <div v-for="item in mergedConfig.data" :key="item.name" style="cursor: pointer" @click="getEventList(item)">
-          {{ item.name }} 
+          {{ item.name }}
         </div>
         <div>&nbsp;</div>
       </div>
       <div class="capsule-container">
-        <div class="capsule-item" v-for="(capsule, index) in capsuleLength" :key="index">
+        <div class="capsule-item" v-for="(capsule, index) in capsuleLength" :key="index" style="cursor: pointer" @click="getEventList(mergedConfig.data[index])">
           <div
-            @click="getEventList(capsule)"
             class="capsule-item-column"
-            :style="`cursor: pointer;width: ${capsule * 100}%; background-color: ${mergedConfig.colors[index % mergedConfig.colors.length]};`"
+            :style="`width: ${capsule * 100}%; background-color: ${mergedConfig.colors[index % mergedConfig.colors.length]};`"
           >
             <div
-              style="cursor: pointer" @click="getEventList(capsule)"
               v-if="mergedConfig.showValue"
               class="capsule-item-value"
             >{{ capsuleValue[index] }}

+ 37 - 7
src/views/leader.vue

@@ -77,7 +77,7 @@
                   <el-collapse-item v-for="(item,index) in xunLinListOne">
                     <template slot="title">
                       <div class="d-l-con sj-collapse"
-                           @click="getWaterRecord(item.id)">
+                           @click="getWaterRecord(item.id, item.patrolTrajectory)">
                         <div class="d-l-l-text">
                           <el-tooltip class="item" effect="dark" placement="left"
                                       style="width:10rem ;" :disabled="(item.taskName.length <= 20)">
@@ -171,8 +171,10 @@
 				indentText: '收起左右栏',
 				indentdisabled: false,
 				visuForestCloudRYBO: [], //人员类型列表
+        personId: null, //人员
 				peopleList: [], //人员列表
 				connectList: [], //画线
+        patrolTrajectory: null, //任务画线
 				xunLinListOne: [], //巡林任务
 				recordList: [], //巡查记录
 				showNothing: false, //暂无信息
@@ -288,25 +290,36 @@
 					this.peopleList = res.data
 				})
 				this.connectList = []
+        this.personId = null;
+				this.xunLinListOne = [];
+				this.patrolTrajectory = null;
 				this.$refs.supermap.clearC()
 			},
 			//点击左侧人员列表获取 巡林计划
 			getPlanList(personId) {
+			  if(this.personId == personId){//当前人员已经被点击一次 不再重复加载
+			    return;
+        }
+        this.personId = personId;
 				this.showNothing = false;
 				this.recordList = [];
 				getPlanList(personId).then(res => {
+          console.log("点击左侧人员列表获取 巡林计划=", res.data)
 					this.xunLinListOne = res.data;
 				})
-				this.$refs.supermap.clearC()
+        this.patrolTrajectory = null;
+				this.$refs.supermap.clearC();
 			},
 			//点击右侧巡林计划获取 巡查记录
-			getWaterRecord(id) {
+			getWaterRecord(id, patrolTrajectory) {
 				this.showNothing = false;
 				this.recordList = [];
 				getWaterRecord(id).then(res => {
+				  console.log("点击右侧巡林计划获取 巡查记录res.data=", res.data)
 					this.recordList = res.data;
 				})
-				this.$refs.supermap.clearC()
+				this.$refs.supermap.clearC();
+        this.setTaskPointList(patrolTrajectory);
 			},
 			//点击右侧巡查记录获取 巡查轨迹
 			getWaterPoint(id) {
@@ -315,7 +328,24 @@
 					this.setPointList(res);
 				})
 			},
-			//点击巡查轨迹时段 巡查轨迹落点
+			//点击巡查人员 巡查任务落点
+			setTaskPointList(patrolTrajectory) {
+				console.log("巡查任务落点", typeof JSON.parse(patrolTrajectory));
+        if(this.patrolTrajectory == patrolTrajectory){
+          this.patrolTrajectory = null;
+        }else {
+          this.patrolTrajectory = patrolTrajectory;
+          this.drawTaskPoint(this.patrolTrajectory);
+        }
+			},
+      // 巡查任务落点
+			drawTaskPoint(patrolTrajectory) {
+        setTimeout(() => {
+          this.$refs.supermap.clearC();
+          this.$refs.supermap.setConnectList(JSON.parse(patrolTrajectory), '#04f');
+        }, 1000)
+			},
+      //点击巡查轨迹时段 巡查轨迹落点
 			setPointList(res) {
 				let that = this;
 				this.connectList = [];
@@ -329,8 +359,8 @@
 						this.connectList.push(latlng)
 					}
 					setTimeout(() => {
-						that.$refs.supermap.clearC()
-						that.$refs.supermap.setConnectList(this.connectList, 'red')
+						// that.$refs.supermap.clearC()
+						that.$refs.supermap.setConnectList(this.connectList, '#f40')
 					}, 1000)
 				} else {
 					that.$refs.supermap.clearC()

+ 52 - 12
src/views/water.vue

@@ -253,7 +253,7 @@
             <dv-border-box-13 backgroundColor="rgba(12, 19, 38, .90)" style="padding-bottom: 1rem;">
               <img src="../assets/images/integrated/light.png" style="width: 100%; margin-top: .4rem;"/>
               <div class="this-title">
-                <span>曝光台</span>
+                <span>超期事件</span>
                 <dv-decoration-3 style="width:150px;height:15px;margin-right: 1rem;"/>
               </div>
               <div class="i-list-con small-bottom-margin h-18">
@@ -438,6 +438,8 @@
   /** ----------------------------------weosocket结束------------------------------------- */
 
   import {
+    getMenuEventType,
+    getEventPush,
     getBaseInfo,
     getTodayEvents,
     getDeptEventCount,
@@ -503,6 +505,7 @@
       this.getEventByReportorOrder(this.getCurrentDataStr())
       this.getExposureStage(this.getCurrentDataStr())
       this.getSupermap(this.getCurrentDataStr())
+      this.getMenuEventType()
       /** ----------------------------------weosocket开始------------------------------------- */
       // this.initWebSocket()
       /** ----------------------------------weosocket结束------------------------------------- */
@@ -510,13 +513,13 @@
         if (this.calendarDay == this.getCurrentDataStr()) {
           this.getTodayEvents(this.getCurrentDataStr(), true);
           this.getDeptEventCount(this.getCurrentDataStr(), true);
-          this.getEventList(this.getCurrentDataStr(), this.pageSize, this.pageNum, '', true);
+          // this.getEventList(this.getCurrentDataStr(), this.pageSize, this.pageNum, '', true);
           this.getEventByEventType(this.getCurrentDataStr(), true);
           this.getEventByReportorOrder(this.getCurrentDataStr(), true);
           this.getExposureStage(this.getCurrentDataStr(), true);
-          this.getSupermap(this.getCurrentDataStr(), true);
+          // this.getSupermap(this.getCurrentDataStr(), true);
         }
-      }, 10000)
+      }, 30000)
       this.bottomMenuList() //获取底部公共组件消息和任务
     },
     data() {
@@ -577,6 +580,11 @@
         weosocket: false,
         websock: '',
         setIntervalWesocketPush: null,
+        websockSid: {
+          userId: '',
+          eventTypeDl: '',
+          eventType: '',
+        },
         /** ----------------------------------weosocket结束------------------------------------- */
         /** ----------------------------------摄像头预览开始------------------------------------- */
         activePanel: 'key1',
@@ -598,6 +606,16 @@
     },
     /** ----------------------------------weosocket结束------------------------------------- */
     methods: {
+      getMenuEventType() {
+        let that = this
+        getMenuEventType().then(res => {
+          that.websockSid.userId = Cookies.get('userId')
+          that.websockSid.eventTypeDl = res.data.eventTypeDl
+          that.websockSid.eventType = res.data.eventType
+          that.initWebSocket(that.websockSid.userId, that.websockSid.eventTypeDl, that.websockSid.eventType)
+          console.log(that.websockSid)
+        })
+      },
       setEventTypeId(data) {
         // let data = {eventTypeIdDl: [], eventTypeId: []}
         // let data = {eventTypeIdDl: that.eventTypeIdDl, eventTypeId: that.eventTypeId}
@@ -1051,8 +1069,7 @@
       },
       getWebSocketEvent(data) {
         let that = this
-        const event = JSON.parse(data);
-        //右侧获取事件列表
+        const event = data        //右侧获取事件列表
         that.markersList = []
         let markersMap = {
           lng: 124.59,
@@ -1134,9 +1151,8 @@
         })
       },
       /** ----------------------------------weosocket开始------------------------------------- */
-      initWebSocket() { //初始化weosocket
-        // const wsuri = 'ws://127.0.0.1:10003/webSocket/' + Cookies.get('username')
-        const wsuri = 'ws://127.0.0.1:10003/webSocket/admin'
+      initWebSocket(userId, eventTypeDl, eventType) {        //初始化weosocket
+        const wsuri = 'ws://127.0.0.1:10003/eventPush/' + userId + '/' + eventTypeDl + '/' + eventType
         this.websock = new WebSocket(wsuri)
         console.log('建立websocket连接')
         this.websock.onopen = this.websocketonopen
@@ -1149,14 +1165,15 @@
         this.sendPing()
       },
       websocketonerror() { //连接建立失败重连
-        this.initWebSocket()
+        this.initWebSocket(this.websockSid.userId, this.websockSid.eventTypeDl, this.websockSid.eventType,)
       },
       websocketonmessage(e) { //数据接收
         console.log('接收数据', e.data)
         // let data = "{\"fromId\":\"forest\",\"fromUserId\":\""+Cookies.get('username')+"\",\"toUserId\":\""+Cookies.get('username')+"\"}";
         let data = "{\"fromId\":\"forest\",\"fromUserId\":\"admin\",\"toUserId\":\"admin\"}";
         if (this.calendarDay == this.getCurrentDataStr() && data != e.data) {
-          this.getWebSocketEvent(e.data);
+          // 处理收到的消息
+          this.handleWebSoceketEvent(e.data)
 
           // this.getEventListNew();
           // this.getTodayEvents(this.getCurrentDataStr());
@@ -1169,6 +1186,29 @@
           // thes.$refs.up.pause();//停止播放音乐
         }
       },
+      // 处理WebSocket事件
+      handleWebSoceketEvent(val) {
+        let that = this
+        let data = JSON.parse(val)
+        /**
+         * that.markersList.filter( item => data.eventCode == item.parameter).length == 0 如果地图中不存在当前事件则添加
+         * eventPush: 事件列表消息
+         * */
+        if (data.tag == "eventPush" && that.markersList.filter( item => data.eventCode == item.parameter).length == 0) {
+          getEventPush({eventCode: data.eventCode}).then((res) => {
+            if (res.data != undefined) {
+              //插入到第一条
+              this.eventList.unshift(res.data)
+              // 插入后删除最后一条 保证列表中为10条数据
+              if (this.eventList.length > 9)
+                this.eventList.splice(10, 1)
+              // 将收到的数据在地图上添加
+              this.getWebSocketEvent(res.data)
+            }
+          })
+        }
+        console.log(that.eventList[0])
+      },
       websocketsend(Data) { //数据发送
         this.websock.send(Data)
       },
@@ -1191,7 +1231,7 @@
           if (this.weosocket) {
             this.websock.send(JSON.stringify(ping))
           } else {
-            this.initWebSocket()
+            // this.initWebSocket()
           }
         }, time)
       },