From 179136b6d89e4d24c37fc3981848f62b5673495c Mon Sep 17 00:00:00 2001 From: gaoshp <291585735@qq.com> Date: 星期二, 18 六月 2024 23:17:28 +0800 Subject: [PATCH] 默认2 --- src/views/mdc/realtime-status/index.vue | 70 ++++++++++++++++++++++++----------- 1 files changed, 48 insertions(+), 22 deletions(-) diff --git a/src/views/mdc/realtime-status/index.vue b/src/views/mdc/realtime-status/index.vue index 12c1fd1..a13892a 100644 --- a/src/views/mdc/realtime-status/index.vue +++ b/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-17 17:26:45 + * @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(); //璁剧疆鍑犺鍑犲垪 + this.getSetting(); //璁剧疆鍑犺鍑犲垪 ==銆嬭幏鍙栭《閮╰itle + //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(); } }) }, @@ -264,6 +265,7 @@ this.timestatus = []; this.$HTTP.post(`/api/blade-cps/workstation/real-time-status?current=${this.current}&size=${this.size}`,obj).then(res=> { if(res.code == 200) { + this.timestatus = res.data.records; var ids = []; res.data.records.forEach(item=> { item.statusName = "鏈煡"; @@ -271,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"; + } }) } }) @@ -307,8 +334,8 @@ }else { var diffTime = "--"; } - if(res.data.records.length == 0) return; //娌″�间笉鐢ㄥ惊鐜� - res.data.records.forEach((item,index)=> { //绗竴姝ユ妸v鏀惧埌code閲� + if(that.timestatus.length == 0) return; //娌″�间笉鐢ㄥ惊鐜� + that.timestatus.forEach((item,index)=> { //绗竴姝ユ妸v鏀惧埌code閲� if(eventData.id == item.id) { if(item.properties == null) { item.properties = []; @@ -353,13 +380,13 @@ } }); }; - var len = res.data.records.length; - intervalId = setInterval(function() { - if (num === len) { - clearInterval(intervalId); - that.timestatus = res.data.records; //绛夋墍鏈塻ocket鍥炴潵浠ュ悗璧嬪�� - } - }, 500); + // var len = res.data.records.length; + // intervalId = setInterval(function() { + // if (num === len) { + // clearInterval(intervalId); + // that.timestatus = res.data.records; //绛夋墍鏈塻ocket鍥炴潵浠ュ悗璧嬪�� + // } + // }, 500); } }) }, @@ -369,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"; @@ -380,7 +407,6 @@ res.data[3].icon = "Warning"; res.data[4].icon = "Odometer"; this.devicestatus = res.data; - this.getprocess(); //鑾峰彇棰滆壊锛岃幏鍙栨満鍣� } }) } -- Gitblit v1.9.3