From ffbb6af84e169f4e88463c3974e2dea363789c6b Mon Sep 17 00:00:00 2001 From: 24kycj <1637269896@qq.com> Date: Tue, 12 Nov 2024 19:52:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/store/modules/chat.js | 19 ++++++++++++------- src/renderer/views/dashboard/index.vue | 14 +++++++------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/renderer/store/modules/chat.js b/src/renderer/store/modules/chat.js index 8d58773..f2ea7cb 100644 --- a/src/renderer/store/modules/chat.js +++ b/src/renderer/store/modules/chat.js @@ -160,15 +160,20 @@ const actions = { const data = JSON.parse(e.data) // 转json对象 if (data.resp_name) { if (data.resp_name === 'task_list') { - commit('chat/setData', { name: 'task_list', data: data.resp_info.task_list }) + commit('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.resp_name === 'cd_list') { - let info = data.resp_info - commit('chat/setData', { name: 'cd_list', data: info }) + commit('setData', { name: 'printer_info', data: info }) + } else if (data.resp_name === 'cd_info') { + const list = data.resp_info.cd_list + let cds = [{}, {}] + for (let i = 0; i < list.length; i++) { + if (list[i].cd_pos == 2) cds[0] = list[i] + else cds[1] = list[i] + } + commit('setData', { name: 'cd_list', data: cds }) } else if (data.resp_name === 'printer_error') { let error = data.resp_info let info = { @@ -176,7 +181,7 @@ const actions = { error2: '', error3: '' } - commit('chat/setData', { name: 'printer_error', data: info }) + commit('setData', { name: 'printer_error', data: info }) if (error.error1) { let errors = error.error1.split('') for (let i = 0; i < errors.length; i++) { @@ -196,7 +201,7 @@ const actions = { } } setTimeout(() => { - commit('chat/setData', { name: 'printer_error', data: info }) + commit('setData', { name: 'printer_error', data: info }) }, 100) } } else { diff --git a/src/renderer/views/dashboard/index.vue b/src/renderer/views/dashboard/index.vue index 99bab49..84081b2 100644 --- a/src/renderer/views/dashboard/index.vue +++ b/src/renderer/views/dashboard/index.vue @@ -73,19 +73,19 @@
-
+
-
+
-
+
-
{{printer_info.blue_last}}%
-
{{printer_info.red_last}}%
-
{{printer_info.yellow_last}}%
+
{{parseInt(printer_info.blue_last)}}%
+
{{parseInt(printer_info.red_last)}}%
+
{{parseInt(printer_info.yellow_last)}}%
@@ -593,7 +593,7 @@ $red: #ff0000; } } .device_info_option_list { - width: 150px; + width: 200px; .device_info_option_item { width: 36px; height: 67px;