Junjie
2026-04-25 ee53cfaffb30751dbade9008d482269d62147917
src/main/webapp/components/WatchRgvCard.js
@@ -3,9 +3,9 @@
    <div class="mc-root">
      <div class="mc-toolbar">
        <div class="mc-title">RGV监控</div>
        <div v-if="!readOnly" class="mc-search">
        <div v-if="showSearch" class="mc-search">
          <input class="mc-input" v-model="searchRgvNo" placeholder="请输入RGV号" />
          <button type="button" class="mc-btn mc-btn-ghost" @click="getRgvStateInfo">查询</button>
          <button type="button" class="mc-btn mc-btn-ghost" @click="handleSearch">查询</button>
        </div>
      </div>
@@ -78,7 +78,8 @@
    param: { type: Object, default: function () { return {}; } },
    items: { type: Array, default: null },
    autoRefresh: { type: Boolean, default: true },
    readOnly: { type: Boolean, default: false }
    readOnly: { type: Boolean, default: false },
    showSearchInReadOnly: { type: Boolean, default: false }
  },
  data: function () {
    return {
@@ -97,6 +98,9 @@
    };
  },
  computed: {
    showSearch: function () {
      return !this.readOnly || this.showSearchInReadOnly;
    },
    sourceList: function () {
      return Array.isArray(this.items) ? this.items : this.rgvList;
    },
@@ -120,6 +124,9 @@
  watch: {
    items: function () {
      this.afterDataRefresh();
    },
    searchRgvNo: function () {
      this.applySearchFilter();
    },
    param: {
      deep: true,
@@ -159,10 +166,14 @@
    toggleItem: function (item) {
      var next = String(item.rgvNo);
      this.activeNames = this.activeNames === next ? "" : next;
      this.$emit('item-select', this.activeNames ? (item || null) : null);
    },
    focusRgv: function (rgvNo) {
      this.searchRgvNo = String(rgvNo);
      var index = this.filteredRgvList.findIndex(function (item) {
      if (!this.readOnly) {
        this.searchRgvNo = String(rgvNo);
      }
      var targetList = this.readOnly ? this.sourceList : this.filteredRgvList;
      var index = targetList.findIndex(function (item) {
        return String(item.rgvNo) === String(rgvNo);
      });
      this.currentPage = index >= 0 ? Math.floor(index / this.pageSize) + 1 : 1;
@@ -187,6 +198,17 @@
      }
      this.currentPage = page;
    },
    applySearchFilter: function () {
      this.currentPage = 1;
      this.afterDataRefresh();
    },
    handleSearch: function () {
      if (this.readOnly) {
        this.applySearchFilter();
        return;
      }
      this.getRgvStateInfo();
    },
    getRgvStateInfo: function () {
      if (this.$root && this.$root.sendWs) {
        this.$root.sendWs(JSON.stringify({