From 2af27d3865d6075ae8a22190485e76c97ca8ef9c Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期三, 19 六月 2024 12:31:20 +0800
Subject: [PATCH] 1
---
src/views/mdc/realtime-status/index.vue | 113 ++++++++++++++++++++++----------------------------------
1 files changed, 45 insertions(+), 68 deletions(-)
diff --git a/src/views/mdc/realtime-status/index.vue b/src/views/mdc/realtime-status/index.vue
index 797eef6..ff0f969 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-19 11:44:55
+ * @LastEditTime: 2024-06-19 12:29:46
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/realtime-status/index.vue
瀹炴椂鐪嬫澘
-->
@@ -115,9 +115,7 @@
mounted() {
this.getstationlabelList(); //鑾峰彇鏍囩瑙嗗浘涓嬬殑list
this.setIntervalTime(); //鍗佺澧炲姞鏃堕棿
- this.getSetting(); //璁剧疆鍑犺鍑犲垪 ==銆嬭幏鍙栭《閮╰itle
- //this.getprocess(); //鑾峰彇棰滆壊锛岃幏鍙栨満鍣�
- this.gettimestatus(); //ws
+ this.getprocess(); //鑾峰彇棰滆壊==銆嬭幏鍙栭《閮╰itle==銆嬭缃嚑琛屽嚑鍒�==銆媤s
},
methods: {
getSetting() {
@@ -128,7 +126,7 @@
this.column = paramValue.column;
this.current = "1";
this.size = this.line * this.column;
- this.getdevicestatus(); //鑾峰彇椤堕儴title/鍏蜂綋鏁版嵁
+ this.gettimestatus(); //ws
}
})
},
@@ -234,9 +232,11 @@
this.$router.push('/mdc/station-live?code='+item.id);
},
getprocess() { //棰滆壊鐘舵��
- this.$HTTP.get(`/api/blade-cps/global_wcs/wcs-achievements`).then(res=> {
+ this.$HTTP.get(`/api/blade-cps/global_wcs/list?code=&name=`).then(res=> {
if(res.code == 200) {
this.allwcs = res.data;
+ this.getdevicestatus(); //鑾峰彇椤堕儴title/鍏蜂綋鏁版嵁
+ this.getSetting(); //鑾峰彇鍑犺鍑犲垪
}
})
},
@@ -265,42 +265,26 @@
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 = [];
+ console.log(this.allwcs,res.data)
res.data.records.forEach(item=> {
- item.statusName = "鏈煡";
- item.statusStyle = '#ccc';
ids.push(item.id);
- if(item.properties != null) {
+ if(item.properties != null && item.properties.length!=0) {
item.properties.forEach(item1=> {
- 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";
+ if(item1.key == "DeviceStatus") {
+ this.allwcs.forEach(item2=> {
+ if(item2.code == item1.value) {
+ item1.color = item2.color;
+ }
+ })
}
})
+ }else {
+ item.statusName = "鏈煡";
+ item.statusStyle = '#ccc';
}
})
+ this.timestatus = res.data.records;
this.total = res.data.total;
//鍙戦�亀ebsocket
var obj = {
@@ -332,26 +316,12 @@
var time = moment(eventData.data.DeviceStatus.t).format('YYYY-MM-DD HH:mm:ss');
var diffTime = that.changeTime(time); //杞崲鎴愬樊鍊硷紙鏃跺垎绉掞級
item.time = diffTime;
- if(eventData.data.DeviceStatus.v == 1) {
- item.statusName = '鎶ヨ';
- item.statusStyle = "#370C0D";
- }
- if(eventData.data.DeviceStatus.v == 2) {
- item.statusName = '杩愯';
- item.statusStyle = "#73D13D";
- }
- if(eventData.data.DeviceStatus.v == 3) {
- item.statusName = "寰呮満";
- item.statusStyle = "#FFC53D";
- }
- if(eventData.data.DeviceStatus.v == 4) {
- item.statusName = "绂荤嚎";
- item.statusStyle = "#595959";
- }
- if(eventData.data.DeviceStatus.v == 5) {
- item.statusName = "璋冭瘯";
- item.statusStyle = "#40A9FF";
- }
+ that.allwcs.forEach(item1=> {
+ if(item1.code == eventData.data.DeviceStatus.v) {
+ item.statusName = item1.name;
+ item.statusStyle = item1.color;
+ }
+ })
}else{
if(item.time == undefined || item.time == "--") {
var diffTime = "--";
@@ -361,8 +331,12 @@
item.properties.forEach((item1,index1)=> {
if(item1.key == "DeviceStatus") { //鏈哄櫒鐘舵��
if(item1.value == "2") {
- item1.color = "#73D13D";
- item1.code = "杩愯";
+ that.allwcs.forEach(item2=> {
+ if(item2.code == item1.value) {
+ item1.color = item2.color;
+ item1.code = item2.name;
+ }
+ })
}else {
item1.color = "#75C0C0";
}
@@ -376,12 +350,20 @@
}else {
item1.name = v[0].code;
item1.code = v[0].msg;
- item1.color = "#370C0D";
+ that.allwcs.forEach(item2=> {
+ if(item2.name == "鎶ヨ") {
+ item1.color = item2.color;
+ }
+ })
}
}else {
item1.name = v.code;
item1.code = v.msg;
- item1.color = "#370C0D";
+ that.allwcs.forEach(item2=> {
+ if(item2.name == "鎶ヨ") {
+ item1.color = item2.color;
+ }
+ })
}
}
}else {
@@ -410,17 +392,12 @@
if(res.code == 200) {
res.data.forEach(item=> {
item.active = false;
+ this.allwcs.forEach(item1=> {
+ if(item.status == item1.code) {
+ item.color = item1.color;
+ }
+ })
})
- 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";
- res.data[0].icon = "Position";
- res.data[1].icon = "Loading";
- res.data[2].icon = "Clock";
- res.data[3].icon = "Warning";
- res.data[4].icon = "Odometer";
this.devicestatus = res.data;
}
})
--
Gitblit v1.9.3