JX.LI 2 lat temu
rodzic
commit
a939e4113f
2 zmienionych plików z 24 dodań i 23 usunięć
  1. 17 15
      src/api/monitor.js
  2. 7 8
      src/views/monitor.vue

+ 17 - 15
src/api/monitor.js

@@ -1,10 +1,15 @@
 import request from '@/utils/request'
 
 // 获取左侧动态感知设备
-export function selectDeviceType() {
+export function selectDeviceType(deptId) {
   return request({
     url: '/center-agriculture/monitor/selectDeviceType',
     method: 'post',
+    data: {
+      "deptId": deptId,
+      "type": "6"
+    }
+
   })
 }
 // 根据设备类型查看列表
@@ -13,7 +18,8 @@ export function selectCameraByDeptId(deptId) {
     url: '/center-agriculture/monitor/selectCameraByDeptId',
     method: 'post',
     data: {
-      "deptId": deptId
+      "deptId": deptId,
+      "type": "6"
     }
   })
 }
@@ -75,12 +81,12 @@ export function getSensorListByDeptId(deptId) {
 }
 //根据部门id查询部门及部门以下的数据,没有则默认查询所有
 export function getDlblistBydeptId(deptId) {
-   let url = "";
-    if(deptId!=null){
-      url= '/center-fire/VisuForestMonitorCenterController/getDlblistBydeptId?deptId=' + deptId+"&type=6";
-    }else{
-      url= '/center-fire/VisuForestMonitorCenterController/getDlblistBydeptId?type=6';
-    }
+  let url = "";
+  if (deptId != null) {
+    url = '/center-fire/VisuForestMonitorCenterController/getDlblistBydeptId?deptId=' + deptId + "&type=6";
+  } else {
+    url = '/center-fire/VisuForestMonitorCenterController/getDlblistBydeptId?type=6';
+  }
   return request({
     url: url,
     method: 'get',
@@ -90,14 +96,10 @@ export function getDlblistBydeptId(deptId) {
 
 //根据部门id查询部门及部门以下的数据,没有则默认查询所有
 export function getMonitorDeviceAndDataList(deptId) {
-    let url = "";
-    if(deptId!=null){
-      url= '/center-monitor/device/getMonitorDeviceAndDataList?deptId=' + deptId+"&type=6";
-    }else{
-      url= '/center-monitor/device/getMonitorDeviceAndDataList'+"?type=6";
-    }
+  let url = "";
+  url = '/center-monitor/device/getMonitorDeviceAndDataList?deptId=' + deptId + "&type=6";
   return request({
     url: url,
     method: 'get',
   })
-}
+}

+ 7 - 8
src/views/monitor.vue

@@ -114,7 +114,7 @@
             </div>
             <div class="i-list-con h-25">
               <div class="d-l-con" v-for="(item, index) in keyAreaList" :class="{ on: listCurrentIndex3 == index }"
-                @click="getRegionalFlag(item.id)">
+                @click="getRegionalFlag(item.id,index)">
                 <div class="d-l-l-text">
                   <i class="i-small"></i>
                   <h4>{{ item.areaName }}</h4>
@@ -221,7 +221,7 @@
       //   this.getMonitorDeviceAndDataList()
       // }, 5 * 60 * 1000)
       this.getDlblistBydeptIds(-1);
-      this.selectDeviceType(-1);
+      this.selectDeviceType();
     },
     beforeDestroy() {
       clearInterval(this.cgqTimer); //关闭
@@ -366,7 +366,7 @@
       //传感器2
       getMonitorDeviceAndDataLists() {
         let that = this;
-        getMonitorDeviceAndDataList().then((res) => {
+        getMonitorDeviceAndDataList(this.deptId).then((res) => {
           that.sensorNum = res.data.length;
         });
       },
@@ -467,7 +467,6 @@
         this.onChuan = true;
         this.localMark = "chuan";
         this.placeholderMsg = "请输入传感器名称";
-        this.deptId = null;
         this.getMonitorDeviceAndDataList();
         clearInterval(this.cgqTimer);
         this.cgqTimer = setInterval(() => {
@@ -1244,9 +1243,9 @@
           that.keyAreaList = res.data;
         });
       },
-      getRegionalFlag(id) {
+      getRegionalFlag(id,index) {
         //获取重点区域
-        this.listCurrentIndex3 = id;
+        this.listCurrentIndex3 = index;
         let that = this;
         getRegionalFlag(id).then((res) => {
           that.graphicsList = [];
@@ -1438,7 +1437,7 @@
         this.iconCurrentIndex1 = index;
         //获取左侧动态感知设备
         let that = this;
-        selectDeviceType().then((res) => {
+        selectDeviceType(that.deptId).then((res) => {
           that.cameraMarkersList = [];
           that.visuForestCloudMapDeviceBOList =
             res.data.visuForestCloudMapDeviceBOList;
@@ -1967,4 +1966,4 @@
     height: 600px;
     border: 1px solid red;
   }
-</style>
+</style>