From 36e9c278ed5da5f4dd868657019542abe21c244e Mon Sep 17 00:00:00 2001
From: lzhe <lzhe@example.com>
Date: 星期一, 17 六月 2024 14:28:16 +0800
Subject: [PATCH] 1
---
src/views/mdc/realtime-status/index.vue | 55 +++++++++++++++++++++++++++++++++++++------------------
1 files changed, 37 insertions(+), 18 deletions(-)
diff --git a/src/views/mdc/realtime-status/index.vue b/src/views/mdc/realtime-status/index.vue
index ec686cb..85a8c3e 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: Sneed
- * @LastEditTime: 2024-04-09 22:12:14
+ * @LastEditors: lzhe lzhe@example.com
+ * @LastEditTime: 2024-06-17 14:27:14
* @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/mdc/realtime-status/index.vue
瀹炴椂鐪嬫澘
-->
@@ -36,7 +36,7 @@
<div class="status-next" @click="next">
<el-icon><ArrowRight /></el-icon>
</div>
- <div class="status-content-cardp" v-for="item in timestatus" style="width: 33.3333%; height: 50%;">
+ <div class="status-content-cardp" v-for="item 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">
@@ -104,22 +104,37 @@
stationlabel: "",
stationlabelList: [],
current: "1",
+ size: "9",
total: 0,
deviceStatus: [],
- workStationGroupIdList: []
+ workStationGroupIdList: [],
+ line: "",
+ column: ""
}
},
mounted() {
- this.getdevicestatus(); //鑾峰彇椤堕儴title
this.getstationlabelList(); //鑾峰彇鏍囩瑙嗗浘涓嬬殑list
this.setIntervalTime(); //鍗佺澧炲姞鏃堕棿
+ this.getSetting(); //璁剧疆鍑犺鍑犲垪
},
methods: {
+ getSetting() {
+ this.$HTTP.get(`/api/blade-system/param/detail?paramKey=mdc.realtime.setting`).then(res=> {
+ if(res.code == 200) {
+ var paramValue = JSON.parse(res.data.paramValue);
+ this.line = paramValue.line==0?1:paramValue.line;
+ this.column = paramValue.column;
+ this.current = "1";
+ this.size = this.line * this.column;
+ this.getdevicestatus(); //鑾峰彇椤堕儴title/鍏蜂綋鏁版嵁
+ }
+ })
+ },
setIntervalTime() {
function addTime(timeStr) {
var increaseByMilliseconds = 10 * 1000; // 10绉掕浆鎹负姣
// 瑙f瀽鏃堕棿瀛楃涓蹭负澶╂暟銆佸皬鏃躲�佸垎閽熷拰绉�
- if(timeStr != undefined) {
+ if(timeStr != undefined || timeStr != "--") {
var parts = timeStr.match(/(\d+)澶�(\d+)鏃�(\d+)鍒�(\d+)绉�/);
var days = parseInt(parts[1], 10) * 24 * 60 * 60 * 1000; // 澶╂暟杞崲涓烘绉�
var hours = parseInt(parts[2], 10) * 60 * 60 * 1000; // 灏忔椂杞崲涓烘绉�
@@ -205,9 +220,10 @@
this.gettimestatus();
},
next() {
- if((this.total/9 - this.current) < 0) return;
- this.current = Number(this.current) + 1;
- this.gettimestatus();
+ if((this.current * this.line) < this.total/this.column) {
+ this.current = Number(this.current) + 1;
+ this.gettimestatus();
+ }
},
goSet() {
this.$router.push('/mdc/configuration');
@@ -246,7 +262,7 @@
workStationGroupIdList: this.workStationGroupIdList
}
this.timestatus = [];
- this.$HTTP.post(`/api/blade-cps/workstation/real-time-status?current=${this.current}&size=9`,obj).then(res=> {
+ this.$HTTP.post(`/api/blade-cps/workstation/real-time-status?current=${this.current}&size=${this.size}`,obj).then(res=> {
if(res.code == 200) {
var ids = [];
res.data.records.forEach(item=> {
@@ -264,7 +280,6 @@
})
})
}
-
})
this.total = res.data.total;
//鍙戦�亀ebsocket
@@ -311,13 +326,17 @@
}
}else {
if(item1.key == 'Alarm') { //鎶ヨ
- var v = JSON.parse(eventData.data[item1.key].v);
- item1.name = v.code;
- item1.code = v.msg;
- item1.color = "#370C0D";
+ if(eventData.data[item1.key]) {
+ var v = JSON.parse(eventData.data[item1.key].v);
+ item1.name = v.code;
+ item1.code = v.msg;
+ item1.color = "#370C0D";
+ }
}else {
- item1.code = eventData.data[item1.key].v;
- item1.color = "#75C0C0";
+ if(eventData.data[item1.key]) {
+ item1.code = eventData.data[item1.key].v;
+ item1.color = "#75C0C0";
+ }
}
}
})
@@ -422,7 +441,7 @@
display: block;
}
.status-content-cardp {
- min-width: 266px;
+ height: 50%;
min-height: 170px;
margin: 0;
padding: 4px;
--
Gitblit v1.9.3