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/WatchRgvCard.js |  123 +++++++++++++++++++++++++++++-----------
 1 files changed, 88 insertions(+), 35 deletions(-)

diff --git a/src/main/webapp/components/WatchRgvCard.js b/src/main/webapp/components/WatchRgvCard.js
index 18e6ba5..86cf8ee 100644
--- a/src/main/webapp/components/WatchRgvCard.js
+++ b/src/main/webapp/components/WatchRgvCard.js
@@ -8,7 +8,7 @@
               <el-button @click="getRgvStateInfo" 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>
@@ -22,8 +22,9 @@
                 <div style="margin-bottom: 10px;"><el-button @click="controlCommandTaskComplete()" size="mini">浠诲姟瀹屾垚</el-button></div>
             </div>
         </div>
-        <el-collapse v-model="activeNames">
-          <el-collapse-item v-for="(item) in rgvList" :name="item.rgvNo">
+        <div style="max-height: 55vh; overflow:auto;">
+          <el-collapse v-model="activeNames" accordion>
+            <el-collapse-item v-for="(item) in displayRgvList" :name="item.rgvNo">
             <template slot="title">
                 <div style="width: 100%;display: flex;">
                    <div style="width: 50%;">{{ item.rgvNo }}鍙稲GV</div>
@@ -44,35 +45,80 @@
                 <el-descriptions-item label="鏄惁鏈夌墿">{{ item.loading }}</el-descriptions-item>
                 <el-descriptions-item label="鏁呴殰浠g爜">{{ item.warnCode }}</el-descriptions-item>
                 <el-descriptions-item label="鏁呴殰鎻忚堪">{{ item.alarm }}</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
+            @current-change="handlePageChange"
+            @size-change="handleSizeChange"
+            :current-page="currentPage"
+            :page-size="pageSize"
+            :page-sizes="[10,20,50,100]"
+            layout="total, prev, pager, next"
+            :total="rgvList.length">
+          </el-pagination>
+        </div>
     </div>
     `,
-  props: ["param"],
+  props: {
+    param: {
+      type: Object,
+      default: () => ({})
+    },
+    autoRefresh: {
+      type: Boolean,
+      default: true
+    },
+    readOnly: {
+      type: Boolean,
+      default: false
+    }
+  },
   data() {
     return {
       rgvList: [],
       activeNames: "",
       searchRgvNo: "",
-      showControl: true,
+      showControl: false,
       controlParam: {
         rgvNo: "",
         sourcePos: "",
         targetPos: ""
-      }
+      },
+      pageSize: 25,
+      currentPage: 1,
+      timer: null
     };
   },
   created() {
-    setInterval(() => {
-      this.getRgvStateInfo();
-    }, 1000);
+    if (this.autoRefresh) {
+      this.timer = setInterval(() => {
+        this.getRgvStateInfo();
+      }, 1000);
+    }
+  },
+  beforeDestroy() {
+    if (this.timer) {
+      clearInterval(this.timer);
+    }
+  },
+  computed: {
+    displayRgvList() {
+      const start = (this.currentPage - 1) * this.pageSize;
+      const end = start + this.pageSize;
+      return this.rgvList.slice(start, end);
+    }
   },
   watch: {
     param: {
       handler(newVal) {
-        if (newVal && newVal.rgvNo != 0) {
+        if (newVal && newVal.rgvNo && newVal.rgvNo != 0) {
           this.activeNames = newVal.rgvNo;
+          const idx = this.rgvList.findIndex(i => i.rgvNo == newVal.rgvNo);
+          if (idx >= 0) { this.currentPage = Math.floor(idx / this.pageSize) + 1; }
         }
       },
       deep: true,
@@ -80,31 +126,38 @@
     },
   },
   methods: {
+    handlePageChange(page) {
+      this.currentPage = page;
+    },
+    handleSizeChange(size) {
+      this.pageSize = size;
+      this.currentPage = 1;
+    },
     getRgvStateInfo() {
+      if (this.$root.sendWs) {
+        this.$root.sendWs(JSON.stringify({
+          "url": "/rgv/table/rgv/state",
+          "data": {}
+        }));
+      }
+    },
+    setRgvList(res) {
       let that = this;
-      $.ajax({
-        url: baseUrl + "/rgv/table/rgv/state",
-        headers: {
-          token: localStorage.getItem("token"),
-        },
-        method: "post",
-        success: (res) => {
-          if (res.code == 200) {
-            let list = res.data || [];
-            if (that.searchRgvNo == "") {
-              that.rgvList = list;
-            } else {
-              let tmp = [];
-              list.forEach((item) => {
-                if (item.rgvNo == that.searchRgvNo) {
-                  tmp.push(item);
-                }
-              });
-              that.rgvList = tmp;
+      if (res.code == 200) {
+        let list = res.data || [];
+        if (that.searchRgvNo == "") {
+          that.rgvList = list;
+        } else {
+          let tmp = [];
+          list.forEach((item) => {
+            if (item.rgvNo == that.searchRgvNo) {
+              tmp.push(item);
             }
-          }
-        },
-      });
+          });
+          that.rgvList = tmp;
+          that.currentPage = 1;
+        }
+      }
     },
     openControl() {
       this.showControl = !this.showControl;
@@ -185,4 +238,4 @@
       });
     },
   },
-});
\ No newline at end of file
+});

--
Gitblit v1.9.1