1
lzhe
2024-06-18 345708c092a7c7daafe2da9a2181c92d689d8fc0
1
已修改1个文件
50 ■■■■ 文件已修改
src/views/mdc/realtime-status/index.vue 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mdc/realtime-status/index.vue
@@ -1,7 +1,7 @@
<!--
 * @Date: 2024-04-09 22:11:21
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-06-18 16:45:04
 * @LastEditTime: 2024-06-18 18:14:08
 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/realtime-status/index.vue
 实时看板
-->
@@ -115,7 +115,9 @@
        mounted() {
            this.getstationlabelList();  //获取标签视图下的list
            this.setIntervalTime();   //十秒增加时间
            this.getSetting(); //设置几行几列 ==》获取顶部title=》获取颜色,获取机器=》ws
            this.getSetting(); //设置几行几列 ==》获取顶部title
            //this.getprocess(); //获取颜色,获取机器
            this.gettimestatus();  //ws
        },
        methods: {
            getSetting() {
@@ -235,7 +237,6 @@
                this.$HTTP.get(`/api/blade-cps/global_wcs/wcs-achievements`).then(res=> {
                    if(res.code == 200) {
                        this.allwcs = res.data;
                        this.gettimestatus();
                    }
                })
            },
@@ -272,13 +273,38 @@
                            ids.push(item.id);
                            if(item.properties != null) {
                                item.properties.forEach(item1=> {
                                    this.devicestatus.forEach(item2=> {
                                        if(item2.status == item1.value) {
                                            item.statusName = item2.statusName;
                                            item1.statusName = item2.statusName;
                                            item.statusStyle = item2.color;
                                    // this.devicestatus.forEach(item2=> {
                                    //     if(item2.status == item1.value) {
                                    //         item.statusName = item2.statusName;
                                    //         item1.statusName = item2.statusName;
                                    //         item.statusStyle = item2.color;
                                    //     }
                                    // })
                                    if(item1.value == 1) {
                                        item.statusName = '报警';
                                        item1.statusName = '报警';
                                        item.statusStyle = "#370C0D";
                                        }
                                    })
                                    if(item1.value == 2) {
                                        item.statusName = '运行';
                                        item1.statusName = '运行';
                                        item.statusStyle = "#73D13D";
                                    }
                                    if(item1.value == 3) {
                                        item.statusName = "待机";
                                        item1.statusName = "待机";
                                        item.statusStyle = "#FFC53D";
                                    }
                                    if(item1.value == 4) {
                                        item.statusName = "离线";
                                        item1.statusName = "离线";
                                        item.statusStyle = "#595959";
                                    }
                                    if(item1.value == 5) {
                                        item.statusName = "调试";
                                        item1.statusName = "调试";
                                        item.statusStyle = "#40A9FF";
                                    }
                                })
                            }
                        })
@@ -302,7 +328,6 @@
                        this.$TOOL.socket.websocket.onmessage = function(event) { 
                            num ++;
                            var eventData = JSON.parse(event.data);
                            console.log(eventData,1234)
                            if(eventData.data.DeviceStatus != undefined) {
                                var time = moment(eventData.data.DeviceStatus.t).format('YYYY-MM-DD HH:mm:ss');
                                var diffTime = that.changeTime(time);  //转换成差值(时分秒)
@@ -371,8 +396,8 @@
                        res.data.forEach(item=> {
                            item.active = false;
                        })
                        res.data[0].color = "#73D13D";
                        res.data[1].color = "#370C0D";
                        res.data[0].color = "#370C0D";
                        res.data[1].color = "#73D13D";
                        res.data[2].color = "#FFC53D";
                        res.data[3].color = "#595959";
                        res.data[4].color = "#40A9FF";
@@ -382,7 +407,6 @@
                        res.data[3].icon = "Warning";
                        res.data[4].icon = "Odometer";
                        this.devicestatus = res.data;
                        this.getprocess(); //获取颜色,获取机器
                    }
                })
            }