人员管理增加修改

This commit is contained in:
2026-06-02 09:15:38 +08:00
parent 92165c914a
commit 05a72ac7dd
6 changed files with 212 additions and 87 deletions
+35 -64
View File
@@ -55,7 +55,6 @@ export default {
RS232: undefined,
timer: null, // 定时器读取485接口数据
taskTimer: null,
leftDoorCycleTimer: null, // 左门循环定时器
last485DataTime: null, // 上次收到485数据的时间戳
heartbeatTimer: null, // 心跳检测定时器
reconnectCount: 0, // 重连次数计数器
@@ -119,9 +118,9 @@ export default {
uni.$on('closeDoor', async (data) => {
try {
cmd.LeftDoor(false)
await delay(100)
cmd.RightDoor(false)
await cmd.LeftDoor(false)
await delay(200)
await cmd.RightDoor(false)
this.addLog('门', '触摸屏关门')
// 触发关门事件
this.closeDoorEvent()
@@ -163,11 +162,6 @@ export default {
clearInterval(this.taskTimer)
this.taskTimer = null
}
// 清理左门循环定时器
if (this.leftDoorCycleTimer) {
clearInterval(this.leftDoorCycleTimer)
this.leftDoorCycleTimer = null
}
},
methods: {
init() {
@@ -519,10 +513,13 @@ export default {
this.timer = null
}
// 4. 重置时间戳
// 4. 清空RS485队列中积压的失效指令
cmd.clearRS485Queue()
// 5. 重置时间戳
this.last485DataTime = null
// 5. 重新启动RS485通信
// 6. 重新启动RS485通信
this.startRS485()
} catch (error) {
@@ -531,7 +528,23 @@ export default {
// 失败后延迟重试
await delay(5000)
if (this.reconnectCount < this.maxReconnect) {
// 还有重连机会,继续重连
this.resetRS485()
} else {
// 重连次数耗尽,自动重启应用(彻底恢复native层状态)
this.addLog('485通信', `重连${this.maxReconnect}次均失败,即将自动重启...`)
uni.showToast({
title: '通信异常,3秒后重启',
icon: 'none',
duration: 3000
})
setTimeout(() => {
// #ifdef APP-PLUS
plus.runtime.restart()
// #endif
}, 3000)
}
}
},
@@ -592,7 +605,7 @@ export default {
if (data.action == 'door' && data.status == 'closed') {
try {
await cmd.LeftDoor(false)
await delay(100)
await delay(200)
await cmd.RightDoor(false)
// 触发关门事件
await this.closeDoorEvent()
@@ -678,50 +691,7 @@ export default {
}
}
},
// handle232HexData(hex) {
// // 处理232接口上报的数据
// let data = cmd.parse232dData(hex)
// if (data == {}) return
// if (data.action == 'leave' && data.type == 'internal') {
// // 更新内镜数据
// let key = data.address - 1
// uni.$emit('notice', { title: data.address, content: '内镜取出'})
// this.updateScope(key, 'leave', '')
// // 添加日志数据
// this.addLog('位置'+key, '内镜取出')
// }
// if (data.action == 'enter' && data.type == 'internal') {
// // 验证内镜信息
// this.checkEndoCard(data.number).then(res => {
// if (res) {
// uni.$emit('notice', { title: data.number, content: '内镜存入'})
// // 更新内镜数据
// let key = data.address - 1
// this.updateScope(key, 'enter', data.number)
// // 添加日志数据
// this.addLog(data.number, '内镜存入')
// }
// })
// uni.$emit('ic', data.number)
// }
// if (data.action == 'enter' && data.type == 'person') {
// // 验证人员信息
// this.checkPersonCard(data.number).then(res => {
// if (res) {
// // 开门事件
// cmd.Door(true)
// // this.openDoorEvent()
// uni.$emit('notice', { title: data.number, content: '刷卡开门'})
// // 添加日志数据
// this.addLog(data.number, '刷卡开门')
// }
// })
// uni.$emit('ic', data.number)
// }
// if (data.action == 'door') {
// cmd.Door(false)
// }
// },
// 密码框提交
inputModalSubmit(val) {
let password = this.$store.state.base.screenPw
@@ -803,20 +773,21 @@ export default {
// 开门事件
async openDoorEvent() {
// 关闭真空泵和消毒,打开照明,打开门锁,打开风机
cmd.Vacuum(false)
await delay(300)
cmd.Light(true)
await delay(300)
await delay(500)
cmd.Vacuum(false)
await delay(500)
cmd.Wind(true)
},
// 关门事件
async closeDoorEvent() {
// 关闭照明,打开真空泵、消毒
cmd.Light(false) // 照明关闭指令
await delay(300)
cmd.Vacuum(true) //真空泵开启指令
await delay(300)
cmd.Wind(true)
await delay(500)
await cmd.Light(false) // 照明关闭指令
await delay(500)
await cmd.Vacuum(true) //真空泵开启指令
await delay(500)
await cmd.Wind(true)
},
// 验证人员卡是否可以开门
async checkPersonCard(ic) {