Browse Source

优化告警显示

liling 3 months ago
parent
commit
1b0ebf0e9a
1 changed files with 30 additions and 15 deletions
  1. 30 15
      main.html

+ 30 - 15
main.html

@@ -7,6 +7,7 @@
     <link rel="stylesheet" type="text/css" href="css/jquery-ui.css">
 </head>
 <body onclick="clearEle()">
+    <input type="color" id="colorPicker" style="position: absolute;z-index: 100000;display: none;">
 <div id="loading_a1"></div>
 <div id="loading">正在加载模型中...</div>
 <div for="FAC" id="top" class="top topfac">
@@ -1555,8 +1556,9 @@
             this.AlarmData = data;
             var t = $("#dev_alarm_list>tbody").html("")
             if (data == null || data.length == 0) {
-                $("#dev_alarm .content").hide();
-                $("#dev_alarm .title").html("当前无告警");
+                //$("#dev_alarm .content").hide();
+                $("#dev_alarm .title").html("");
+                t.html('<tr style="font-weight:bold"><td style="width: 100%;text-align:center;color:#f0f377;" colspan=2>当前无告警</td></tr>');
                 for (var devcode in modelsMap) {
                     this.LastAlarmDevs[devcode] = null;
                     if (this.PanAlarm[devcode] == null) {
@@ -2392,6 +2394,24 @@
         isRTL: false
     };
     $(document).ready(function () {
+        async function setItemColor(item,c){
+                var item = await  player.Native.ModelTree.findItemByName("Object022",0,true,1)
+                player.Native.ModelTree.setItemColor(item.item,c.replace("#","0x")*1);
+        }
+        document.getElementById("colorPicker").addEventListener('input', function() {
+          // 获取选中的颜色
+          var selectedColor = colorPicker.value;
+            // 转换颜色为16进制格式
+          selectedColor = selectedColor.toString(16);
+          // 补充6个字符,确保有完整的16进制数
+          while (selectedColor.length < 6) {
+            selectedColor = '0' + selectedColor;
+          }
+          // 可以在这里使用选中的颜色,例如更新页面背景色
+          //document.body.style.backgroundColor = selectedColor;
+          console.log(selectedColor)
+          setItemColor("",selectedColor);         
+        });
         $(window).on('wheel', function(event) {
             // 检查 event.originalEvent.deltaY 来判断滚动方向
             /*
@@ -2668,7 +2688,7 @@
             var s2 = $("#datepicker2").val()
             //var devcode = $.trim($("#imp_devcode").val())
             var itemcode = $("#date_select").attr("itemcode");
-            if (s1 == "" || (s2 == ""&&itemcode!=4&&itemcode!=10&&itemcode!=11&&itemcode!=12&&itemcode!=13)) return;
+            if (s1 == "" || (s2 == ""&&itemcode!=4&&itemcode!=10&&itemcode!=11)) return;
             switch (parseInt(itemcode)) {
                 case 1:
                     window.open(SERVER_URL + "/export/production?start="+s1+"&end="+s2);
@@ -3074,7 +3094,7 @@
     var markerLClickObj=null; //当前点击的标记对象
     var FacStockData = null;//全厂库存统计数据
     var StockTypeName={"pt":"盘头","ycl":"原材料","bpb":"白坯布","cp":"成品"};
-    var StockTypeUnit={"pt":"个","ycl":"KG","bpb":"KG","cp":"KG"};
+    var StockTypeUnit={"pt":"个","ycl":"KG","bpb":"KG","cp":""};
     //2.[可选]监听连接成功消息
     player.on("Connected", () => {
         console.log("Has connected to engine")
@@ -3097,15 +3117,10 @@
 
     //5. [推荐] 响应UserTimeOut消息,引擎接收用户鼠标触屏事件超时发出通知
     player.on("UserTimeOut", () => {
-        console.info('用户长时间没有操作三维视图,会话即将退出,可调用player.resetTimer()取消退出');
+        console.info(`用户长时间没有操作三维视图,会话即将退出,可调用player.resetTimer()取消退出`);
         if (!AutoPlayer && currentTargetType=='IN02') $("#autoplayer_btn").trigger('click') //开启自动漫游
     });
-    player.on('TimeOutExit',()=>{
-        console.info('长时间没有操作,已断开连接');
-    });
     async function showMarker(type){
-        console.log(type)
-        console.log(MarkerMapFac)
         for (var t in MarkerMapFac) {
             if(t==type){
                 for (var markPtr in MarkerMapFac[t]) {
@@ -3129,7 +3144,7 @@
         var activeImg = $(".bottom img.active");
         activeImg.attr({'src':activeImg.attr('src').replace('_active',''),'class':''});
         $(".bottom img[t='"+currentTargetType+"']").attr({'src':'image/fac_btn_active.png','class':'active'});
-
+        
         $("body>div.hideDiv[for='FAC']").show();
         $("body>div.hideDiv[for!='FAC']").hide();
         await player.Native.Model.setModelVisible("IN02",false);
@@ -3252,7 +3267,7 @@
         var activeImg = $(".bottom img.active");
         activeImg.attr({'src':activeImg.attr('src').replace('_active',''),'class':''});
         $(".bottom img[t='"+currentTargetType+"']").attr({'src':'image/in05_btn_active.png','class':'active'});
-
+        
          await player.Native.Model.setModelVisible("FAC",false);
         await player.Native.Model.setModelVisible("IN02",false);
         await player.Native.Model.setModelVisible("IN03",false);
@@ -3280,7 +3295,7 @@
         var activeImg = $(".bottom img.active");
         activeImg.attr({'src':activeImg.attr('src').replace('_active',''),'class':''});
         $(".bottom img[t='"+currentTargetType+"']").attr({'src':'image/in04_btn_active.png','class':'active'});
-
+        
         await player.Native.Model.setModelVisible("FAC",false);
         await player.Native.Model.setModelVisible("IN02",false);
         await player.Native.Model.setModelVisible("IN03",false);
@@ -3309,7 +3324,7 @@
         var activeImg = $(".bottom img.active");
         activeImg.attr({'src':activeImg.attr('src').replace('_active',''),'class':''});
         $(".bottom img[t='"+currentTargetType+"']").attr({'src':'image/in03_btn_active.png','class':'active'});
-
+        
         await player.Native.Model.setModelVisible("FAC",false);
         await player.Native.Model.setModelVisible("IN02",false);
         await player.Native.Model.setModelVisible("IN04",false);
@@ -3338,7 +3353,7 @@
         var activeImg = $(".bottom img.active");
         activeImg.attr({'src':activeImg.attr('src').replace('_active',''),'class':''});
         $(".bottom img[t='"+currentTargetType+"']").attr({'src':'image/in02_btn_active.png','class':'active'});
-
+        
         await player.Native.Model.setModelVisible("FAC",false);
         await player.Native.Model.setModelVisible("IN03",false);
         await player.Native.Model.setModelVisible("IN04",false);