优化
This commit is contained in:
@@ -313,6 +313,10 @@ const mutations = {
|
||||
}
|
||||
|
||||
const actions = {
|
||||
// 改变state值
|
||||
setDatas: ({ commit }, data) => {
|
||||
commit('setData', data)
|
||||
},
|
||||
// 初始化websocket
|
||||
initWebSocket({ state, commit, dispatch, rootState }) {
|
||||
if (typeof WebSocket === 'undefined') return console.log('您的浏览器不支持websocket')
|
||||
@@ -450,7 +454,13 @@ const actions = {
|
||||
}
|
||||
if (error.printer_error) {
|
||||
error.printer_error = '0x' + error.printer_error.toString(16)
|
||||
commit('setData', { name: 'printer_error', data: { type: 'error', confirm: printer_errors[error.printer_error], req: 'continue_task' } })
|
||||
let continues = ['0x11', '0x12', '0x13', '0x14', '0x15', '0x16', '0x17', '0x18', '0x19', '0x1a', '0x1b', '0x1c', '0x1d', '0x1e', '0x1f', '0x21']
|
||||
let req = continues.indexOf(error.printer_error) > -1 ? 'continue_task' : ''
|
||||
if (req) {
|
||||
commit('setData', { name: 'printer_error', data: { type: 'error', confirm: printer_errors[error.printer_error], req: req } })
|
||||
} else {
|
||||
commit('setData', { name: 'printer_error', data: { type: 'error', notify: printer_errors[error.printer_error] } })
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -524,10 +534,6 @@ const actions = {
|
||||
closeWebsocket: () => {
|
||||
// 关闭
|
||||
if (websock) websock.close()
|
||||
},
|
||||
// 改变工作状态
|
||||
changeWorkStatus: ({ commit }, data) => {
|
||||
commit('setData', { name: 'workStatus', data: data })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user