From 36fb984f06cfc7f3116ac82b84c92c4af511c2af Mon Sep 17 00:00:00 2001 From: maochaoying <925670706@qq.com> Date: Sun, 10 Sep 2023 17:27:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=B4=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AddPreSetting.vue | 30 ++++++++++++++++++++++++++++ src/components/LiquidHandle.vue | 3 +++ src/components/Setting/components/Device.vue | 30 ++++++++++++++++++++++++++++ src/components/Test.vue | 6 ++++++ src/components/UpdatePreSetting.vue | 30 ++++++++++++++++++++++++++++ src/store/modules/websocket.js | 14 +++++++------ 6 files changed, 107 insertions(+), 6 deletions(-) diff --git a/src/components/AddPreSetting.vue b/src/components/AddPreSetting.vue index 682e5d7..3434f06 100644 --- a/src/components/AddPreSetting.vue +++ b/src/components/AddPreSetting.vue @@ -428,6 +428,9 @@ const formatter1 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -446,6 +449,9 @@ const formatter2 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -464,6 +470,9 @@ const formatter3 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -482,6 +491,9 @@ const formatter4 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -500,6 +512,9 @@ const formatter5 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -518,6 +533,9 @@ const formatter6 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -536,6 +554,9 @@ const formatter7 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -554,6 +575,9 @@ const formatter8 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -572,6 +596,9 @@ const formatter9 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -590,6 +617,9 @@ const formatter10 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } diff --git a/src/components/LiquidHandle.vue b/src/components/LiquidHandle.vue index eb3cf64..4dfd2ea 100644 --- a/src/components/LiquidHandle.vue +++ b/src/components/LiquidHandle.vue @@ -199,6 +199,9 @@ const formatter = value => { if (parseInt(value) <= 0) { return '0' } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } diff --git a/src/components/Setting/components/Device.vue b/src/components/Setting/components/Device.vue index 16784e7..70cb1b3 100644 --- a/src/components/Setting/components/Device.vue +++ b/src/components/Setting/components/Device.vue @@ -380,6 +380,9 @@ const formatter1 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -398,6 +401,9 @@ const formatter2 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -416,6 +422,9 @@ const formatter3 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -434,6 +443,9 @@ const formatter4 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -452,6 +464,9 @@ const formatter5 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -470,6 +485,9 @@ const formatter6 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -488,6 +506,9 @@ const formatter7 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -506,6 +527,9 @@ const formatter8 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -524,6 +548,9 @@ const formatter9 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -542,6 +569,9 @@ const formatter10 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } diff --git a/src/components/Test.vue b/src/components/Test.vue index 745eaf3..b9ba1e0 100644 --- a/src/components/Test.vue +++ b/src/components/Test.vue @@ -313,6 +313,9 @@ const formatter6 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value } @@ -328,6 +331,9 @@ const formatter7 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value } diff --git a/src/components/UpdatePreSetting.vue b/src/components/UpdatePreSetting.vue index e1572f1..706f65b 100644 --- a/src/components/UpdatePreSetting.vue +++ b/src/components/UpdatePreSetting.vue @@ -449,6 +449,9 @@ const formatter1 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -467,6 +470,9 @@ const formatter2 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -485,6 +491,9 @@ const formatter3 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -503,6 +512,9 @@ const formatter4 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -521,6 +533,9 @@ const formatter5 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -539,6 +554,9 @@ const formatter6 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -557,6 +575,9 @@ const formatter7 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -575,6 +596,9 @@ const formatter8 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -593,6 +617,9 @@ const formatter9 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } @@ -611,6 +638,9 @@ const formatter10 = value => { return arr[0].val_lower_limit + '' } } + if (value == '') { + return '0' + } return value.replace(/^0+/gi, '') } diff --git a/src/store/modules/websocket.js b/src/store/modules/websocket.js index af652e7..ee33a14 100644 --- a/src/store/modules/websocket.js +++ b/src/store/modules/websocket.js @@ -40,7 +40,7 @@ export const useWebSocketStore = defineStore({ const runningStore = useRunningStore() init.connect() init.ws.onmessage = function (ev) { - const { ackcode, messageId, timeStamp } = JSON.parse(ev.data) + const { messageId, timeStamp } = JSON.parse(ev.data) console.log(JSON.parse(ev.data)) switch (messageId) { case 'getState': @@ -168,11 +168,13 @@ export const useWebSocketStore = defineStore({ } break case 'startReplenishingFluids': - if (ackcode == 0) { + const { ackcode: startReplenishingCode } = JSON.parse(ev.data) + if (startReplenishingCode == 0) { operatorStore.updateReplenishingFluidsWorkState(1) } case 'startDraining': - if (ackcode == 0) { + const { ackcode: startDrainingCode } = JSON.parse(ev.data) + if (startDrainingCode == 0) { operatorStore.updateDrainingWorkState(1) } case 'startDisinfection': @@ -181,11 +183,11 @@ export const useWebSocketStore = defineStore({ break case 'exportUserBehaviorRecord': settingStore.updateExportLoading(false) - const { ackcode } = JSON.parse(ev.data) || {} - if (ackcode == 3000) { + const { ackcode: exportUserCode } = JSON.parse(ev.data) || {} + if (exportUserCode == 3000) { showFailToast('未检测到U盘') } - if (ackcode != 0 && ackcode != 3000) { + if (exportUserCode != 0 && exportUserCode != 3000) { showFailToast('导出错误') } break