From 664d9030efca22edd8e43b4db4b2c0700fff44af Mon Sep 17 00:00:00 2001
From: Junjie <DELL@qq.com>
Date: 星期三, 14 一月 2026 09:18:33 +0800
Subject: [PATCH] #

---
 src/main/webapp/components/DevpCard.js |  136 +++++++++++++++++++++++++++++++++------------
 1 files changed, 100 insertions(+), 36 deletions(-)

diff --git a/src/main/webapp/components/DevpCard.js b/src/main/webapp/components/DevpCard.js
index 778b637..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>
@@ -17,8 +17,9 @@
                 <div style="margin-bottom: 10px;"><el-button @click="controlCommand()" size="mini">涓嬪彂</el-button></div>
             </div>
         </div>
-        <el-collapse v-model="activeNames">
-          <el-collapse-item v-for="(item) in stationList" :name="item.stationId">
+        <div style="max-height: 55vh; overflow:auto;">
+          <el-collapse v-model="activeNames" accordion>
+            <el-collapse-item v-for="(item) in displayStationList" :name="item.stationId">
             <template slot="title">
                 <div style="width: 100%;display: flex;">
                    <div style="width: 50%;">{{ item.stationId }}绔�</div>
@@ -38,37 +39,86 @@
                 <el-descriptions-item label="鍙嚭">{{ item.outEnable ? 'Y' : 'N' }}</el-descriptions-item>
                 <el-descriptions-item label="绌烘澘淇″彿">{{ item.emptyMk ? 'Y' : 'N' }}</el-descriptions-item>
                 <el-descriptions-item label="婊℃澘淇″彿">{{ item.fullPlt ? 'Y' : 'N' }}</el-descriptions-item>
+                <el-descriptions-item label="杩愯闃诲">{{ item.runBlock ? 'Y' : 'N' }}</el-descriptions-item>
+                <el-descriptions-item label="鍚姩鍏ュ簱">{{ item.enableIn ? 'Y' : 'N' }}</el-descriptions-item>
                 <el-descriptions-item label="鎵樼洏楂樺害">{{ item.palletHeight }}</el-descriptions-item>
                 <el-descriptions-item label="鏉$爜">{{ item.barcode }}</el-descriptions-item>
+                <el-descriptions-item label="閲嶉噺">{{ item.weight }}</el-descriptions-item>
                 <el-descriptions-item label="鏁呴殰浠g爜">{{ item.error }}</el-descriptions-item>
+                <el-descriptions-item label="鏁呴殰淇℃伅">{{ item.errorMsg }}</el-descriptions-item>
+                <el-descriptions-item label="鎵╁睍鏁版嵁">{{ item.extend }}</el-descriptions-item>
             </el-descriptions>
-          </el-collapse-item>
-        </el-collapse>
+            </el-collapse-item>                                                   
+          </el-collapse>
+        </div>
+        <div style="display:flex; justify-content:flex-end; margin-top:8px;">
+          <el-pagination
+            small
+            @current-change="handlePageChange"
+            @size-change="handleSizeChange"
+            :current-page="currentPage"
+            :page-size="pageSize"
+            :page-sizes="[10,20,50,100]"
+            layout="total, prev, pager, next"
+            :total="stationList.length">
+          </el-pagination>
+        </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: true,
+      showControl: false,
       controlParam: {
         stationId: "",
         taskNo: "",
         targetStationId: "",
       },
+      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() {
+      const start = (this.currentPage - 1) * this.pageSize;
+      const end = start + this.pageSize;
+      return this.stationList.slice(start, end);
+    }
   },
   watch: {
     param: {
       handler(newVal, oldVal) {
-        if (newVal.stationId != 0) {
+        if (newVal && newVal.stationId && newVal.stationId != 0) {
           this.activeNames = newVal.stationId;
           this.searchStationId = newVal.stationId;
         }
@@ -78,33 +128,47 @@
     },
   },
   methods: {
+    handlePageChange(page) {
+      this.currentPage = page;
+    },
+    handleSizeChange(size) {
+      this.pageSize = size;
+      this.currentPage = 1;
+    },
     getDevpStateInfo() {
-      let that = this;
-      $.ajax({
-        url: baseUrl + "/console/latest/data/station",
-        headers: {
-          token: localStorage.getItem("token"),
-        },
-        method: "post",
-        success: (res) => {
-          // 鍫嗗灈鏈轰俊鎭〃鑾峰彇
-          if (res.code == 200) {
-            let list = res.data;
-
-            if (that.searchStationId == "") {
-              that.stationList = list;
-            } else {
-              let tmp = [];
-              list.forEach((item) => {
-                if (item.stationId == that.searchStationId) {
-                  tmp.push(item);
-                }
-              });
-              that.stationList = tmp;
-            }
+      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": {}
+        }));
+      }
+    },
+    setStationList(res) {
+      let that = this;
+      if (res.code == 200) {
+        let list = res.data;
+        that.fullStationList = list;
+        if (that.searchStationId == "") {
+          that.stationList = list;
+        } else {
+          let tmp = [];
+          list.forEach((item) => {
+            if (item.stationId == that.searchStationId) {
+              tmp.push(item);
+            }
+          });
+          that.stationList = tmp;
+          that.currentPage = 1;
+        }
+      }
     },
     openControl() {
       this.showControl = !this.showControl;

--
Gitblit v1.9.1