Junjie
2026-04-25 ee53cfaffb30751dbade9008d482269d62147917
src/main/webapp/components/DevpCard.js
@@ -5,9 +5,9 @@
    <div class="mc-root">
      <div class="mc-toolbar">
        <div class="mc-title">输送监控</div>
        <div v-if="!readOnly" class="mc-search">
        <div v-if="showSearch" class="mc-search">
          <input class="mc-input" v-model="searchStationId" placeholder="请输入站号" />
          <button type="button" class="mc-btn mc-btn-ghost" @click="getDevpStateInfo">查询</button>
          <button type="button" class="mc-btn mc-btn-ghost" @click="handleSearch">查询</button>
        </div>
      </div>
@@ -109,7 +109,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 {
@@ -131,6 +132,9 @@
    };
  },
  computed: {
    showSearch: function () {
      return !this.readOnly || this.showSearchInReadOnly;
    },
    sourceList: function () {
      return Array.isArray(this.items) ? this.items : this.stationList;
    },
@@ -154,6 +158,9 @@
  watch: {
    items: function () {
      this.afterDataRefresh();
    },
    searchStationId: function () {
      this.applySearchFilter();
    },
    param: {
      deep: true,
@@ -203,10 +210,14 @@
    toggleItem: function (item) {
      var next = String(item.stationId);
      this.activeNames = this.activeNames === next ? "" : next;
      this.$emit('item-select', this.activeNames ? (item || null) : null);
    },
    focusStation: function (stationId) {
      this.searchStationId = String(stationId);
      var index = this.filteredStationList.findIndex(function (item) {
      if (!this.readOnly) {
        this.searchStationId = String(stationId);
      }
      var targetList = this.readOnly ? this.sourceList : this.filteredStationList;
      var index = targetList.findIndex(function (item) {
        return String(item.stationId) === String(stationId);
      });
      this.currentPage = index >= 0 ? Math.floor(index / this.pageSize) + 1 : 1;
@@ -231,6 +242,17 @@
      }
      this.currentPage = page;
    },
    applySearchFilter: function () {
      this.currentPage = 1;
      this.afterDataRefresh();
    },
    handleSearch: function () {
      if (this.readOnly) {
        this.applySearchFilter();
        return;
      }
      this.getDevpStateInfo();
    },
    getDevpStateInfo: function () {
      if (this.$root && this.$root.sendWs) {
        this.$root.sendWs(JSON.stringify({