From ce13e25ed685ba5c961832d023ceafecf4f30d47 Mon Sep 17 00:00:00 2001
From: Junjie <DELL@qq.com>
Date: 星期六, 10 一月 2026 15:27:33 +0800
Subject: [PATCH] #
---
src/main/webapp/components/DevpCard.js | 46 ++++++++++++++++++++++++++++++++++++++--------
1 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/src/main/webapp/components/DevpCard.js b/src/main/webapp/components/DevpCard.js
index 9a4fa5c..24308c3 100644
--- a/src/main/webapp/components/DevpCard.js
+++ b/src/main/webapp/components/DevpCard.js
@@ -5,7 +5,7 @@
<div style="width: 100%;">杈撻�佺洃鎺�</div>
<div style="width: 100%;text-align: right;display: flex;"><el-input size="mini" v-model="searchStationId" placeholder="璇疯緭鍏ョ珯鍙�"></el-input><el-button @click="getDevpStateInfo" size="mini">鏌ヨ</el-button></div>
</div>
- <div style="margin-bottom: 10px;">
+ <div style="margin-bottom: 10px;" v-if="!readOnly">
<div style="margin-bottom: 5px;">
<el-button v-if="showControl" @click="openControl" size="mini">鍏抽棴鎺у埗涓績</el-button>
<el-button v-else @click="openControl" size="mini">鎵撳紑鎺у埗涓績</el-button>
@@ -65,10 +65,24 @@
</div>
</div>
`,
- props: ["param"],
+ props: {
+ param: {
+ type: Object,
+ default: () => ({})
+ },
+ autoRefresh: {
+ type: Boolean,
+ default: true
+ },
+ readOnly: {
+ type: Boolean,
+ default: false
+ }
+ },
data() {
return {
stationList: [],
+ fullStationList: [],
activeNames: "",
searchStationId: "",
showControl: false,
@@ -79,12 +93,20 @@
},
pageSize: 25,
currentPage: 1,
+ timer: null
};
},
created() {
- setInterval(() => {
- this.getDevpStateInfo();
- }, 1000);
+ if (this.autoRefresh) {
+ this.timer = setInterval(() => {
+ this.getDevpStateInfo();
+ }, 1000);
+ }
+ },
+ beforeDestroy() {
+ if (this.timer) {
+ clearInterval(this.timer);
+ }
},
computed: {
displayStationList() {
@@ -96,7 +118,7 @@
watch: {
param: {
handler(newVal, oldVal) {
- if (newVal.stationId != 0) {
+ if (newVal && newVal.stationId && newVal.stationId != 0) {
this.activeNames = newVal.stationId;
this.searchStationId = newVal.stationId;
}
@@ -114,7 +136,15 @@
this.currentPage = 1;
},
getDevpStateInfo() {
- if (this.$root.sendWs) {
+ if (this.readOnly) {
+ // Frontend filtering for readOnly mode
+ if (this.searchStationId == "") {
+ this.stationList = this.fullStationList;
+ } else {
+ this.stationList = this.fullStationList.filter(item => item.stationId == this.searchStationId);
+ this.currentPage = 1;
+ }
+ } else if (this.$root.sendWs) {
this.$root.sendWs(JSON.stringify({
"url": "/console/latest/data/station",
"data": {}
@@ -125,7 +155,7 @@
let that = this;
if (res.code == 200) {
let list = res.data;
-
+ that.fullStationList = list;
if (that.searchStationId == "") {
that.stationList = list;
} else {
--
Gitblit v1.9.1