Vue.component('watch-crn-card', {
template: `
{{ item.crnNo }}号堆垛机
自动
作业中
故障
离线
{{ 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: ''
}
},
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;
}
}
}
})
},
}
});