xzw 4 年之前
父節點
當前提交
b35b5d4e50
共有 1 個文件被更改,包括 193 次插入180 次删除
  1. 193 180
      js/main_2020_show.js

+ 193 - 180
js/main_2020_show.js

@@ -28,7 +28,7 @@ var getAjax = function(url, success, errorString){
       },
       dataType: "json",
       contentType: "application/json",
-      url: `/api/device/getStatus/${hardware.code}`,
+      url: url,
         success: (data)=> {
             success(data)
         },
@@ -15597,195 +15597,208 @@ 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){ 
                 //获取设备状态
                 getDeviceInfo(hardware.id, (data)=>{
                     hot.setDeviceStatus(data[0].status == 2)
-
-
                     
-                })
-                
-                getAjax(`/api/device/getStatus/${hardware.code}`,  (data)=> {
-                    console.log(data)  
-                    if (data.code === 0) {
-                        data = data.data;
-                        var devType = hardwareTypes.find(type=>type.id == hardware.devTypeId).name
-                        $("#hotPannel>div").addClass("hide")
-                        if(devType == "灯控"){
-                            $("#hotPannel>div[name='light']").removeClass("hide")
-                            
-                            var ifOn = data.find(e=>e.paramCode == '02').paramValue == '1'
-                            $("#hotPannel>div[name='light']  input").prop('checked', ifOn);
-                              
-                              
-                              
-                        }else if(devType == "温湿度"){
-                            $("#hotPannel>#temperature").removeClass("hide")
-                            
-                            
-                            loadTemperature({
-                                id:"temperature",//dom Id
-                                val:70 //度数    
-                            })
-                            
-                            
-                            
-                        }else if(devType == "摄像头"){
-                            $("#hotPannel>.m-con").removeClass("hide") 
-                            
-                            
-                            /* "result": [
-                                {
-                                  "id": "97347887d0dbad459bca30118fe9fae2",
-                                  "devtypeId": "ab073575c1628d2b42e2e915f1bee384",
-                                  "deviceCode": "34020000001320010058",
-                                  "paramCode": "12",
-                                  "paramValue": "0",
-                                  "createBy": "admin",
-                                  "createTime": "2021-03-19",
-                                  "updateBy": null,
-                                  "updateTime": "2021-03-19",
-                                  "paramName": null,
-                                  "devTypeParam": null
-                                },
-                                {
-                                  "id": "c8cc2ea0ad2a86c4fa267325caf69c1c",
-                                  "devtypeId": "ab073575c1628d2b42e2e915f1bee384",
-                                  "deviceCode": "34020000001320010058",
-                                  "paramCode": "11",
-                                  "paramValue": "1",
-                                  "createBy": "admin",
-                                  "createTime": "2021-03-19",
-                                  "updateBy": null,
-                                  "updateTime": "2021-03-19",
-                                  "paramName": null,
-                                  "devTypeParam": null
-                                },
-                                {
-                                  "id": "e6bc35c5c9ce26509091ca34e21bf237",
-                                  "devtypeId": "ab073575c1628d2b42e2e915f1bee384",
-                                  "deviceCode": "34020000001320010058",
-                                  "paramCode": "10",
-                                  "paramValue": "2",
-                                  "createBy": "admin",
-                                  "createTime": "2021-03-19",
-                                  "updateBy": null,
-                                  "updateTime": "2021-03-19",
-                                  "paramName": null,
-                                  "devTypeParam": null
-                                } 
-                                
-                                 {
-                                  "paramCode": "12",
-                                  "name": "类型",
-                                  "paramValue": "{\"0\":\"枪机\",\"1\":\"球机\"}"
-                                },
-                                {
-                                  "paramCode": "01",
-                                  "name": "通道号",
-                                  "paramValue": "34020000001320010058"
-                                },
-                                {
-                                  "paramCode": "10",
-                                  "name": "云台控制",
-                                  "paramValue": "{\"1\":\"支持\",\"2\":\"不支持\"}"
-                                },
-                                {
-                                  "paramCode": "11",
-                                  "name": "方向",
-                                  "paramValue": "{\"1\":\"左\",\"2\":\"右\",\"3\":\"上\",\"4\":\"下\"}"
-                                }
-                              ],
-                              "msg": "操作成功"
+                    if(this.deviceStatus){//在线
+                    
+                        getAjax(`/api/device/getStatus/${hardware.code}`,  (data)=> {
+                            console.log(data)  
+                            if (data.code === 0) {
+                                data = data.data;
+                                var devType = hardwareTypes.find(type=>type.id == hardware.devTypeId).name
+                                $("#hotPannel>div").addClass("hide")
                                 
                                 
-                                */
-                            
-                            
-                            
-                            /* "code": 0,
-                              "data": {
-                                "external": {
-                                  "rtmp": "rtmp://14.215.216.123:18080/rtp/00A1537C",
-                                  "flv": "http://14.215.216.123:18080/rtp/00A1537C.flv",
-                                  "wsFlv": "ws://14.215.216.123:18080/rtp/00A1537C.flv",
-                                  "rtsp": "rtsp://14.215.216.123:18080/rtp/00A1537C",
-                                  "hls": "http://14.215.216.123:18080/rtp/00A1537C/hls.m3u8"
-                                },
-                                "id": "34020000001320010058",
-                                "interiorIp": "192.168.6.11",
-                                "interior": {
-                                  "rtmp": "rtmp://192.168.6.11:18080/rtp/00A1537C",
-                                  "flv": "http://192.168.6.11:18080/rtp/00A1537C.flv",
-                                  "wsFlv": "ws://192.168.6.11:18080/rtp/00A1537C.flv",
-                                  "rtsp": "rtsp://192.168.6.11:18080/rtp/00A1537C",
-                                  "hls": "http://192.168.6.11:18080/rtp/00A1537C/hls.m3u8"
-                                }
-                              },
-                              "msg": "操作成功" */
-                             getAjax(`/api/device/getLive/${hardware.code}` (data2)=> {
-                                  if(data2.code == 0){
-                                    loadMonitor({
-                                        id:"monitor",
-                                        url:  data2.data.external.hls    //'http://14.215.216.123:18080/rtp/00A153DF/hls.m3u8'
-                                    }) 
-                                  }
-                             },"获取视频地址失败" )
-                              
-                              
-                            
-                            
-                            
-                            
-                            
-                        }else if(devType == "空调"){
-                            $("#hotPannel>.ac-con").removeClass("hide")
+                                if(devType == "灯控"){
+                                    $("#hotPannel>div[name='light']").removeClass("hide")
+                                    
+                                    var ifOn = data.find(e=>e.paramCode == '02').paramValue == '1'
+                                    $("#hotPannel>div[name='light']  input").prop('checked', ifOn);
+                                      
+                                      
+                                      
+                                }else if(devType == "温湿度"){
+                                    $("#hotPannel>#temperature").removeClass("hide")
+                                    
+                                    
+                                    loadTemperature({
+                                        id:"temperature",//dom Id
+                                        val:70 //度数    
+                                    })
+                                    
+                                    
+                                    
+                                }else if(devType == "摄像头"){
+                                    $("#hotPannel>.m-con").removeClass("hide") 
+                                    
+                                    
+                                    /* "result": [
+                                        {
+                                          "id": "97347887d0dbad459bca30118fe9fae2",
+                                          "devtypeId": "ab073575c1628d2b42e2e915f1bee384",
+                                          "deviceCode": "34020000001320010058",
+                                          "paramCode": "12",
+                                          "paramValue": "0",
+                                          "createBy": "admin",
+                                          "createTime": "2021-03-19",
+                                          "updateBy": null,
+                                          "updateTime": "2021-03-19",
+                                          "paramName": null,
+                                          "devTypeParam": null
+                                        },
+                                        {
+                                          "id": "c8cc2ea0ad2a86c4fa267325caf69c1c",
+                                          "devtypeId": "ab073575c1628d2b42e2e915f1bee384",
+                                          "deviceCode": "34020000001320010058",
+                                          "paramCode": "11",
+                                          "paramValue": "1",
+                                          "createBy": "admin",
+                                          "createTime": "2021-03-19",
+                                          "updateBy": null,
+                                          "updateTime": "2021-03-19",
+                                          "paramName": null,
+                                          "devTypeParam": null
+                                        },
+                                        {
+                                          "id": "e6bc35c5c9ce26509091ca34e21bf237",
+                                          "devtypeId": "ab073575c1628d2b42e2e915f1bee384",
+                                          "deviceCode": "34020000001320010058",
+                                          "paramCode": "10",
+                                          "paramValue": "2",
+                                          "createBy": "admin",
+                                          "createTime": "2021-03-19",
+                                          "updateBy": null,
+                                          "updateTime": "2021-03-19",
+                                          "paramName": null,
+                                          "devTypeParam": null
+                                        } 
+                                        
+                                         {
+                                          "paramCode": "12",
+                                          "name": "类型",
+                                          "paramValue": "{\"0\":\"枪机\",\"1\":\"球机\"}"
+                                        },
+                                        {
+                                          "paramCode": "01",
+                                          "name": "通道号",
+                                          "paramValue": "34020000001320010058"
+                                        },
+                                        {
+                                          "paramCode": "10",
+                                          "name": "云台控制",
+                                          "paramValue": "{\"1\":\"支持\",\"2\":\"不支持\"}"
+                                        },
+                                        {
+                                          "paramCode": "11",
+                                          "name": "方向",
+                                          "paramValue": "{\"1\":\"左\",\"2\":\"右\",\"3\":\"上\",\"4\":\"下\"}"
+                                        }
+                                      ],
+                                      "msg": "操作成功"
+                                        
+                                        
+                                        */
+                                    
+                                    
+                                    
+                                    /* "code": 0,
+                                      "data": {
+                                        "external": {
+                                          "rtmp": "rtmp://14.215.216.123:18080/rtp/00A1537C",
+                                          "flv": "http://14.215.216.123:18080/rtp/00A1537C.flv",
+                                          "wsFlv": "ws://14.215.216.123:18080/rtp/00A1537C.flv",
+                                          "rtsp": "rtsp://14.215.216.123:18080/rtp/00A1537C",
+                                          "hls": "http://14.215.216.123:18080/rtp/00A1537C/hls.m3u8"
+                                        },
+                                        "id": "34020000001320010058",
+                                        "interiorIp": "192.168.6.11",
+                                        "interior": {
+                                          "rtmp": "rtmp://192.168.6.11:18080/rtp/00A1537C",
+                                          "flv": "http://192.168.6.11:18080/rtp/00A1537C.flv",
+                                          "wsFlv": "ws://192.168.6.11:18080/rtp/00A1537C.flv",
+                                          "rtsp": "rtsp://192.168.6.11:18080/rtp/00A1537C",
+                                          "hls": "http://192.168.6.11:18080/rtp/00A1537C/hls.m3u8"
+                                        }
+                                      },
+                                      "msg": "操作成功" */
+                                     getAjax(`/api/device/getLive/${hardware.code}`, (data2)=> {
+                                          if(data2.code == 0){
+                                            loadMonitor({
+                                                id:"monitor",
+                                                url:  data2.data.external.hls    //'http://14.215.216.123:18080/rtp/00A153DF/hls.m3u8'
+                                            }) 
+                                          }
+                                     },"获取视频地址失败" )
+                                      
+                                      
+                                    
+                                    
+                                    
+                                    
+                                    
+                                }else if(devType == "空调"){
+                                    $("#hotPannel>.ac-con").removeClass("hide")
 
 
-/*                          摆叶位置	06	可读写	下拉框			{"1":"上","2":"下","3":"左","4":"右"}	-	编辑删除
-                        3	温度	05	可读写	文本框				-	编辑删除
-                        4	开关机	02	可读写	下拉框			{"0":"关","1":"开"}	-	编辑删除
-                        5	风速	04	可读写	下拉框			{"1":"低风","2":"中风","3":"高风"}	-	编辑删除
-                        6	摆叶状态	07	可读写	下拉框			{"0":"关","1":"开"}	-	编辑删除
-                        7	模式	03	可读写	下拉框			{"0":"自动","1":"除湿","2":"冷风","3":"送风","4":"暖风"}	-	
- */
-                            
-                            
-                            var ifOn = data.find(e=>e.paramCode == '02').paramValue == '1' 
-                            var mode = data.find(e=>e.paramCode == '03').paramValue 
-                            var windSpeed = data.find(e=>e.paramCode == '04').paramValue
-                            var temperature = data.find(e=>e.paramCode == '05').paramValue
-                            var fanPos = data.find(e=>e.paramCode == '06').paramValue
-                            var fanState = data.find(e=>e.paramCode == '07').paramValue == '1' 
-                            
-                            loadAirConditioner({
-                                id:"air-conditioner",
-                                val:parseInt(temperature),
-                                type: mode == 0 ? '自动': mode == 1 ? '除湿': mode == 2 ? '冷风': mode == 3 ? '送风' : '暖风',//模式
-                                ifOn,//开关机
-                                windSpeed : windSpeed == 1 ? "低风" : windSpeed == 2 ? "中风" :  "高风",//风速
-                                fanPos : fanPos == 1 ? "上" : fanPos == 2 ? "下" : fanPos == 3  ? "左" : "右",//摆叶位置
-                                fanState //摆叶状态
-                            }) 
-                        }
-                        $("#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 {
-                        
+                                 /* 摆叶位置	06	可读写	下拉框			{"1":"上","2":"下","3":"左","4":"右"}	-	编辑删除
+                                3	温度	05	可读写	文本框				-	编辑删除
+                                4	开关机	02	可读写	下拉框			{"0":"关","1":"开"}	-	编辑删除
+                                5	风速	04	可读写	下拉框			{"1":"低风","2":"中风","3":"高风"}	-	编辑删除
+                                6	摆叶状态	07	可读写	下拉框			{"0":"关","1":"开"}	-	编辑删除
+                                7	模式	03	可读写	下拉框			{"0":"自动","1":"除湿","2":"冷风","3":"送风","4":"暖风"}	-	
+                                    */
+                                    
+                                    
+                                    var ifOn = data.find(e=>e.paramCode == '02').paramValue == '1' 
+                                    var mode = data.find(e=>e.paramCode == '03').paramValue 
+                                    var windSpeed = data.find(e=>e.paramCode == '04').paramValue
+                                    var temperature = data.find(e=>e.paramCode == '05').paramValue
+                                    var fanPos = data.find(e=>e.paramCode == '06').paramValue
+                                    var fanState = data.find(e=>e.paramCode == '07').paramValue == '1' 
+                                    
+                                    loadAirConditioner({
+                                        id:"air-conditioner",
+                                        val:parseInt(temperature),
+                                        type: mode == 0 ? '自动': mode == 1 ? '除湿': mode == 2 ? '冷风': mode == 3 ? '送风' : '暖风',//模式
+                                        ifOn,//开关机
+                                        windSpeed : windSpeed == 1 ? "低风" : windSpeed == 2 ? "中风" :  "高风",//风速
+                                        fanPos : fanPos == 1 ? "上" : fanPos == 2 ? "下" : fanPos == 3  ? "左" : "右",//摆叶位置
+                                        fanState //摆叶状态
+                                    }) 
+                                }
+                                
+                                
+                                
+                                
+                                $("#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 {
+                                
+                            }
+                        }, '获取数据失败')
+                
+                
+                    }else{
+                        alert('该设备不在线')
                     }
-                }, '获取数据失败')
+
+                    
+                })
+