Vue.component("watch-rgv-card", { template: `
RGV监控
查询
关闭控制中心 打开控制中心
取放货
移动
任务完成
{{ item.rgvNo }} {{ item.taskNo }} {{ item.mode }} {{ item.status }} {{ item.trackSiteNo }} {{ item.loading }} {{ item.warnCode }} {{ item.alarm }}
`, props: ["param"], data() { return { rgvList: [], activeNames: "", searchRgvNo: "", showControl: false, controlParam: { rgvNo: "", sourcePos: "", targetPos: "" }, pageSize: 25, currentPage: 1, }; }, created() { setInterval(() => { 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, immediate: true }, }, methods: { handlePageChange(page) { this.currentPage = page; }, handleSizeChange(size) { this.pageSize = size; this.currentPage = 1; }, getRgvStateInfo() { 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; } } }, }); }, openControl() { this.showControl = !this.showControl; }, controlCommandTransport() { let that = this; $.ajax({ url: baseUrl + "/rgv/command/transport", 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 + "/rgv/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 + "/rgv/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", }); } }, }); }, }, });