Vue.component("devp-card", { template: `
输送监控
查询
关闭控制中心 打开控制中心
下发
{{ item.stationId }} {{ item.taskNo }} {{ item.targetStaNo }} {{ item.autoing ? '自动' : '手动' }} {{ item.loading ? '有' : '无' }} {{ item.inEnable ? 'Y' : 'N' }} {{ item.outEnable ? 'Y' : 'N' }} {{ item.emptyMk ? 'Y' : 'N' }} {{ item.fullPlt ? 'Y' : 'N' }} {{ item.palletHeight }} {{ item.barcode }} {{ item.error }}
`, props: ["param"], data() { return { stationList: [], activeNames: "", searchStationId: "", showControl: false, controlParam: { stationId: "", taskNo: "", targetStationId: "", }, pageSize: 25, currentPage: 1, }; }, created() { setInterval(() => { this.getDevpStateInfo(); }, 1000); }, computed: { displayStationList() { const start = (this.currentPage - 1) * this.pageSize; const end = start + this.pageSize; return this.stationList.slice(start, end); } }, watch: { param: { handler(newVal, oldVal) { if (newVal.stationId != 0) { this.activeNames = newVal.stationId; this.searchStationId = newVal.stationId; } }, deep: true, // 深度监听嵌套属性 immediate: true, // 立即触发一次(可选) }, }, methods: { handlePageChange(page) { this.currentPage = page; }, handleSizeChange(size) { this.pageSize = size; this.currentPage = 1; }, getDevpStateInfo() { let that = this; $.ajax({ url: baseUrl + "/console/latest/data/station", headers: { token: localStorage.getItem("token"), }, method: "post", success: (res) => { // 堆垛机信息表获取 if (res.code == 200) { let list = res.data; if (that.searchStationId == "") { that.stationList = list; } else { let tmp = []; list.forEach((item) => { if (item.stationId == that.searchStationId) { tmp.push(item); } }); that.stationList = tmp; that.currentPage = 1; } } }, }); }, openControl() { this.showControl = !this.showControl; }, controlCommand() { let that = this; //下发命令 $.ajax({ url: baseUrl + "/station/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", }); } }, }); }, }, });