260517
This commit is contained in:
+33
-15
@@ -111,6 +111,19 @@ export default {
|
||||
uni.$on('takeEndoscope', (data) => {
|
||||
this.addLog(data.ic, '内镜取出')
|
||||
})
|
||||
|
||||
uni.$on('closeDoor', async (data) => {
|
||||
try {
|
||||
cmd.LeftDoor(false)
|
||||
await delay(100)
|
||||
cmd.RightDoor(false)
|
||||
this.addLog('门', '触摸屏关门')
|
||||
// 触发关门事件
|
||||
this.closeDoorEvent()
|
||||
} catch (error) {
|
||||
this.addLog('手动关门错误', error)
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
onShow() {
|
||||
@@ -144,7 +157,7 @@ export default {
|
||||
this.startRS485()
|
||||
this.startRS232()
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
// console.log(e)
|
||||
uni.showToast({
|
||||
title: '初始化串口失败',
|
||||
icon: 'error'
|
||||
@@ -268,7 +281,7 @@ export default {
|
||||
}
|
||||
let config = storage.get('config')
|
||||
if (config) {
|
||||
this.$store.state.apiUrl = config.ip + ':' + config.port
|
||||
this.$store.state.apiUrl = 'http://' + config.ip + ':' + config.port
|
||||
}
|
||||
},
|
||||
async initDB() {
|
||||
@@ -319,7 +332,7 @@ export default {
|
||||
icon: 'none'
|
||||
})
|
||||
this.RS485.startAutoReadData((res) =>{
|
||||
console.log('485 data', res)
|
||||
// console.log('485 data', res)
|
||||
// 转换成十六进制字符串
|
||||
let hex = this.RS485.byte2HexString(res)
|
||||
this.handle485HexData(hex)
|
||||
@@ -402,6 +415,7 @@ export default {
|
||||
title: '左门已关闭',
|
||||
icon: 'none'
|
||||
})
|
||||
this.addLog('左门触点触发', '左门已关闭')
|
||||
}
|
||||
if (data.action == 'RightDoor' && data.status == 'closed') {
|
||||
// 右门触点触发(关门)
|
||||
@@ -413,18 +427,22 @@ export default {
|
||||
title: '右门已关闭',
|
||||
icon: 'none'
|
||||
})
|
||||
this.addLog('右门触点触发', '右门已关闭')
|
||||
}
|
||||
if (data.action == 'door' && data.status == 'closed') {
|
||||
|
||||
cmd.LeftDoor(false)
|
||||
await delay(100)
|
||||
cmd.RightDoor(false)
|
||||
// 触发关门事件
|
||||
this.closeDoorEvent()
|
||||
uni.showToast({
|
||||
title: '两门已关闭',
|
||||
icon: 'none'
|
||||
})
|
||||
try {
|
||||
await cmd.LeftDoor(false)
|
||||
await delay(100)
|
||||
await cmd.RightDoor(false)
|
||||
// 触发关门事件
|
||||
await this.closeDoorEvent()
|
||||
uni.showToast({
|
||||
title: '两门已关闭',
|
||||
icon: 'none'
|
||||
})
|
||||
} catch (error) {
|
||||
this.addLog('门关闭错误', error.message || error)
|
||||
}
|
||||
}
|
||||
},
|
||||
handle232HexData(hex) {
|
||||
@@ -582,7 +600,7 @@ export default {
|
||||
this.stopRS485()
|
||||
this.stopRS232()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
// console.log(error)
|
||||
}
|
||||
this.closePop()
|
||||
uni.navigateTo({
|
||||
@@ -693,7 +711,7 @@ export default {
|
||||
// 网络同步
|
||||
// Api.logsync()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
// console.log(error)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user