Vue.component("watch-crn-card", { template: `
堆垛机监控
查询
关闭控制中心 打开控制中心
取放货
移动
任务完成
{{ item.crnNo }} {{ item.workNo }} {{ item.mode }} {{ item.status }} {{ item.sourceLocNo }} {{ item.locNo }} {{ item.loading }} {{ item.bay }} {{ item.lev }} {{ item.forkOffset }} {{ item.liftPos }} {{ item.walkPos }} {{ item.xspeed }} {{ item.yspeed }} {{ item.zspeed }} {{ item.xdistance }} {{ item.ydistance }} {{ item.xDuration }} {{ item.yduration }} {{ item.warnCode }} {{ item.alarm }}
`, props: ["param"], data() { return { crnList: [], activeNames: "", searchCrnNo: "", showControl: false, controlParam: { crnNo: "", sourceLocNo: "", targetLocNo: "", }, }; }, created() { setInterval(() => { this.getCrnStateInfo(); }, 1000); }, watch: { param: { handler(newVal, oldVal) { if (newVal.crnNo != 0) { this.activeNames = newVal.crnNo; } }, deep: true, // 深度监听嵌套属性 immediate: true, // 立即触发一次(可选) }, }, methods: { getCrnStateInfo() { let that = this; $.ajax({ url: baseUrl + "/crn/table/crn/state", headers: { token: localStorage.getItem("token"), }, method: "post", success: (res) => { // 堆垛机信息表获取 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; } } }, }); }, openControl() { this.showControl = !this.showControl; }, controlCommandTransport() { let that = this; //取放货 $.ajax({ url: baseUrl + "/crn/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 + "/crn/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 + "/crn/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", }); } }, }); }, }, });