#
Junjie
5 天以前 7451d4b759a30830514f8f398268d5694dcb1dde
src/main/webapp/components/WatchRgvCard.js
@@ -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 }}号RGV</div>
@@ -45,8 +46,20 @@
                <el-descriptions-item label="故障代码">{{ item.warnCode }}</el-descriptions-item>
                <el-descriptions-item label="故障描述">{{ item.alarm }}</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"],
@@ -55,12 +68,14 @@
      rgvList: [],
      activeNames: "",
      searchRgvNo: "",
      showControl: true,
      showControl: false,
      controlParam: {
        rgvNo: "",
        sourcePos: "",
        targetPos: ""
      }
      },
      pageSize: 25,
      currentPage: 1,
    };
  },
  created() {
@@ -68,11 +83,20 @@
      this.getRgvStateInfo();
    }, 1000);
  },
  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) {
          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,6 +104,13 @@
    },
  },
  methods: {
    handlePageChange(page) {
      this.currentPage = page;
    },
    handleSizeChange(size) {
      this.pageSize = size;
      this.currentPage = 1;
    },
    getRgvStateInfo() {
      let that = this;
      $.ajax({
@@ -101,6 +132,7 @@
                }
              });
              that.rgvList = tmp;
              that.currentPage = 1;
            }
          }
        },
@@ -185,4 +217,4 @@
      });
    },
  },
});
});