#
Junjie
2026-01-14 a502dc5a81d42a70e2ba2ad9e4cce97fea2b7669
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>
@@ -45,6 +45,7 @@
                <el-descriptions-item label="是否有物">{{ item.loading }}</el-descriptions-item>
                <el-descriptions-item label="故障代码">{{ 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>
@@ -62,7 +63,20 @@
        </div>
    </div>
    `,
  props: ["param"],
  props: {
    param: {
      type: Object,
      default: () => ({})
    },
    autoRefresh: {
      type: Boolean,
      default: true
    },
    readOnly: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      rgvList: [],
@@ -76,12 +90,20 @@
      },
      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() {
@@ -93,7 +115,7 @@
  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; }
@@ -112,31 +134,30 @@
      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;
              that.currentPage = 1;
      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;