Vue.component("watch-rgv-card", {
template: `
{{ item.rgvNo }}号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: ""
}
};
},
created() {
setInterval(() => {
this.getRgvStateInfo();
}, 1000);
},
watch: {
param: {
handler(newVal) {
if (newVal && newVal.rgvNo != 0) {
this.activeNames = newVal.rgvNo;
}
},
deep: true,
immediate: true
},
},
methods: {
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;
}
}
},
});
},
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",
});
}
},
});
},
},
});