From 5caa25dc8f299cb5ef5cc056dfd6c307b6763934 Mon Sep 17 00:00:00 2001
From: gaoshp <291585735@qq.com>
Date: 星期二, 08 十月 2024 20:06:49 +0800
Subject: [PATCH] update
---
src/views/mdc/realtime-status/index.vue | 102 ++++++++++++++++++++++++++-------------------------
1 files changed, 52 insertions(+), 50 deletions(-)
diff --git a/src/views/mdc/realtime-status/index.vue b/src/views/mdc/realtime-status/index.vue
index 904247d..420a7a0 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: gaosp
- * @LastEditTime: 2024-09-04 22:11:55
+ * @LastEditors: lzhe lzhe@example.com
+ * @LastEditTime: 2024-10-08 17:50:00
* @FilePath: /mdc/Users/mache/Documents/demo/cps-web/src/views/mdc/realtime-status/index.vue
瀹炴椂鐪嬫澘
-->
@@ -44,7 +44,7 @@
<ArrowRight />
</el-icon>
</div>
- <div class="status-content-cardp" v-for="item in timestatus" :style="{ 'width': (100 / column) + '%' }">
+ <div class="status-content-cardp" v-for="(item,index) in timestatus" :style="{ 'width': (100 / column) + '%' }">
<div class="status-card-box" style="border-color: #ccc;">
<div class="status-card-top">
<div class="status-card-detail">
@@ -66,15 +66,11 @@
<div class="status-card-machine-mesg-label">宸ヤ綅缂栧彿</div>
<div class="status-card-machine-mesg-value">{{ item.code }}</div>
</div>
- <div class="status-card-machine-mesg-form">
- <div class="status-card-machine-mesg-label">宸ュ崟</div>
- <div class="status-card-machine-mesg-value">-</div>
- </div>
</div>
</div>
</div>
<div class="status-card-bottom">
- <div class="status-card-bottom-realtime" @click="showvisible(item)"><i
+ <div class="status-card-bottom-realtime" @click="showvisible(item,index)"><i
class="iconfont saber-xiangqing status-card-bottom-icon"></i> 瀹炴椂鏁版嵁</div>
<div class="status-card-bottom-detail" @click="gostatus(item)"><i
class="iconfont saber-shuju status-card-bottom-icon"></i> 宸ヤ綅璇︽儏</div>
@@ -84,7 +80,7 @@
</div>
<el-dialog :title="titleMap" v-model="visible" :width="740">
<div class="dialogstyle">
- <div class="realtime-analysis-card" v-for="item in visibleList">
+ <div class="realtime-analysis-card" v-for="item in timestatus[clickIndex].properties">
<div class="card-name" :style="{ 'background-color': item.color }">{{ item.name }}</div>
<div class="card-value"
:class="{ 'card-value': true, 'card-value-bg1': item.key != 'Alarm', 'card-value-bg2': item.key == 'Alarm' }">
@@ -108,6 +104,7 @@
},
data() {
return {
+ clickIndex: 0,
allwcs: [],
statusStyle: "#ccc",
titleMap: "",
@@ -127,8 +124,8 @@
}
},
mounted() {
+ this.deviceStatus = this.$route.query.currentTag?[...this.$route.query.currentTag]:[];
this.getstationlabelList(); //鑾峰彇鏍囩瑙嗗浘涓嬬殑list
- this.setIntervalTime(); //鍗佺澧炲姞鏃堕棿
this.getprocess(); //鑾峰彇棰滆壊==銆嬭幏鍙栭《閮╰itle==銆嬭缃嚑琛屽嚑鍒�==銆媤s
},
methods: {
@@ -193,11 +190,18 @@
this.$HTTP.get("/api/blade-cps/group/get-mdc-group").then(res => {
if (res.code == 200) {
this.stationlabelList = res.data;
- this.stationlabel = res.data[0].groupName;
+ if(res.data.length != 0) {
+ this.stationlabel = res.data[0].groupName;
+ }
}
})
},
changestatus(name) {
+ if(this.stationlabelList.length == 0) {
+ this.station = "鐘舵�佽鍥�";
+ //this.$message.error("涓嶈兘鐐瑰嚮");
+ return;
+ }
this.station = name;
if (this.station == '鐘舵�佽鍥�') {
this.workStationGroupIdList = [];
@@ -207,17 +211,19 @@
}
this.gettimestatus(); //鏌ヨ鍒楄〃
},
- showvisible(item) {
- if (item.properties == null || item.properties.length == 0) {
- this.$message({
- message: '璇烽厤缃噰闆嗛」',
- type: 'warning'
- });
- return;
- }
- var visibleList = JSON.parse(JSON.stringify(item.properties));
- this.titleMap = "瀹炴椂鏁版嵁(" + item.code + ")";
- this.visibleList = visibleList;
+ showvisible(item,index) {
+ //clickIndex
+ this.clickIndex = index;
+ // if (item.properties == null || item.properties.length == 0) {
+ // this.$message({
+ // message: '璇烽厤缃噰闆嗛」',
+ // type: 'warning'
+ // });
+ // return;
+ // }
+ // var visibleList = JSON.parse(JSON.stringify(item.properties));
+ // this.titleMap = "瀹炴椂鏁版嵁(" + item.code + ")";
+ // this.visibleList = visibleList;
this.visible = true;
},
searchstatus(item, index) {
@@ -240,7 +246,8 @@
}
},
goSet() {
- this.$router.push('/mdc/configuration');
+ //console.log(this.$TOOL.data.get("MENU"));name == "閰嶇疆涓績"
+ this.$router.push('/mdc/configuration'); //鍒嗘瀽璁剧疆
},
gostatus(item) {
this.$router.push('/mdc/station-live?code=' + item.id);
@@ -277,10 +284,9 @@
workStationGroupIdList: this.workStationGroupIdList
}
this.timestatus = [];
- this.$HTTP.post(`/api/blade-cps/workstation/real-time-status?current=${this.current || 0}&size=${this.size || 0}`, obj).then(res => {
+ this.$HTTP.post(`/api/blade-cps/workstation/real-time-status?current=${this.current || 0}&size=${this.size || 6}`, obj).then(res => {
if (res.code == 200) {
var ids = [];
- console.log(this.allwcs, res.data)
res.data.records.forEach(item => {
ids.push(item.id);
if (item.properties != null && item.properties.length != 0) {
@@ -314,11 +320,12 @@
that.$TOOL.socket.sendDataToWebSocket(obj); //鍙戦��
}
}, 500);
- var num = 0;
+ //var num = 0;
var intervalId;
this.$TOOL.socket.websocket.onmessage = function (event) {
- num++;
+ //num++;
var eventData = JSON.parse(event.data);
+ if(Object.keys(eventData.data).length == 0) return;
if (that.timestatus.length == 0) return; //娌″�间笉鐢ㄥ惊鐜�
that.timestatus.forEach((item, index) => { //绗竴姝ユ妸v鏀惧埌code閲�
if (eventData.id == item.id) {
@@ -329,6 +336,7 @@
if (eventData.data.DeviceStatus) {
var time = moment(eventData.data.DeviceStatus.t).format('YYYY-MM-DD HH:mm:ss');
var diffTime = that.changeTime(time); //杞崲鎴愬樊鍊硷紙鏃跺垎绉掞級
+ that.setIntervalTime(); //鍗佺澧炲姞鏃堕棿
item.time = diffTime;
that.allwcs.forEach(item1 => {
if (item1.code == eventData.data.DeviceStatus.v) {
@@ -344,16 +352,13 @@
}
item.properties.forEach((item1, index1) => {
if (item1.key == "DeviceStatus") { //鏈哄櫒鐘舵��
- if (item1.value == "2") {
- that.allwcs.forEach(item2 => {
- if (item2.code == item1.value) {
- item1.color = item2.color;
- item1.code = item2.name;
- }
- })
- } else {
- item1.color = "#75C0C0";
- }
+ that.allwcs.forEach(item2 => {
+ if (item2.code == eventData.data.DeviceStatus.v) {
+ item1.value = item2.code;
+ item1.color = item2.color;
+ item1.code = item2.name;
+ }
+ })
} else {
if (item1.key == 'Alarm') { //鎶ヨ
if (eventData.data[item1.key]) {
@@ -364,28 +369,22 @@
} else {
item1.name = v[0].code;
item1.code = v[0].msg;
- that.allwcs.forEach(item2 => {
- if (item2.name == "鎶ヨ") {
- item1.color = item2.color;
- }
- })
}
} else {
item1.name = v.code;
item1.code = v.msg;
- that.allwcs.forEach(item2 => {
- if (item2.name == "鎶ヨ") {
- item1.color = item2.color;
- }
- })
}
}
} else {
if (eventData.data[item1.key]) {
item1.code = eventData.data[item1.key].v;
- item1.color = "#75C0C0";
}
}
+ that.allwcs.forEach(item2 => {
+ if (item2.name == "鎶ヨ") {
+ item1.color = item2.color;
+ }
+ })
}
})
}
@@ -411,6 +410,9 @@
item.color = item1.color;
}
})
+ if (this.$route.query.currentTag == item.status) {
+ item.active = true;
+ }
})
res.data[0].icon = "Position";
res.data[1].icon = "Loading";
@@ -421,7 +423,7 @@
}
})
}
- }
+ },
}
</script>
@@ -530,7 +532,7 @@
font-weight: 700;
font-size: 16px;
color: #333;
- width: 33%;
+ width: 26%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
--
Gitblit v1.9.3