This commit is contained in:
liushuai
2019-09-27 18:10:19 +08:00
parent 7dbc09b9e5
commit 6a3ebcfa7b
2 changed files with 11 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ export const downloadFileMachine = `http://192.168.1.231:8411/submit/downloadFil
export const MESUploadFile = `http://192.168.1.231:8411/submit/MESUploadFile.ashx` export const MESUploadFile = `http://192.168.1.231:8411/submit/MESUploadFile.ashx`
export const MESDownloadFile = `http://192.168.1.231:8411/submit/MESDownloadFile.ashx` export const MESDownloadFile = `http://192.168.1.231:8411/submit/MESDownloadFile.ashx`
const service = axios.create({ const service = axios.create({
baseURL: `http://192.168.0.103:8411/submit/MESCommonBase.ashx`, baseURL: `http://192.168.0.101:8411/submit/MESCommonBase.ashx`,
timeout: 1500000 // 请求超时时间 timeout: 1500000 // 请求超时时间
}) })
export default service export default service

View File

@@ -273,11 +273,17 @@ export default {
OPNAME141: 'OP1410', OPNAME141: 'OP1410',
OPNAME142: 'OP1420', OPNAME142: 'OP1420',
OPNAME143: 'OP1430', OPNAME143: 'OP1430',
OPNAME144: 'OP1440' OPNAME144: 'OP1440',
timer: null
} }
}, },
mounted() { mounted() {
this.connect() this.connect()
this.timer = setInterval(this.searchState, 15 * 1000) // 工位状态 15秒 一刷新
},
beforeDestroy() {
// 页面结束之前关闭所有timer防止资源占用
clearInterval(this.timer)
}, },
methods: { methods: {
/* socket连接*/ /* socket连接*/
@@ -303,6 +309,7 @@ export default {
// 数据接收 // 数据接收
websocketonmessage(msg) { websocketonmessage(msg) {
this.msg = msg this.msg = msg
console.log(msg)
const aa = this.msg.data.split('|') const aa = this.msg.data.split('|')
console.log(aa[1]) console.log(aa[1])
// if (aa[1] === '') { // if (aa[1] === '') {
@@ -319,7 +326,8 @@ export default {
websocketerror() { websocketerror() {
console.log('WebSocket连接失败') console.log('WebSocket连接失败')
this.socketConnect = false this.socketConnect = false
} },
searchState() {}
} }
} }
</script> </script>