Jelajahi Sumber

添加板板v0.1

liling 1 bulan lalu
induk
melakukan
628be0da81
2 mengubah file dengan 120 tambahan dan 23 penghapusan
  1. 1 1
      src/pages/bpb/index.vue
  2. 119 22
      src/pages/components/In02.vue

+ 1 - 1
src/pages/bpb/index.vue

@@ -247,7 +247,7 @@
       append-to-body
       class="result-list-dialog"
       :top="'15vh'"
-      style="background: rgb(0 85 102 / 92%); border: 1px solid #008899; border-radius: 5px; height: 70vh;"
+      style="background: rgb(0 85 102 / 92%); border: 1px solid #008899; border-radius: 5px; height: 74vh;"
       :lock-scroll="false"
   >
     <template #header>

+ 119 - 22
src/pages/components/In02.vue

@@ -366,6 +366,7 @@ import { ref,onMounted,onUnmounted,watch } from 'vue';
 import * as echarts from 'echarts';
 import {useRouter} from 'vue-router';
 import api from "@/api/system";
+import impapi from "@/api/imp";
 import Imp01 from "../imp/imp01.vue"
 import Imp02 from "../imp/imp02.vue"
 import Imp03 from "../imp/imp03.vue"
@@ -380,6 +381,7 @@ import Imp13 from "../imp/imp13.vue"
 import Imp14 from "../imp/imp14.vue"
 import Imp15 from "../imp/imp15.vue"
 import NumberAnimation from './NumberAnimation.vue'
+
 export default {
     components:{
         Imp01,Imp02,Imp03,Imp04,Imp05,Imp06,Imp08,Imp10,Imp11,Imp12,Imp13,Imp14,Imp15,
@@ -436,6 +438,8 @@ export default {
         const dev_stop=ref(null);
         const dev_alarm = ref(null);
         const dev_alarm_list = ref(null);
+        const StopDevList=ref([]);
+        let DiffStatusDevList=ref({});
         let alarmDevList=ref([]);
         let devAlarmAutoLoadTimter=null;
         let Pan={};
@@ -445,6 +449,7 @@ export default {
         let dataTimer1=null;
         let dataTimer2=null;
         let dataTimer3=null;
+        let dataTimer4=null;
         let maogaoData=ref([]);
         let maogaoDetailData = ref([]);
         let maogaoDetailHeight=0;
@@ -660,7 +665,98 @@ export default {
                         }
                     }
                 })
-            }
+            },
+            GetStopDev:function(){ 
+                impapi.Get00Data().then(async (res)=>{     
+                    dataTimer4 = setTimeout(function () {
+                        //每60秒主动查询一次数据
+                        DataFull.GetStopDev();
+                    }, INDEX_TIMEOUT);               
+                    if(res.code!=0){
+                        return;
+                    }
+                    res.data.detail.map(item=>{ 
+                        DiffStatusDevList.value[item.device] = item;
+                    });
+                    if(StopDevList.value!=null && StopDevList.value.length>0){
+                        //找出状态有变化的设备
+                        for(var i=0;i<StopDevList.value.length;i++){
+                            var item = StopDevList.value[i];
+                            if(DiffStatusDevList.value[item.device]==null){
+                                continue;
+                            }
+                            if(item.status==DiffStatusDevList.value[item.device].status){
+                                delete DiffStatusDevList.value[item.device];
+                            }
+                        }
+                    }
+                    for(var k in DiffStatusDevList.value){                         
+                        let item = DiffStatusDevList.value[k];
+                        //状态=0的显示生产中  蓝色,其他停机显示红色
+                        let devIten=modelsMap["C_"+item.device]||modelsMap["D_"+item.device];
+                        if(devIten==null) continue
+                        if(player!=null && player.Native!=null)player.Native.GisMarker.destroy(devIten['markPtr']);
+                        let imgid = null;
+                        let options = null;
+                        console.log('设备状态变化:',item.device,"====",item.device*1%2)
+                        if(item.status=="0"){ 
+                            //正常生产态                            
+                            imgid = await player.Native.GisMarker.loadImage("data://icon/qietu/tip3.png");
+                            options = {
+                                "text": " "+ k + "#"+"\r\r     正常生产中",
+                                "visible": true,
+                                //"maxLod": 100,
+                                //"minLod": 2,
+                                "textFontSize": 16,
+                                "textAlign": "center",
+                                "contentPadding": [2,2,2,2],
+                                "nodeOffset": (item.device*1%2)==0 ? [-120,-340] : [-140,-160],
+                                "textColor": parseInt("0xffffffff")
+                            };      
+                            options.imgSize = [160, 80];                      
+                        }else{
+                            //停经 断纱 落卷 叫料 黄色
+                            if(item.status=="1"||item.status=="7"||item.status=="2"||item.status=="6"){ 
+                                imgid = await player.Native.GisMarker.loadImage("data://icon/qietu/tip_yellow.png");
+                                options = {
+                                    "text":" "+ k + "#"+"\r\r     "+item.remark,
+                                    "visible": true,
+                                    //"maxLod": 100,
+                                    //"minLod": 0.1,
+                                    "textFontSize": 16,
+                                    "contentPadding": [2,2,2,2],
+                                    "textAlign": "center",
+                                    "nodeOffset": (item.device*1%2)==0 ? [-120,-340] : [-140,-160],
+                                    "textColor": parseInt("0xffffffff")
+                                }; 
+                                options.imgSize = [160, 80];
+                            }else{
+                                imgid = await player.Native.GisMarker.loadImage("data://icon/qietu/tip_red.png");
+                                options = {
+                                    "text":" "+ k + "#"+"\r\r     "+item.remark,
+                                    "visible": true,
+                                    //"maxLod": 100,
+                                    //"minLod": 0.1,
+                                    "textFontSize": 16,
+                                    "contentPadding": [2,2,2,2],
+                                    "textAlign": "center",
+                                    "nodeOffset": (item.device*1%2)==0 ? [-120,-340] : [-140,-160],
+                                    "textColor": parseInt("0xffffffff")
+                                };
+                                options.imgSize = [160, 80];
+                            }
+                        }
+                        options.imgId = imgid                        
+                        options.pos = [devIten.xyz[0]+1, devIten.xyz[1]-3, 0]
+                        let markPtr = await player.Native.GisMarker.create(options);
+                        player.Native.GisMarker.update(markPtr, options);
+                        devIten['markPtr'] = markPtr;
+                    }
+                    StopDevList.value = res.data.detail;                     
+                }).catch(res=>{
+                    console.log("设备停机数据获取失败!",res);
+                });
+            },
         }
 
         function search() {
@@ -698,12 +794,12 @@ export default {
         async function init(){
             backMasterViewBy02();
             (async()=>{
-                            let marklst = await player.Native.GisMarker.getMarkerList();
-                            if(marklst!=null){
-                                for(var i=0;i<marklst.length;i++){
-                                    if(player!=null && player.Native!=null)player.Native.GisMarker.destroy(marklst[i].id)
-                                }
-                            }
+                let marklst = await player.Native.GisMarker.getMarkerList();
+                if(marklst!=null){
+                    for(var i=0;i<marklst.length;i++){
+                        if(player!=null && player.Native!=null)player.Native.GisMarker.destroy(marklst[i].id)
+                    }
+                }
             })();
             for (var i in ANIMATION_DATA) {
                 // 添加关键帧
@@ -734,20 +830,8 @@ export default {
                     //计算当前设备在世界坐标
                     var xyz = await player.Native.ModelTree.calcItemAabb(tmp.item)
                     var xyz2 = [(xyz.aabb.max[0] + xyz.aabb.min[0]) * 0.5, (xyz.aabb.max[1] + xyz.aabb.min[1]) * 0.5, (xyz.aabb.max[2] + xyz.aabb.min[2]) * 0.5];
-                        // 创建设备编号标记
-                        /*
-                        var options = {
-                            "text": devItems[i].name.replace("C_", "") + "#",
-                            "visible": true,
-                            "maxLod": 110,
-                            "minLod": 0.1,
-                            "textColor": parseInt("0xffffffff")
-                        };
-                        options.pos = [xyz2[0] - 1.5, xyz2[1] - 3, 0]
-                        var markPtr = await player.Native.GisMarker.create(options);
-                        player.Native.GisMarker.update(markPtr, options);
-                        */
                     modelsMap[tmp.name] = {item: tmp.item, xyz: xyz2, rowno: rowItems[row].name.substr(1)}
+                    //console.log(tmp.name)
                     //初始化设备状态颜色
                     ChangeModelAlarmState2(tmp.name);
                         //创建指示灯标记
@@ -771,9 +855,11 @@ export default {
             clearTimeout(dataTimer1);
             clearTimeout(dataTimer2);
             clearTimeout(dataTimer3);
+            clearTimeout(dataTimer4);
             DataFull.GetData();
             DataFull.GetAlarmData();
             DataFull.GetOnlineDev();
+            DataFull.GetStopDev();
             if (ALARM_DEVS.length > 0) {
                 for (var i = 0; i < ALARM_DEVS.length; i++) {
                     var s = ALARM_DEVS[i].split(">")
@@ -795,9 +881,16 @@ export default {
                 }
             }
             // player.Native.Camera.moveTo([-60.91624261330108, -39.68511717426356, 85.99570940739352], [-61.26059834308166, -0.225858934410347, -0.5930273740619612], [-0.007940809332449061, 0.9099266223396253, 0.41469324265623975], 1);
-            player.Native.Camera.moveTo([7.630977787770181, -19.831384507538644, 3.1479712959809714],
+            /*player.Native.Camera.moveTo([7.630977787770181, -19.831384507538644, 3.1479712959809714],
             [-18.374309539794922, -20.014415740966797, 0],
             [-0.1600317165278932, 0.0027650086325702416, 0.9871080003892169], 1);
+            */
+            //-18.330399532189816, -36.35682993987315, 20.472951979735864
+            //-18.374309539794922, -20.01441574096679, -7.105427357601002
+            //0.004097338015901916, 0.7815354812192895, 0.6238473398328448
+            player.Native.Camera.moveTo([-16.875883106106, -40.239128553583534, 25.62119307690701],
+            [-17.089787852639105, -19.014737178759784, -1.310617574676634],
+            [-0.002761719036738653, 0.7854016082664139, 0.6189803604642822], 1);
         }
         //更改指示灯状态.版本2:更改设备标号牌旁边的指示灯模型
         //绿灯为G 红灯为R 黄灯为Y
@@ -916,7 +1009,8 @@ export default {
                 if (cnt > 5) break //最多查找5层
                 if (ty == 'NODE') p = await player.Native.NodeProxy.getNodeParent(modelsId) //节点类型的node
                 else p = await player.Native.ModelTree.getItemInfo(modelsId)
-                if (p.name != null && (p.name.substr(0, 2) == "C_")||p.name.substr(0, 2) == "D_") {
+                console.log('p:',p)
+                if (p.name != null &&p.name!=null && (p.name.substr(0, 2) == "C_")||p.name.substr(0, 2) == "D_") {
                     devName = p.name
                     break
                 }
@@ -1875,9 +1969,11 @@ export default {
             clearTimeout(dataTimer1);
             clearTimeout(dataTimer2);
             clearTimeout(dataTimer3);
+            clearTimeout(dataTimer4);
             DataFull.GetData();
             DataFull.GetAlarmData();
             DataFull.GetOnlineDev();
+            DataFull.GetStopDev();
         })
         onUnmounted(()=>{
             AutoPlayer.value=false;
@@ -1947,6 +2043,7 @@ export default {
             search,
             switchIndex,
             toAdmin,
+            StopDevList,
         }
     }
 }