xzw 4 lat temu
rodzic
commit
985c833963
3 zmienionych plików z 56 dodań i 23 usunięć
  1. 15 2
      js/edit.js
  2. 37 20
      js/main_2020_show.js
  3. 4 1
      js/selectHardware.js

+ 15 - 2
js/edit.js

@@ -1267,7 +1267,7 @@ Hotpoint.prototype.initSaveHot = function() {
 }
 
 
-Hotpoint.prototype.addHardware = function(dom){
+/* Hotpoint.prototype.addHardware = function(dom){
     var hot = this.editSpot
     var info = {
         //index:  dom.chidren[1], //序号 1
@@ -1279,7 +1279,20 @@ Hotpoint.prototype.addHardware = function(dom){
     hot.hardwareTemp = info;
     hot.showPannel()
     this.hotpointDetail.find("li[name='addHardware'] #grAdd").addClass("unable");
-}
+} */
+
+Hotpoint.prototype.addHardware = function(info){
+    var hot = this.editSpot 
+    hot.hardwareTemp = info;
+    hot.showPannel()
+    this.hotpointDetail.find("li[name='addHardware'] #grAdd").addClass("unable");
+    /* code: "13"
+    devTypeId: "0b4fec766ab0a3970ce20cd6b6200d81"
+    devTypeName: "空调"
+    id: "18c60fd90b76bf8d4cab4ec7cf75ed84"
+    name: "电表"
+    status: "1" */
+} 
 
 
 

+ 37 - 20
js/main_2020_show.js

@@ -15536,27 +15536,44 @@ window.Modernizr = function(n, e, t) {
         hot.prototype.showPannel = function(o={}){
             var hardware = this.infoAttribute.hardware
             console.log(window.hotNeedUpdatePannel)
-            if(hardware && hardware.id!=void 0){
-                if(hardware.devTypeName == "温湿度"){
-                    
-                }else/*  if(hardware.devTypeName == "温湿度") */{
+            if(hardware && hardware.id!=void 0){ 
+
+                $.ajax({//获取设备状态
+                  method: "GET",
+                  headers: {
+                    "Content-Type": "application/json",
+                  },
+                  dataType: "json",
+                  contentType: "application/json",
+                  url: url + `/api/device/getStatus/${hardware.deviceCode}`, 
+                  success: function (data) {
+                    console.log(data)  
+                    if (data.code === 0) { 
+                        if(hardware.devTypeId == "温湿度"){
                     
-                }   
-                
-                
-                $("#hotPannel>div").css("display","block");
-                $("#hotPannel .title").text(hardware.name); 
-                this.updatePannel()
-                window.hotNeedUpdatePannel = this
-                
-                if(o.focus){
-                    if(player.mode == 'panorama'){
-                        this.examine(player)
-                    }else if(player.mode != 'transitioning'){
-                        player.focusPoint({/* modelSize: size,  */aim: this.mesh.position})
-                    } 
-                }
-                return true
+                        }else if(hardware.devTypeId == "温湿度"){
+                            
+                        }
+                        $("#hotPannel>div").css("display","block");
+                        $("#hotPannel .title").text(hardware.name); 
+                        this.updatePannel()
+                        window.hotNeedUpdatePannel = this
+                        
+                        if(o.focus){
+                            if(player.mode == 'panorama'){
+                                this.examine(player)
+                            }else if(player.mode != 'transitioning'){
+                                player.focusPoint({/* modelSize: size,  */aim: this.mesh.position})
+                            } 
+                        } 
+                    } else {
+                       
+                    }
+                  },
+                });
+
+               
+                return true 
                 
             }else{
                 $("#hotPannel>div").css("display","");

+ 4 - 1
js/selectHardware.js

@@ -1,4 +1,5 @@
 $(function () {
+   var curPageData;
   let url = ``
   // let url = `http://8.135.106.227:8004/`
   let gName = 'Gridtable'
@@ -45,7 +46,7 @@ $(function () {
       alert('请选择设备')
       return
     }
-    window.editTool.hotpoint.addHardware(item[0])
+    window.editTool.hotpoint.addHardware(curPageData.find(e=>e.id == item[0].children[5].innerHTML)   /* item[0] */)
     $('.jsGrid-body').hide()
     //alert(item)
     console.log(GridManager.getCheckedTr(gName));
@@ -106,6 +107,8 @@ $(function () {
 
         success: function (data) {
           if (data.code == 0) {
+            curPageData = data.data.records
+              
             resolve({
               data:data.data.records,
               totals: data.data.total,