Browse Source

rfid bug

master
lucky 5 years ago
parent
commit
b75f865c9c
  1. 16
      src/components/Panel/Panel.vue
  2. 34
      src/components/RFID/RFID.vue
  3. 1
      src/mixins/socket.js

16
src/components/Panel/Panel.vue

@ -28,9 +28,20 @@
<a-icon class="down-icon" type="caret-down" /> <a-icon class="down-icon" type="caret-down" />
</span> </span>
</div> </div>
<a-progress :percent="percent" :show-info="false" :stroke-color="strokeColor" :stroke-width="strokeWidth" status="active" /> <a-progress
:percent="percent"
:show-info="false"
:stroke-color="strokeColor"
:stroke-width="strokeWidth"
status="active"
/>
<div class="flex-1" style="width: 106%; margin-left: -3%"> <div class="flex-1" style="width: 106%; margin-left: -3%">
<div class="flex-1" style="justify-content: center" v-for="(item, index) in lists" :key="index">{{ item }}</div> <div
:key="index"
class="flex-1"
style="justify-content: center"
v-for="(item, index) in lists"
>{{ item }}</div>
</div> </div>
</div> </div>
</div> </div>
@ -77,7 +88,6 @@ export default {
computed: mapState('messages', ['weightMessage', 'bolusDose', 'maintenanceDose', 'thrombolyticDose', 'startMessages', 'rfidMessage']), computed: mapState('messages', ['weightMessage', 'bolusDose', 'maintenanceDose', 'thrombolyticDose', 'startMessages', 'rfidMessage']),
watch: { watch: {
rfidMessage(val) { rfidMessage(val) {
console.log(val);
if (this.startMessages) { if (this.startMessages) {
this.percent = 0; this.percent = 0;
this.percentA = 0; this.percentA = 0;

34
src/components/RFID/RFID.vue

@ -37,8 +37,8 @@ export default {
{ code: '25', active: false, name: '专用电梯(四楼)' }, { code: '25', active: false, name: '专用电梯(四楼)' },
{ code: '26', active: false, name: 'CCU导管室' }, { code: '26', active: false, name: 'CCU导管室' },
], ],
num: 0, //div num: null, //div
t: null, timer: null,
}; };
}, },
@ -51,11 +51,18 @@ export default {
}, },
watch: { watch: {
rfidMessage: { rfidMessage(value) {
handler(value) { if (value && value.step) {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
this.setLight(value.step); this.setLight(value.step);
}, } else {
deep: true, if (!this.timer && this.num === null) {
this.setTime();
}
}
}, },
}, },
@ -63,8 +70,9 @@ export default {
if (this.rfidMessage && this.rfidMessage.step) { if (this.rfidMessage && this.rfidMessage.step) {
this.setLight(this.rfidMessage.step); this.setLight(this.rfidMessage.step);
} else { } else {
this.setLight(); this.setTime();
} }
// this.setTime();
// this.changePage(); // this.changePage();
}, },
@ -82,9 +90,10 @@ export default {
// //
setTime() { setTime() {
let i = 0; let i = 0;
this.t = setInterval(() => { this.timer = setInterval(() => {
this.lists.forEach((element, j) => { this.lists.forEach((element, j) => {
if (j === i) { if (j === i) {
// debugger;
element.active = true; element.active = true;
// //
for (let a = 0; a < this.newArr.length; a++) { for (let a = 0; a < this.newArr.length; a++) {
@ -118,8 +127,10 @@ export default {
// //
setLight(step) { setLight(step) {
if (step) { if (this.timer) {
clearInterval(this.t); clearInterval(this.timer);
this.timer = null;
}
this.lists.forEach((element, j) => { this.lists.forEach((element, j) => {
if (element.code === step) { if (element.code === step) {
element.active = true; element.active = true;
@ -135,9 +146,6 @@ export default {
element.active = false; element.active = false;
} }
}); });
} else {
this.setTime();
}
}, },
}, },
}; };

1
src/mixins/socket.js

@ -76,6 +76,7 @@ const mixin = {
break; break;
case 2: // RFID case 2: // RFID
this.messagesAddRfid(data.data); this.messagesAddRfid(data.data);
console.log('data.data: ', data.data);
break; break;
case 3: // 称重传感器一 case 3: // 称重传感器一
this.messagesAddWeighSensor1(data.data.value); this.messagesAddWeighSensor1(data.data.value);

Loading…
Cancel
Save