diff --git a/src/components/Panel/Panel.vue b/src/components/Panel/Panel.vue index 3d532fb..0f819a6 100644 --- a/src/components/Panel/Panel.vue +++ b/src/components/Panel/Panel.vue @@ -28,9 +28,20 @@ - +
-
{{ item }}
+
{{ item }}
@@ -77,7 +88,6 @@ export default { computed: mapState('messages', ['weightMessage', 'bolusDose', 'maintenanceDose', 'thrombolyticDose', 'startMessages', 'rfidMessage']), watch: { rfidMessage(val) { - console.log(val); if (this.startMessages) { this.percent = 0; this.percentA = 0; diff --git a/src/components/RFID/RFID.vue b/src/components/RFID/RFID.vue index c0f0e1c..49e84dc 100644 --- a/src/components/RFID/RFID.vue +++ b/src/components/RFID/RFID.vue @@ -37,8 +37,8 @@ export default { { code: '25', active: false, name: '专用电梯(四楼)' }, { code: '26', active: false, name: 'CCU导管室' }, ], - num: 0, //当前正在展示的div - t: null, + num: null, //当前正在展示的div + timer: null, }; }, @@ -51,11 +51,18 @@ export default { }, watch: { - rfidMessage: { - handler(value) { + rfidMessage(value) { + if (value && value.step) { + if (this.timer) { + clearInterval(this.timer); + this.timer = null; + } this.setLight(value.step); - }, - deep: true, + } else { + if (!this.timer && this.num === null) { + this.setTime(); + } + } }, }, @@ -63,8 +70,9 @@ export default { if (this.rfidMessage && this.rfidMessage.step) { this.setLight(this.rfidMessage.step); } else { - this.setLight(); + this.setTime(); } + // this.setTime(); // this.changePage(); }, @@ -82,9 +90,10 @@ export default { // 定时高亮 setTime() { let i = 0; - this.t = setInterval(() => { + this.timer = setInterval(() => { this.lists.forEach((element, j) => { if (j === i) { + // debugger; element.active = true; // 翻页 for (let a = 0; a < this.newArr.length; a++) { @@ -118,26 +127,25 @@ export default { // 收到消息高亮 setLight(step) { - if (step) { - clearInterval(this.t); - this.lists.forEach((element, j) => { - if (element.code === step) { - element.active = true; - // 翻页 - for (let a = 0; a < this.newArr.length; a++) { - const arr = this.newArr[a]; - const item = arr.find(item => item.name === element.name); - if (item) { - this.num = a; - } + if (this.timer) { + clearInterval(this.timer); + this.timer = null; + } + this.lists.forEach((element, j) => { + if (element.code === step) { + element.active = true; + // 翻页 + for (let a = 0; a < this.newArr.length; a++) { + const arr = this.newArr[a]; + const item = arr.find(item => item.name === element.name); + if (item) { + this.num = a; } - } else { - element.active = false; } - }); - } else { - this.setTime(); - } + } else { + element.active = false; + } + }); }, }, }; diff --git a/src/mixins/socket.js b/src/mixins/socket.js index 4195671..4d950a1 100644 --- a/src/mixins/socket.js +++ b/src/mixins/socket.js @@ -76,6 +76,7 @@ const mixin = { break; case 2: // RFID this.messagesAddRfid(data.data); + console.log('data.data: ', data.data); break; case 3: // 称重传感器一 this.messagesAddWeighSensor1(data.data.value);