diff --git a/src/components/LoadCells/LoadCells.vue b/src/components/LoadCells/LoadCells.vue index 86c751d..c394212 100644 --- a/src/components/LoadCells/LoadCells.vue +++ b/src/components/LoadCells/LoadCells.vue @@ -75,6 +75,8 @@ export default { }; }, + computed: mapState('home', ['weighSensor1', 'weighSensor2', 'weighSensor3', 'weighSensor4']), + watch: { weighSensor1(value) { console.log('value: ', value); @@ -100,10 +102,6 @@ export default { }, }, - computed: { - ...mapState('home', ['weighSensor1', 'weighSensor2', 'weighSensor3', 'weighSensor4']), - }, - methods: {}, }; diff --git a/src/mixins/socket.js b/src/mixins/socket.js index 24274a0..3d6401a 100644 --- a/src/mixins/socket.js +++ b/src/mixins/socket.js @@ -63,7 +63,7 @@ const mixin = { case 1: // 体重 // 收到同步消息 // 把消息添加到store 的消息栈中 - this.messagesAddWeight(data.data); + this.messagesAddWeight(data.data.value); break; case 2: // RFID this.messagesAddRfid(data.data); diff --git a/src/store/modules/messages/state.js b/src/store/modules/messages/state.js index f926073..545d00d 100644 --- a/src/store/modules/messages/state.js +++ b/src/store/modules/messages/state.js @@ -1,11 +1,11 @@ const state = { syncMessages: [], // 同步消息 - weightMessage: null, // 体重 + weightMessage: 0, // 体重 rfidMessage: null, // RFID - weighSensor1: '', // 称重传感器一 - weighSensor2: '', // 称重传感器二 - weighSensor3: '', // 称重传感器三 - weighSensor4: '', // 称重传感器四 + weighSensor1: 0, // 称重传感器一 + weighSensor2: 0, // 称重传感器二 + weighSensor3: 0, // 称重传感器三 + weighSensor4: 0, // 称重传感器四 vibrationSensor: null, // 震动传感器 thrombolyticDose: null, // 溶栓剂量(总量) bolusDose: null, // 团注剂量