Vue.component("watch-dual-crn-card", { template: `
双工位堆垛机监控
查询
关闭控制中心 打开控制中心
取放货
移动
任务完成
{{ item.mode }} {{ item.warnCode }} {{ item.taskNo }} {{ item.taskNoTwo }} {{ item.status }} {{ item.statusTwo }} {{ item.loading }} {{ item.loadingTwo }} {{ item.bay }} {{ item.bayTwo }} {{ item.lev }} {{ item.levTwo }} {{ item.forkOffset }} {{ item.forkOffsetTwo }} {{ item.liftPos }} {{ item.liftPosTwo }} {{ item.walkPos }} {{ item.walkPosTwo }} {{ item.xspeed }} {{ item.yspeed }} {{ item.zspeed }} {{ item.xdistance }} {{ item.ydistance }} {{ item.xduration }} {{ item.yduration }} {{ item.extend }}
`, props: ["param"], data() { return { crnList: [], activeNames: "", searchCrnNo: "", showControl: false, controlParam: { crnNo: "", sourceLocNo: "", targetLocNo: "", station: 1, }, pageSize: 25, currentPage: 1, }; }, created() { setInterval(() => { this.getDualCrnStateInfo(); }, 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) { if (newVal.crnNo != 0) { this.activeNames = newVal.crnNo; this.searchCrnNo = 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, immediate: true, }, }, methods: { handlePageChange(page) { this.currentPage = page; }, handleSizeChange(size) { this.pageSize = size; this.currentPage = 1; }, openControl() { this.showControl = !this.showControl; }, getDualCrnStateInfo() { if (this.$root.sendWs) { this.$root.sendWs(JSON.stringify({ "url": "/dualcrn/table/crn/state", "data": {} })); } }, controlCommandTransport() { let that = this; $.ajax({ url: baseUrl + "/dualcrn/command/take", headers: { token: localStorage.getItem("token"), }, contentType: "application/json", method: "post", data: JSON.stringify(that.controlParam), success: (res) => { if (res.code == 200) { that.$message({ message: res.msg, type: "success", }); } else { that.$message({ message: res.msg, type: "warning", }); } }, }); }, controlCommandMove() { let that = this; $.ajax({ url: baseUrl + "/dualcrn/command/move", headers: { token: localStorage.getItem("token"), }, contentType: "application/json", method: "post", data: JSON.stringify(that.controlParam), success: (res) => { if (res.code == 200) { that.$message({ message: res.msg, type: "success", }); } else { that.$message({ message: res.msg, type: "warning", }); } }, }); }, controlCommandTaskComplete() { let that = this; $.ajax({ url: baseUrl + "/dualcrn/command/taskComplete", headers: { token: localStorage.getItem("token"), }, contentType: "application/json", method: "post", data: JSON.stringify(that.controlParam), success: (res) => { if (res.code == 200) { that.$message({ message: res.msg, type: "success", }); } else { that.$message({ message: res.msg, type: "warning", }); } }, }); }, setDualCrnList(res) { let that = this; if (res.code == 200) { let list = res.data; if (that.searchCrnNo == "") { that.crnList = list; } else { let tmp = []; list.forEach((item) => { if (item.crnNo == that.searchCrnNo) { tmp.push(item); } }); that.crnList = tmp; that.currentPage = 1; } } }, }, });