260517
This commit is contained in:
+70
-14
@@ -86,7 +86,7 @@
|
||||
'over': item.isWarning == 'over', 'near': item.isWarning == 'near'
|
||||
}">
|
||||
<view>
|
||||
{{ item.ic }}
|
||||
{{ item.rfid }}
|
||||
</view>
|
||||
</uni-row>
|
||||
<uni-row v-else class="info">
|
||||
@@ -197,6 +197,7 @@ import { getDataList } from '@/db/sqlite.js'
|
||||
import * as db from '@/db/sqlite.js'
|
||||
import cmd from '@/utils/cmd.js'
|
||||
import storage from '@/utils/storage.js'
|
||||
import * as Api from '@/api/index.js'
|
||||
export default {
|
||||
components: {
|
||||
PageFooter, PageHeader, Notice, SlotNotice
|
||||
@@ -225,6 +226,8 @@ export default {
|
||||
timer: null, // 定时器
|
||||
timeouter: null, // 延时器
|
||||
currentCardNumber: '', // 当前卡号
|
||||
|
||||
currentName: '' // 当前用户名
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -281,7 +284,7 @@ export default {
|
||||
uni.redirectTo({ url: '/pages/start', animationType: 'fade-out' })
|
||||
return true;
|
||||
},
|
||||
onLoad() {
|
||||
async onLoad() {
|
||||
|
||||
},
|
||||
onShow() {
|
||||
@@ -290,6 +293,7 @@ export default {
|
||||
uni.$on('showActionSelect', (cardNumber) => { this.showActionSelect(cardNumber) })
|
||||
this.getData() // 注释掉以使用测试数据
|
||||
this.startTimer()
|
||||
|
||||
},
|
||||
onHide() {
|
||||
uni.$off('notice')
|
||||
@@ -327,7 +331,7 @@ export default {
|
||||
// console.log('handleData', list)
|
||||
let data = []
|
||||
for (let i = 0; i < 16; i++) {
|
||||
data.push({ ic: '', text: '', isWarning: false })
|
||||
data.push({ ic: '', text: '', isWarning: false, rfid: '' })
|
||||
}
|
||||
this.list = data
|
||||
let curDate = formatDateTime()
|
||||
@@ -340,6 +344,7 @@ export default {
|
||||
let item = this.list[key]
|
||||
item.ic = i.ic
|
||||
item.text = ''
|
||||
item.rfid = i.rfid
|
||||
item.isWarning = false
|
||||
if (i.ic != '') {
|
||||
item.text = diffText
|
||||
@@ -360,7 +365,9 @@ export default {
|
||||
// 调试手动关门
|
||||
// let door = this.$store.state.relay.door
|
||||
// cmd.Door(true)
|
||||
this.$refs.doorNotice.open()
|
||||
// this.$refs.doorNotice.open()
|
||||
uni.showToast({ title: '手动关门', icon: 'none' })
|
||||
uni.$emit('closeDoor');
|
||||
},
|
||||
disinfectClick() {
|
||||
// 消毒手动开启
|
||||
@@ -416,6 +423,19 @@ export default {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.doorNotice.open()
|
||||
})
|
||||
|
||||
db.selectDataList('user', {'ic': cardNumber}).then(res => {
|
||||
if (res.length > 0) {
|
||||
this.currentName = res[0].name
|
||||
} else {
|
||||
db.selectDataList('user', {'ic2': cardNumber}).then(res => {
|
||||
if (res.length > 0) {
|
||||
this.currentName = res[0].name
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
showActionSelect(cardNumber) {
|
||||
// 显示操作选择弹窗(存入/取出)
|
||||
@@ -444,24 +464,32 @@ export default {
|
||||
let emptyKey = -1
|
||||
|
||||
for (let i = 0; i < scopeList.length; i++) {
|
||||
if (!scopeList[i].ic || scopeList[i].ic === '') {
|
||||
if (!scopeList[i].rfid || scopeList[i].rfid === '') {
|
||||
emptyKey = scopeList[i].key
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (emptyKey === -1) {
|
||||
uni.showToast({
|
||||
title: '没有空闲位置',
|
||||
icon: 'none'
|
||||
})
|
||||
uni.showToast({ title: '没有空闲位置', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
let rfid = ""
|
||||
let endList = await db.selectDataList('endo', {ic: this.currentCardNumber})
|
||||
if (endList.length > 0) {
|
||||
rfid = endList[0].rfid
|
||||
} else {
|
||||
let endList = await db.selectDataList('endo', {ic2: this.currentCardNumber})
|
||||
if (endList.length > 0) {
|
||||
rfid = endList[0].rfid
|
||||
}
|
||||
}
|
||||
|
||||
// 更新scope表,记录存入信息
|
||||
await db.updateSQL('scope', {
|
||||
name: 'enter',
|
||||
ic: this.currentCardNumber,
|
||||
rfid: rfid,
|
||||
time: formatDateTime()
|
||||
}, 'key', emptyKey)
|
||||
|
||||
@@ -472,8 +500,17 @@ export default {
|
||||
title: '内镜已存入',
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
// 关闭操作选择框
|
||||
this.$refs.actionNotice.close()
|
||||
// 刷新数据
|
||||
this.getData()
|
||||
// 添加入库记录到服务器
|
||||
Api.endoscopeInwareLog({
|
||||
'endoscope_steel_no': rfid,
|
||||
'rfid_reader': '123456',
|
||||
'user_name': this.currentName
|
||||
})
|
||||
|
||||
} catch (error) {
|
||||
console.log('存入内镜失败:', error)
|
||||
uni.showToast({
|
||||
@@ -482,6 +519,7 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
async takeEndoscope() {
|
||||
// 取出内镜 - 门关闭状态时才能取出
|
||||
// if (this.$store.state.relay.door) {
|
||||
@@ -497,15 +535,25 @@ export default {
|
||||
|
||||
// 根据卡号查找scope表中的位置
|
||||
try {
|
||||
let rfid = ""
|
||||
let endList = await db.selectDataList('endo', {ic: this.currentCardNumber})
|
||||
if (endList.length > 0) {
|
||||
rfid = endList[0].rfid
|
||||
} else {
|
||||
let endList = await db.selectDataList('endo', {ic2: this.currentCardNumber})
|
||||
if (endList.length > 0) {
|
||||
rfid = endList[0].rfid
|
||||
}
|
||||
}
|
||||
|
||||
let scopeList = await db.selectDataList('scope', {})
|
||||
let foundKey = -1
|
||||
for (let i = 0; i < scopeList.length; i++) {
|
||||
if (scopeList[i].ic == this.currentCardNumber) {
|
||||
if (scopeList[i].rfid == rfid) {
|
||||
foundKey = scopeList[i].key
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (foundKey === -1) {
|
||||
uni.showToast({
|
||||
title: '未找到该内镜',
|
||||
@@ -518,6 +566,7 @@ export default {
|
||||
await db.updateSQL('scope', {
|
||||
name: 'leave',
|
||||
ic: '',
|
||||
rfid: '',
|
||||
time: formatDateTime()
|
||||
}, 'key', foundKey)
|
||||
|
||||
@@ -528,8 +577,15 @@ export default {
|
||||
title: '内镜已取出',
|
||||
icon: 'none'
|
||||
})
|
||||
|
||||
this.$refs.actionNotice.close()
|
||||
this.getData()
|
||||
// 添加出库记录到服务器
|
||||
Api.endoscopeOutwareLog({
|
||||
'endoscope_steel_no': rfid,
|
||||
'rfid_reader': '123456',
|
||||
'user_name': this.currentName
|
||||
})
|
||||
|
||||
} catch (error) {
|
||||
console.log('取出内镜失败:', error)
|
||||
uni.showToast({
|
||||
|
||||
Reference in New Issue
Block a user