liling 7 ay önce
ebeveyn
işleme
631c866b63
1 değiştirilmiş dosya ile 100 ekleme ve 36 silme
  1. 100 36
      main.html

+ 100 - 36
main.html

@@ -9,11 +9,21 @@
 <body onclick="$('#imp_item,#date_select,#day_select').hide();$('#search_result').html('').hide();$('#search input').val('')">
 <div id="loading_a1"></div>
 <div id="loading">正在加载模型中...</div>
-<div id="top" class="top">
-    <div id="maogao_btn" title=""
+<div for="FAC" id="top" class="top">    
+    <div title="返回主视图"
+         style="cursor: pointer;position: absolute;right: 10px;top: 25px;height: 38px;width: 38px;text-align: center;"
+         onclick="backMasterView()"><img src="image/view.png"></div>
+</div>
+<div for="IN03" id="top" class="top">    
+    <div title="返回主视图"
+         style="cursor: pointer;position: absolute;right: 10px;top: 25px;height: 38px;width: 38px;text-align: center;"
+         onclick="backMasterView()"><img src="image/view.png"></div>
+</div>
+<div for="IN02" id="top" class="top hideDiv">
+    <div  id="maogao_btn" title=""
          style="cursor: pointer;position: absolute;right: 176px;top: 25px;height: 38px;width: 38px;"><IMG
             src="image/menu1.png"></div>
-    <div id="autoplayer_btn" title="切换自动漫游"
+    <div  id="autoplayer_btn" title="切换自动漫游"
          style="cursor: pointer;position: absolute;right: 120px;top: 25px;height: 38px;width: 38px;"><IMG
             src="image/auto3d_stop.png"></div>
     <div id="imp_btn" title="导出数据"
@@ -23,7 +33,7 @@
          style="cursor: pointer;position: absolute;right: 10px;top: 25px;height: 38px;width: 38px;text-align: center;"
          onclick="backMasterView()"><img src="image/view.png"></div>
 </div>
-<div id="imp_item">
+<div for="IN02" id="imp_item">
     <div itemcode="1"><span>生产数据</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
     <div itemcode="2"><span>停机原因</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
     <div itemcode="4"><span>断纱分析</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>
@@ -40,7 +50,7 @@
     <!--			<div itemcode="1"><span>最近7天</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>-->
     <!--			<div itemcode="2"><span>自定义日期</span><img src="image/imp2.png" style="float: right;margin-top: 7px;"></div>-->
 </div>
-<div id="date_select">
+<div for="IN02" id="date_select">
     <div class="triangle"></div>
     <div style="margin-top: 5px;">
         <label for="datepicker1">开始:</label>
@@ -70,7 +80,7 @@
         <button type=button>确定</button>
     </div>
 </div>
-<div id="day_select">
+<div for="IN02" id="day_select">
     <div class="triangle"></div>
     <div style="margin-top: 5px;">
         <label for="datepicker1">产能预期天数:</label>
@@ -80,13 +90,13 @@
         <button type=button>确定</button>
     </div>
 </div>
-<div id="search"><input type="text" placeholder="请输入设备编号" maxlength="4"><img
+<div for="IN02" id="search" class="hideDiv"><input type="text" placeholder="请输入设备编号" maxlength="4"><img
         style="position: absolute;top: 20%;right: 5px;" src="image/search_icon.png" class="search_btn"></div>
 <div id="search_result"></div>
 <!-- 添加呈现的video标签或img标签,并设置必要的css来控制其大小 -->
 <video id="EngineContent" autoplay muted style="width: 1920px;height:1080px;">浏览器不支持</video>
 <!-- <img id="EngineContent"></img> -->
-<div id="dev_state" show="设备状态">
+<div for="IN02" id="dev_state" class="hideDiv" show="设备状态">
     <div class="title"></div>
     <div class="content">
         <div style="float: left;width: 100%;margin-top: 10px;">
@@ -160,7 +170,7 @@
         </div>
     </div>
 </div>
-<div id="dev_alarm" show="当前告警" style="color: #ffffff;font-size: 14px;">
+<div for="IN02" id="dev_alarm" class="hideDiv" show="当前告警" style="color: #ffffff;font-size: 14px;">
     <div class="title">当前无告警</div>
     <div class="content">
         <table style="width: 100%;font-weight: bold;" cellspacing=0>
@@ -188,7 +198,7 @@
         </div>
     </div>
 </div>
-<div id="dev_stop" show="停机原因" style="color: #ffffff;font-size: 14px;">
+<div for="IN02" id="dev_stop" class="hideDiv" show="停机原因" style="color: #ffffff;font-size: 14px;">
     <div class="title">当前无机器停机</div>
     <div class="content">
         <div style="margin-top: 15px;">
@@ -198,7 +208,7 @@
         </div>
     </div>
 </div>
-<div id="dev_xiaolv" show="生产效率" style="color: #ffffff;font-size: 14px;">
+<div for="IN02" id="dev_xiaolv" class="hideDiv" show="生产效率" style="color: #ffffff;font-size: 14px;">
     <div class="title"></div>
     <div class="content">
         <div style="">
@@ -243,7 +253,7 @@
         </div>
     </div>
 </div>
-<div id="dev_jiadonglv" show="稼动率周曲线" style="color: #ffffff;font-size: 14px;">
+<div for="IN02" id="dev_jiadonglv" class="hideDiv" show="稼动率周曲线" style="color: #ffffff;font-size: 14px;">
     <div class="title"></div>
     <div class="content">
         <div style="margin-top: 15px;">
@@ -253,7 +263,7 @@
         </div>
     </div>
 </div>
-<div id="dev_sc_qushi" show="生产趋势" style="color: #ffffff;font-size: 14px;">
+<div for="IN02" id="dev_sc_qushi" class="hideDiv" show="生产趋势" style="color: #ffffff;font-size: 14px;">
     <div class="title"></div>
     <div class="content">
         <div style="margin-top: 15px;">
@@ -263,7 +273,7 @@
         </div>
     </div>
 </div>
-<div id="dev_used_qushi" show="能耗趋势" style="color: #ffffff;font-size: 14px;">
+<div for="IN02" id="dev_used_qushi" class="hideDiv" show="能耗趋势" style="color: #ffffff;font-size: 14px;">
     <div class="title"></div>
     <div class="content">
         <div style="margin-top: 15px;">
@@ -2342,7 +2352,7 @@
             // 检查 event.originalEvent.deltaY 来判断滚动方向
             if (event.originalEvent.deltaY > 0) {
                 console.log('向下滚动:缩小'+zoomCount);
-                zoomCount = zoomCount>0?-1:zoomCount-1
+                zoomCount = zoomCount-1
                 if(zoomCount<=-3 && currentTargetType!="FAC"){
                     zoomCount=0;
                     //切换在全厂视图
@@ -2351,7 +2361,7 @@
                 }
             } else {
                 console.log('向上滚动:放大');
-                zoomCount = zoomCount<0?1:zoomCount+1
+                zoomCount = zoomCount+1
             }
         });
         $.datepicker.setDefaults($.datepicker.regional['zh-CN']);  //设置日期控制语言
@@ -2703,7 +2713,8 @@
         }
         $("#hour1,#hourP1").html(hour1Opts.join(''))
         $("#hour2,#hourP2").html(hour2Opts.join(''))
-        function GetData() {
+    });
+    function GetData() {
             $.getJSON(SERVER_URL + "/index", {}, function (res) {
                 setTimeout(function () {
                     //每60秒主动查询一次数据
@@ -2721,12 +2732,8 @@
                 DataFill.LoadSCLine(jsondata.weekData)
                 DataFill.LoadUsedLine(jsondata.weekData)
             })
-        }
-
-        //获取数据
-        GetData();
-
-        function GetAlarmData() {
+    }
+    function GetAlarmData() {
             $.getJSON(SERVER_URL + "/alarm", {}, function (res) {
                 setTimeout(function () {
                     //每10秒主动查询一次数据
@@ -2740,13 +2747,7 @@
                 DataFill.AlarmTable(jsondata.alarm);
                 DataFill.LoadPan(jsondata.pan);
             })
-        }
-
-        //获取数据
-        GetAlarmData();
-
-    });
-
+    }
     //获取已接入平台设备列表.将在设备模型加载完成后进行初始调用
     function GetOnlineDev() {
         $.getJSON(SERVER_URL + "/device/online", {}, function (res) {
@@ -2822,6 +2823,18 @@
         }
         player.Native.Camera.moveTo([-60.91624261330108, -39.68511717426356, 85.99570940739352], [-61.26059834308166, -0.225858934410347, -0.5930273740619612], [-0.007940809332449061, 0.9099266223396253, 0.41469324265623975], 1);
     }
+    //2号楼内部最佳视图
+    function backMasterViewBy03() {
+        if (AutoPlayer) {
+            const img = $("#autoplayer_btn").find("img");
+            img.attr("src", "image/auto3d_stop.png");
+            try {
+                player.Native.CameraAnimation.stop();
+            } catch (e) {
+            }
+        }
+        player.Native.Camera.moveTo([59.56050392473782, -16.715593393512307, 33.88405960390085], [-225.90035917394823, 266.6367338252189, -87.93132661854877], [-0.2057201109308161, 0.20420057431057317, 0.9570691518431909], 1);
+    }
 
     function backMasterView180() {
         if (AutoPlayer) {
@@ -2878,6 +2891,8 @@
     });
 
     async function loadFacModel(Native){
+        $("body>div.hideDiv[for='FAC']").show();
+        $("body>div.hideDiv[for!='FAC']").hide();
         await player.Native.Model.setModelVisible("IN02",false);
         await player.Native.Model.setModelVisible("IN03",false);
         await player.Native.Model.setModelVisible("IN04",false);
@@ -2891,18 +2906,51 @@
         await player.Native.Model.setModelVisible(currentTargetType,true);
         player.Native.CameraAnimation.clearKeyFrame();
     }
+    async function loadIn05Model(Native){
+        currentTargetType="IN05";
+        currentTargetType="FAC";//还未实现,默认停在工厂视图
+    }
+    async function loadIn04Model(Native){
+        currentTargetType="IN04";
+        currentTargetType="FAC"; //还未实现,默认停在工厂视图
+    }
+    async function loadIn03Model(Native){
+        currentTargetType="IN03";
+        await player.Native.Model.setModelVisible("FAC",false);
+        $("body>div.hideDiv[for='FAC']").hide();
+        $("body>div.hideDiv[for='"+currentTargetType+"']").show();
+        if(modelLoadState[currentTargetType]==null){
+            var cf = "data://models/T_03.pr";
+            var errStr = await PlayerUtils.call(Native.Model.loadModel, currentTargetType, cf);
+            modelLoadState[currentTargetType] = true;
+        }
+        await player.Native.Model.setModelVisible(currentTargetType,true);
+        player.Native.CameraAnimation.clearKeyFrame();
+    }
     async function loadIn02Model(Native){
         currentTargetType="IN02";
         await player.Native.Model.setModelVisible("FAC",false);
+        $("body>div.hideDiv[for='FAC']").hide();
+        $("body>div.hideDiv[for='"+currentTargetType+"']").show();
         if(modelLoadState[currentTargetType]==null){
-            var cf = "data://models/ALL.pr";
+            var cf = "data://models/T_02.pr";
             var errStr = await PlayerUtils.call(Native.Model.loadModel, currentTargetType, cf);
             modelLoadState[currentTargetType]=true;
             //let cfInfo=await player.Native.Model.getInfo("all");
             //player.Native.NodeProxy.setNodeRotation(cfInfo.nodePtr, [0,0,90]);
-            var rootItem = await player.Native.ModelTree.getRootItems()
-            //console.log(rootItem)
-            var rowItems = await player.Native.ModelTree.getSubItems(rootItem[0].item)
+            var rootItem = await player.Native.ModelTree.getRootItems();
+            var rootObj=null;
+            for (var i = 0; i < rootItem.length; i++) {
+                if(rootItem[i].name=="T_02"){
+                    rootObj = rootItem[i]
+                    break;
+                }
+            }
+            if(rootObj==null){
+                console.log('未找到该模型的根节点')
+                return;
+            }
+            var rowItems = await player.Native.ModelTree.getSubItems(rootObj.item)
             for (var row = 0; row < rowItems.length; row++) {
                 if (rowItems[row].name.length < 2 || rowItems[row].name.substr(0, 1) != "R") continue;
                 var devItems = await player.Native.ModelTree.getSubItems(rowItems[row].item)
@@ -2962,6 +3010,10 @@
             }
             ALARM_DEVS = [];//清除
         }
+        //获取数据
+        GetData();
+        //获取数据
+        GetAlarmData();
         //获取在线设备列表
         GetOnlineDev();
     }
@@ -2974,8 +3026,11 @@
         //totalcnt.innerText = devAllCount;
         //loadedcnt.innerText="0";
         loadFacModel(Native);
-        if (document.getElementById("loading") != null) document.getElementById("loading").remove(true) //加载完成,移除Loading
-        if (document.getElementById("loading_a1") != null) document.getElementById("loading_a1").remove(true)
+        setTimeout(function(){
+             if (document.getElementById("loading") != null) document.getElementById("loading").remove(true) //加载完成,移除Loading
+            if (document.getElementById("loading_a1") != null) document.getElementById("loading_a1").remove(true)           
+        },4000);
+
         //调整视角,使其达到最佳初始效果
         backMasterView();
         //player.Native.Camera.moveToItem(lastPtr,1);
@@ -3019,6 +3074,15 @@
                         case "IN02":
                             loadIn02Model(Native);
                             break;
+                        case "IN03":
+                            loadIn03Model(Native);
+                            break;
+                        case "IN04":
+                            loadIn04Model(Native);
+                            break;
+                        case "IN05":
+                            loadIn05Model(Native);
+                            break;
                         default:
                             break;
                     }