Explorar o código

传感器默认不传部门ID

彭宇 %!s(int64=2) %!d(string=hai) anos
pai
achega
dd1b6a506f
Modificáronse 1 ficheiros con 101 adicións e 106 borrados
  1. 101 106
      src/views/monitor.vue

+ 101 - 106
src/views/monitor.vue

@@ -269,8 +269,8 @@ export default {
       this.getTreeselect();
       this.deptId = Cookies.get("deptId");
       // this.getSensorListByDeptIds()
-      this.getMonitorDeviceAndDataLists();
-      // this.getDlblistBydeptIds();
+      this.getMonitorDeviceAndDataLists(null);
+      // this.getDlblistBydeptIds(null);
       // this.chuanSet();
       this.selectDeviceType(-1);
     }, 2000)
@@ -391,10 +391,10 @@ export default {
 
       }
     },
-    getMonitorDeviceAndDataList() {
+    getMonitorDeviceAndDataList(deptId) {
       let list = [];
       let markersList = [];
-      getMonitorDeviceAndDataList(this.deptId).then((res) => {
+      getMonitorDeviceAndDataList(deptId).then((res) => {
         this.visuForestCloudCameraBOListSearch = [];
         list = res.data;
         //this.sensorNum = list.length
@@ -878,7 +878,6 @@ export default {
       // this.findCameraByDept(data.id)
       if (that.localMark == "she") {
         that.selectCameraByDeptId(data.id);
-        debugger;
         getCamerasByDeptId(data.id).then((res) => {
           that.$refs.TVWalls.showTVWall(res.data, {
             longitude: data.deptLongitude,
@@ -887,7 +886,7 @@ export default {
         });
       } else if (that.localMark == "chuan") {
         //that.getSensorListByDeptId()
-        that.getMonitorDeviceAndDataList();
+        that.getMonitorDeviceAndDataList(data.id);
       } else if (that.localMark == "la") {
         // that.getDlblistBydeptId();
       }
@@ -909,7 +908,7 @@ export default {
       this.placeholderMsg = "请输入云广播名称";
       clearInterval(this.cgqTimer);
       this.deptId = Cookies.get("deptId");
-      this.getDlblistBydeptId();
+      this.getDlblistBydeptId(this.deptId);
     },
     chuanClick() {
       this.onLa = false;
@@ -919,115 +918,111 @@ export default {
       this.placeholderMsg = "请输入传感器名称";
       this.deptId = Cookies.get("deptId");
       let that = this;
-      this.getMonitorDeviceAndDataList();
+      this.getMonitorDeviceAndDataList(null);
       clearInterval(this.cgqTimer);
-      this.cgqTimer = setInterval(() => {
-        that.getMonitorDeviceAndDataList();
-      }, 20 * 1000);
-      this.getMonitorDeviceAndDataList();
     },
     //传感器2
-    getMonitorDeviceAndDataLists() {
+    getMonitorDeviceAndDataLists(deptId) {
       let that = this;
-      getMonitorDeviceAndDataList(this.deptId).then((res) => {
+      getMonitorDeviceAndDataList(deptId).then((res) => {
         that.sensorNum = res.data.length;
       });
     },
     // 云广播
-    // getDlblistBydeptId() {
-    //   let that = this;
-    //   let markersList = [];
-    //   getDlblistBydeptId(that.deptId)
-    //     .then(function (res) {
-    //       that.loudspeakerNum = res.data.length;
-    //       that.visuForestCloudCameraBOListSearch = [];
-    //       if (res.data != null && res.data.length > 0) {
-    //         for (let j = 0; j < res.data.length; j++) {
-    //           let dat = {
-    //             cameraName: res.data[j].name,
-    //             longitude: res.data[j].longitude,
-    //             latitude: res.data[j].latitude,
-    //           };
-    //           that.visuForestCloudCameraBOListSearch.push(dat);
-    //         }
-    //         for (let i = 0; i < res.data.length; i++) {
-    //           let markersMap = {
-    //             lng: 124.59,
-    //             lat: 43.02,
-    //             icon: "marker",
-    //             bindPopupHtml:
-    //               '<div class="map-tip">' +
-    //               "<span>" +
-    //               '                  <div class="d-l-con">' +
-    //               '                  <div class="d-l-l-text">' +
-    //               "                  <h4>名称:" +
-    //               (res.data[i].name ? res.data[i].name : "") +
-    //               "</h4>" +
-    //               "                </div>" +
-    //               "                </div>" +
-    //               "                </span>" +
-    //               "<span>" +
-    //               '                  <div class="d-l-con">' +
-    //               '                  <div class="d-l-l-text">' +
-    //               "                  <h4>位置:" +
-    //               (res.data[i].position ? res.data[i].position : "") +
-    //               "</h4>" +
-    //               "                </div>" +
-    //               "                </div>" +
-    //               "                </span>" +
-    //               "<span>" +
-    //               '                  <div class="d-l-con">' +
-    //               '                  <div class="d-l-l-text">' +
-    //               "                  <h4>备注:" +
-    //               (res.data[i].remark ? res.data[i].remark : "") +
-    //               "</h4>" +
-    //               "                </div>" +
-    //               "                </div>" +
-    //               "                </span>" +
-    //               "<span>" +
-    //               '                  <div class="d-l-con">' +
-    //               '                  <div class="d-l-l-text">' +
-    //               "                  <h4>经纬度:" +
-    //               res.data[i].longitude +
-    //               "," +
-    //               res.data[i].latitude +
-    //               "</h4>" +
-    //               "                </div>" +
-    //               "                </div>" +
-    //               "                </span>" +
-    //               "</div>",
-    //             click: "jump",
-    //             parameter: "",
-    //             name: "",
-    //             keepBindPopup: false,
-    //             isAggregation: false,
-    //           };
-    //           markersMap.icon = "big-horn";
-    //
-    //           markersMap.lng = res.data[i].longitude;
-    //           markersMap.lat = res.data[i].latitude;
-    //           markersList.push(markersMap);
-    //         }
-    //         setTimeout(() => {
-    //           that.$refs.supermap.clearM();
-    //           that.$refs.supermap.clearMRadius();
-    //           that.$refs.supermap.setMarkers(markersList);
-    //         }, 2000);
-    //       } else {
-    //         setTimeout(() => {
-    //           that.$refs.supermap.clearM();
-    //           that.$refs.supermap.clearMRadius();
-    //         }, 2000);
-    //       }
-    //     })
-    //     .catch(function (error) {
-    //       console.error(error);
-    //     });
-    // },
-    getDlblistBydeptIds() {
+    getDlblistBydeptId(deptId) {
+      let that = this;
+      let markersList = [];
+      getDlblistBydeptId(deptId)
+        .then(function (res) {
+          that.loudspeakerNum = res.data.length;
+          that.visuForestCloudCameraBOListSearch = [];
+          if (res.data != null && res.data.length > 0) {
+            for (let j = 0; j < res.data.length; j++) {
+              let dat = {
+                cameraName: res.data[j].name,
+                longitude: res.data[j].longitude,
+                latitude: res.data[j].latitude,
+              };
+              that.visuForestCloudCameraBOListSearch.push(dat);
+            }
+            for (let i = 0; i < res.data.length; i++) {
+              let markersMap = {
+                lng: 124.59,
+                lat: 43.02,
+                icon: "marker",
+                bindPopupHtml:
+                  '<div class="map-tip">' +
+                  "<span>" +
+                  '                  <div class="d-l-con">' +
+                  '                  <div class="d-l-l-text">' +
+                  "                  <h4>名称:" +
+                  (res.data[i].name ? res.data[i].name : "") +
+                  "</h4>" +
+                  "                </div>" +
+                  "                </div>" +
+                  "                </span>" +
+                  "<span>" +
+                  '                  <div class="d-l-con">' +
+                  '                  <div class="d-l-l-text">' +
+                  "                  <h4>位置:" +
+                  (res.data[i].position ? res.data[i].position : "") +
+                  "</h4>" +
+                  "                </div>" +
+                  "                </div>" +
+                  "                </span>" +
+                  "<span>" +
+                  '                  <div class="d-l-con">' +
+                  '                  <div class="d-l-l-text">' +
+                  "                  <h4>备注:" +
+                  (res.data[i].remark ? res.data[i].remark : "") +
+                  "</h4>" +
+                  "                </div>" +
+                  "                </div>" +
+                  "                </span>" +
+                  "<span>" +
+                  '                  <div class="d-l-con">' +
+                  '                  <div class="d-l-l-text">' +
+                  "                  <h4>经纬度:" +
+                  res.data[i].longitude +
+                  "," +
+                  res.data[i].latitude +
+                  "</h4>" +
+                  "                </div>" +
+                  "                </div>" +
+                  "                </span>" +
+                  "</div>",
+                click: "jump",
+                parameter: "",
+                name: "",
+                keepBindPopup: false,
+                isAggregation: false,
+              };
+              markersMap.icon = "big-horn";
+
+              markersMap.lng = res.data[i].longitude;
+              markersMap.lat = res.data[i].latitude;
+              markersList.push(markersMap);
+            }
+            setTimeout(() => {
+              that.$refs.supermap.clearM();
+              that.$refs.supermap.clearMRadius();
+              that.$refs.supermap.setMarkers(markersList);
+            }, 2000);
+          } else {
+            setTimeout(() => {
+              that.$refs.supermap.clearM();
+              that.$refs.supermap.clearMRadius();
+            }, 2000);
+          }
+        })
+        .catch(function (error) {
+          console.error(error);
+        });
+    },
+    getDlblistBydeptIds(deptId) {
       let that = this;
 
-      getDlblistBydeptId(that.deptId)
+      getDlblistBydeptId(deptId)
         .then(function (res) {
           that.loudspeakerNum = res.data.length;
         })