Преглед изворни кода

数字资源 资源人员列表 轨迹 落点

wangzhe пре 2 година
родитељ
комит
797829b94a
2 измењених фајлова са 60 додато и 5 уклоњено
  1. 15 1
      src/api/leader.js
  2. 45 4
      src/views/leader.vue

+ 15 - 1
src/api/leader.js

@@ -13,7 +13,7 @@ export function getRy() {
 export function getForestLeader() {
   return request({
     // url: '/center-resources/VisuForestLeaderController/getForestLeader?linJob='+linJob+"&linType="+linType,
-    url: '/center-resources/VisuForestLeaderController/getForestLeader',
+    url: '/center-resources/VisuForestLeaderController/getPersonList',
     method: 'get',
   })
 }
@@ -24,6 +24,20 @@ export function getLeaderTrack(trackById) {
     method: 'get',
   })
 }
+// 点击左侧轨迹列表获取时段
+export function getTrackList(personId) {
+  return request({
+    url: '/center-resources/VisuForestLeaderController/getTrackList?personId='+personId,
+    method: 'get',
+  })
+}
+// 点击右侧时段列表获取落点
+export function getPointList(trackId) {
+  return request({
+    url: '/center-resources/VisuForestLeaderController/getPointList?trackId='+trackId,
+    method: 'get',
+  })
+}
 // 巡林计划
 export function getPlanList(trackById) {
   return request({

+ 45 - 4
src/views/leader.vue

@@ -76,10 +76,10 @@
               <div class="h-19 overflow-y">
                 <div class="d-l-con" :class="{on:listCurrentIndex2==item.planName}"
                      v-for="(item,index) in xunLinListOne"
-                     @click="setConnectList(item.planLine,item.planName)">
+                     @click="getPointList(item.id)">
                   <div class="d-l-l-text">
                     <i class="i-small"></i>
-                    <h4>{{ item.planName }}</h4>
+                    <h4>{{ item.timeBegin }} - {{ item.timeEnd }}</h4>
                   </div>
                 </div>
               </div>
@@ -105,6 +105,8 @@
 import {
   getForestLeader,
   getLeaderTrack,
+  getTrackList,
+  getPointList,
   getPlanList,
   getRy
 } from '@/api/leader'
@@ -232,13 +234,18 @@ export default {
       // getPlanList().then(res => {
       //   this.xunLinListOne = res.data
       // })
+      // // 获取轨迹列表
+      // getTrackList().then(res => {
+      //   this.xunLinListOne = res.data
+      // })
       // 获取人员列表
       // getForestLeader(linJob, linType).then(res => {
       getForestLeader().then(res => {
         this.peopleList = res.data;
+        console.log("人员",res.data)
       })
       this.connectList = []
-      this.$refs.supermap.clearC()
+      // this.$refs.supermap.clearC() //clearC undefined
     },
     //获取左侧人员列表
     getForestLeader(linJob, linType) {
@@ -253,7 +260,19 @@ export default {
       this.$refs.supermap.clearC()
     },
     //点击左侧人员列表获取轨迹
-    getLeaderTrack(userId) {
+    getLeaderTrack(personId) {
+      getTrackList(personId).then(res => {
+        console.log("轨迹",res.data);
+        if(res.data.length > 0){// 当前资源人员有巡查轨迹 获取最新一条轨迹
+          this.xunLinListOne = res.data;
+          this.getPointList(res.data[0].id);
+        }else {// 清空上一用户落点
+          this.xunLinListOne = [{"timeBegin": "当前资源人员", "timeEnd": "暂无巡查轨迹"}];
+          this.$refs.supermap.clearC()
+        }
+      })
+    },
+    getLeaderTrack_original(userId) {
       this.listCurrentIndex1 = userId
       let that = this
       this.connectList = []
@@ -282,6 +301,28 @@ export default {
       })
     },
 
+    getPointList(trackId) {
+      let that = this;
+      this.connectList = [];
+      getPointList(trackId).then(res => {
+        console.log("落点",res.data)
+        if (res.data != null && res.data.length > 0) {
+          for (let i = 0; i < res.data.length; i++) {
+            let latlng = {
+              lat: res.data[i].latitude,
+              lng: res.data[i].longitude
+            }
+            this.connectList.push(latlng)
+          }
+          setTimeout(() => {
+            that.$refs.supermap.clearC()
+            that.$refs.supermap.setConnectList(this.connectList, 'red')
+          }, 1000)
+        } else {
+          that.$refs.supermap.clearC()
+        }
+      })
+    },
     setConnectList(points, planName) {
       this.listCurrentIndex2 = planName
       this.connectList = []