#
Junjie
5 天以前 e1e1a2d934f6bd630abb67784ba18d38f6bea28e
src/main/webapp/components/WatchCrnCard.js
@@ -7,7 +7,8 @@
        </div>
        <div style="margin-bottom: 10px;">
            <div style="margin-bottom: 5px;">
               <el-button @click="openControl" size="mini">控制中心</el-button>
               <el-button v-if="showControl" @click="openControl" size="mini">关闭控制中心</el-button>
               <el-button v-else @click="openControl" size="mini">打开控制中心</el-button>
            </div>
            <div v-if="showControl" style="display: flex;justify-content: space-between;flex-wrap: wrap;">
                <div style="margin-bottom: 10px;width: 33%;"><el-input size="mini" v-model="controlParam.crnNo" placeholder="堆垛机号"></el-input></div>
@@ -18,8 +19,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 crnList" :name="item.crnNo">
        <div style="max-height: 55vh; overflow:auto;">
          <el-collapse v-model="activeNames" accordion>
            <el-collapse-item v-for="(item) in displayCrnList" :name="item.crnNo">
            <template slot="title">
                <div style="width: 100%;display: flex;">
                   <div style="width: 50%;">{{ item.crnNo }}号堆垛机</div>
@@ -54,8 +56,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="crnList.length">
          </el-pagination>
        </div>
    </div>
    `,
  props: ["param"],
@@ -64,12 +78,14 @@
      crnList: [],
      activeNames: "",
      searchCrnNo: "",
      showControl: true,
      showControl: false,
      controlParam: {
        crnNo: "",
        sourceLocNo: "",
        targetLocNo: "",
      },
      pageSize: 25,
      currentPage: 1,
    };
  },
  created() {
@@ -77,11 +93,20 @@
      this.getCrnStateInfo();
    }, 1000);
  },
  computed: {
    displayCrnList() {
      const start = (this.currentPage - 1) * this.pageSize;
      const end = start + this.pageSize;
      return this.crnList.slice(start, end);
    }
  },
  watch: {
    param: {
      handler(newVal, oldVal) {
        if (newVal.crnNo != 0) {
          this.activeNames = newVal.crnNo;
          const idx = this.crnList.findIndex(i => i.crnNo == newVal.crnNo);
          if (idx >= 0) { this.currentPage = Math.floor(idx / this.pageSize) + 1; }
        }
      },
      deep: true, // 深度监听嵌套属性
@@ -89,6 +114,13 @@
    },
  },
  methods: {
    handlePageChange(page) {
      this.currentPage = page;
    },
    handleSizeChange(size) {
      this.pageSize = size;
      this.currentPage = 1;
    },
    getCrnStateInfo() {
      let that = this;
      $.ajax({
@@ -112,6 +144,7 @@
                }
              });
              that.crnList = tmp;
              that.currentPage = 1;
            }
          }
        },