更新信息

This commit is contained in:
24kycj
2024-11-11 12:36:34 +08:00
parent f83d29dca4
commit ef2607a5fd
2 changed files with 56 additions and 8 deletions
+52 -4
View File
@@ -4,10 +4,54 @@
let timeouter = null
let websock = null
let isConnect = false
// 状态JSON
// 打印机状态
const PrinterStatus = {
'I': '空闲',
'B': '忙碌',
'P': '正在打印'
}
// 错误状态
const Error1 = {
'0': '托盘移动错误',
'1': '墨盒类型错误',
'2': '抓取光盘时未检测到光盘光盘已用完',
'3': '光盘掉落',
'4': '墨水车空警告',
'5': '光盘抓手错误',
'6': '抓取多张光盘错误',
'7': '机械臂挂钩错误或者机械臂归位错误',
}
const Error2 = {
'0': '墨水车伺服系统错误',
'1': '墨水车失速错误',
'2': '墨盒数据读取错误',
'3': '打印图像超出范围',
'4': '环境温度超出正常使用范围',
'5': '墨盒短路',
'6': '型号错误',
'7': '缓冲区溢出错误',
}
const getDefaultState = () => {
return {
reconnections: 0,
taskList: []
PrinterStatus,
task_list: [],
printer_info: {
blue_last: 33, //蓝色墨盒遗留
cover_flag: false, //是否盖盖
left_strong_cd_num: 99, //左盘仓剩余盘数量
printer_name: '', //打印机名称
printer_status: 73, //打印机状态 数字转成字符为I
printer_tray: 73, //打印机托盘状态 数字转成字符为I
red_last: 29, //红色墨盒遗留
rigth_strong_cd_num: 99, //右盘仓剩余盘数量
yellow_last: 27 //黄色墨盒遗留
}
}
}
@@ -16,7 +60,7 @@ const state = getDefaultState()
const mutations = {
setData: (state, obj) => {
state[obj.name] = obj.data
},
}
}
const actions = {
@@ -46,7 +90,12 @@ const actions = {
const data = JSON.parse(e.data) // 转json对象
if (data.resp_name) {
if (data.resp_name === 'task_list') {
commit('chat/setData', { name: 'taskList', data: data.resp_info.task_list })
commit('chat/setData', { name: 'task_list', data: data.resp_info.task_list })
} else if (data.resp_name === 'printer_info') {
let info = data.resp_info
info.printer_status = String.fromCharCode(info.printer_status)
info.printer_tray = String.fromCharCode(info.printer_tray)
commit('chat/setData', { name: 'printer_info', data: info })
}
} else {
if (data.type === 'init') {
@@ -123,7 +172,6 @@ const actions = {
// showCancelButton: true
// })
// .then(() => {
// })
// .catch(() => {})
}