260517
This commit is contained in:
+11
-2
@@ -35,15 +35,24 @@ export const endoscopeinware = (param) => {
|
||||
return request.get('/cabinetapi/endoscopeinware', param)
|
||||
}
|
||||
|
||||
// 内镜取出
|
||||
// 内镜取出
|
||||
export const endoscopeoutware = (param) => {
|
||||
return request.get('/cabinetapi/endoscopeoutware', param)
|
||||
}
|
||||
|
||||
// 提交日志
|
||||
// 提交日志
|
||||
export const logsync = (param) => {
|
||||
return request.get('/cabinetapi/logsync', param)
|
||||
}
|
||||
|
||||
// 内镜入库(endoscopeInwareLog)
|
||||
export const endoscopeInwareLog = (param) => {
|
||||
return request.get('/app/controller/cabinet-api/endoscopeInwareLog', param)
|
||||
}
|
||||
|
||||
// 内镜出库(endoscopeOutwareLog)
|
||||
export const endoscopeOutwareLog = (param) => {
|
||||
return request.get('/app/controller/cabinet-api/endoscopeOutwareLog', param)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -378,6 +378,7 @@ export const selectDataList = (tabName,setData,byName,byType) => {
|
||||
setStr += (
|
||||
`${item}=${JSON.stringify(setData[item])}${dataKeys.length - 1 !== index ? " and " : ""}`)
|
||||
})
|
||||
// console.log(setStr)
|
||||
sql = `select * from ${tabName} where ${setStr}`
|
||||
} else {
|
||||
sql = `select * from ${tabName}`
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@
|
||||
"name" : "endoscope",
|
||||
"appid" : "__UNI__5A0A7D6",
|
||||
"description" : "",
|
||||
"versionName" : "1.2.3",
|
||||
"versionCode" : 109,
|
||||
"versionName" : "1.2.4",
|
||||
"versionCode" : 111,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
|
||||
+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({
|
||||
|
||||
+2
-2
@@ -66,12 +66,12 @@ export default {
|
||||
focus: 'ip'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
onLoad() {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
let server = storage.get('server', '')
|
||||
let server = storage.get('config', '')
|
||||
if (server) {
|
||||
this.ip = server.ip;
|
||||
this.port = server.port;
|
||||
|
||||
@@ -187,6 +187,7 @@ export default {
|
||||
})
|
||||
this.getList()
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
uni.showToast({
|
||||
title: '保存失败',
|
||||
icon: 'none'
|
||||
|
||||
+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)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<template>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,3 +1,5 @@
|
||||
import store from '@/store'
|
||||
|
||||
// 获取合并的数据
|
||||
export const mergeConfig = (_this, options) => {
|
||||
//判断url是不是链接
|
||||
@@ -5,10 +7,14 @@ export const mergeConfig = (_this, options) => {
|
||||
let config = Object.assign({
|
||||
timeout: _this.timeout
|
||||
}, _this.config, options);
|
||||
|
||||
// 动态从 store 中获取最新的 apiUrl
|
||||
const dynamicApiUrl = store.getters.apiUrl || _this.baseUrl;
|
||||
|
||||
if (options.method == "FILE") {
|
||||
config.url = urlType ? options.url : _this.fileUrl + options.url;
|
||||
config.url = urlType ? options.url : (dynamicApiUrl || _this.fileUrl) + options.url;
|
||||
} else {
|
||||
config.url = urlType ? options.url : _this.baseUrl + options.url;
|
||||
config.url = urlType ? options.url : dynamicApiUrl + options.url;
|
||||
}
|
||||
//请求头
|
||||
if (options.header) {
|
||||
|
||||
@@ -4,16 +4,12 @@
|
||||
import store from '@/store'
|
||||
import request from './request'
|
||||
|
||||
// 后端api地址
|
||||
// const apiUrl = 'http://' + store.getters.apiUrl
|
||||
const apiUrl = 'http://ectms.dev.opmonitor.com'
|
||||
|
||||
// 可以new多个request来支持多个域名请求
|
||||
const $http = new request({
|
||||
// 接口请求地址
|
||||
baseUrl: apiUrl,
|
||||
// 服务器本地上传文件地址
|
||||
fileUrl: apiUrl,
|
||||
// 接口请求地址(初始值,实际使用时会从 store 动态读取)
|
||||
baseUrl: '',
|
||||
// 服务器本地上传文件地址(初始值,实际使用时会从 store 动态读取)
|
||||
fileUrl: '',
|
||||
// 服务器上传图片默认url
|
||||
defaultUploadUrl: 'upload/image',
|
||||
// 设置请求头(如果使用报错跨域问题,可能是content-type请求类型和后台那边设置的不一致)
|
||||
@@ -27,7 +23,7 @@ const $http = new request({
|
||||
// 是否自动提示错误
|
||||
isPrompt: true,
|
||||
// 是否显示加载动画
|
||||
load: true,
|
||||
load: false,
|
||||
// 是否使用数据工厂
|
||||
isFactory: true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user