Browse Source

Merge branch 'master' of dd.tall.wiki:binbin0314/salt-lake-hospital

master
lucky 5 years ago
parent
commit
e60c98d5de
  1. 67
      src/components/Panel/Panel.vue
  2. 21
      src/components/Sensor/Sensor.js
  3. 13
      src/components/Sensor/Sensor.vue
  4. 12
      src/mixins/socket.js
  5. 4
      src/views/BtnPage/BtnPage.vue
  6. 7
      src/views/Index/Index.vue

67
src/components/Panel/Panel.vue

@ -24,24 +24,13 @@
<div style="width: 95%; padding-left: 5%"> <div style="width: 95%; padding-left: 5%">
<div style="width: 120%"> <div style="width: 120%">
<span :style="{ marginLeft: percentA }" class="tips"> <span :style="{ marginLeft: percentA }" class="tips">
123 {{ info }}
<a-icon class="down-icon" type="caret-down" /> <a-icon class="down-icon" type="caret-down" />
</span> </span>
</div> </div>
<a-progress <a-progress :percent="percent" :show-info="false" :stroke-color="strokeColor" :stroke-width="strokeWidth" status="active" />
: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 <div class="flex-1" style="justify-content: center" v-for="(item, index) in lists" :key="index">{{ item }}</div>
:key="index"
class="flex-1"
style="justify-content: center"
v-for="(item, index) in lists"
>{{ item }}</div>
</div> </div>
</div> </div>
</div> </div>
@ -49,7 +38,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'; import { mapState, mapMutations } from 'vuex';
export default { export default {
name: 'Panel', name: 'Panel',
data() { data() {
@ -82,21 +71,49 @@ export default {
'解脱', '解脱',
'结束', '结束',
], ],
info: '呼叫',
}; };
}, },
computed: mapState('messages', ['weightMessage', 'bolusDose', 'maintenanceDose', 'thrombolyticDose']), computed: mapState('messages', ['weightMessage', 'bolusDose', 'maintenanceDose', 'thrombolyticDose', 'startMessages', 'rfidMessage']),
mounted() { watch: {
const that = this; rfidMessage(val) {
var add = setInterval(function() { console.log(val);
if (that.percent === 100) { if (this.startMessages) {
that.percent = 0; this.percent = 0;
that.percentA = 0; this.percentA = 0;
this.info = '呼叫';
this.setStartMessages(false);
} else { } else {
that.percent += 100 / 16; if (val.step && val.step - 0 > (this.percent * 16) / 100 && val.step - 0 <= 16) {
that.percentA = (that.percent * 100) / 120 + '%'; console.log(val.step - 0, this.percent);
this.percent = ((val.step - 0) * 100) / 16;
this.percentA = (this.percent * 100) / 120 + '%';
this.info = this.lists[val.step - 0];
} }
}, 1000); }
},
startMessages(val) {
if (val) {
this.percent = 0;
this.percentA = 0;
this.info = '呼叫';
this.setStartMessages(false);
}
},
}, },
methods: { ...mapMutations('messages', ['setStartMessages']) },
// mounted() {
// const that = this;
// var add = setInterval(function() {
// if (that.percent === 100) {
// that.percent = 0;
// that.percentA = 0;
// } else {
// that.percent += 100 / 16;
// that.percentA = (that.percent * 100) / 120 + '%';
// }
// }, 1000);
// },
}; };
</script> </script>

21
src/components/Sensor/Sensor.js

@ -2,16 +2,14 @@ import { mapState } from 'vuex';
const mixin = { const mixin = {
data() { data() {
return { return {
series1: [10, 20, 30, 10, 20, 30, 10, 20, 30], // 传感器1 series1: [10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30], // 传感器1
series2: [20, 30, 10, 20, 30, 10, 20, 30, 10], // 传感器2 series2: [20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10], // 传感器2
series3: [30, 10, 20, 30, 10, 20, 30, 10, 20], // 传感器3 series3: [30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20, 30, 10, 20], // 传感器3
}; };
}, },
computed: { computed: {
...mapState('messages', ['vibrationSensor']), ...mapState('messages', ['vibrationSensor']),
option() { option() {
// const that = this;
console.log('series1', this.series1, this.vibrationSensor);
return { return {
legend: { legend: {
x: 'center', x: 'center',
@ -25,6 +23,8 @@ const mixin = {
xAxis: { xAxis: {
type: 'category', type: 'category',
boundaryGap: false, boundaryGap: false,
max: this.series1.length >= 6 ? this.series1.length - 1 : 6,
min: this.series1.length >= 6 ? this.series1.length - 6 : 0,
axisLine: { axisLine: {
//y轴 //y轴
show: false, show: false,
@ -51,7 +51,6 @@ const mixin = {
show: false, show: false,
}, },
}, },
series: [ series: [
{ {
name: '传感器1', name: '传感器1',
@ -154,15 +153,7 @@ const mixin = {
}; };
}, },
}, },
watch: { watch: {},
vibrationSensor(val) {
var vibList = val.split(',');
this.series1 = this.series1.concat(parseInt(vibList[0]));
this.series2 = this.series1.concat(parseInt(vibList[1]));
this.series3 = this.series1.concat(parseInt(vibList[2]));
console.log('vibrationSensor:', val);
},
},
}; };
export default mixin; export default mixin;

13
src/components/Sensor/Sensor.vue

@ -16,6 +16,19 @@ export default {
height: '', height: '',
}; };
}, },
watch: {
vibrationSensor(val) {
console.log(val.value);
if (val.type === 7) {
var vibList = val.value.split(',');
this.series1 = this.series1.concat(parseInt(vibList[0]));
this.series2 = this.series2.concat(parseInt(vibList[1]));
this.series3 = this.series3.concat(parseInt(vibList[2]));
this.drawLine();
}
console.log(this.series1, this.series2, this.series3);
},
},
mounted() { mounted() {
this.drawLine(); this.drawLine();
let wh = window.innerWidth; let wh = window.innerWidth;

12
src/mixins/socket.js

@ -45,6 +45,7 @@ const mixin = {
socket.onclose = this.websocketClose; socket.onclose = this.websocketClose;
socket.onerror = this.websocketError; socket.onerror = this.websocketError;
} else { } else {
// @ts-ignore
this.$message.error('当前浏览器不支持 websocket'); this.$message.error('当前浏览器不支持 websocket');
} }
lockSocket = false; lockSocket = false;
@ -70,6 +71,7 @@ const mixin = {
case 1: // 体重 case 1: // 体重
// 收到同步消息 // 收到同步消息
// 把消息添加到store 的消息栈中 // 把消息添加到store 的消息栈中
this.setStartMessages(true);
this.messagesAddWeight(data.data.value); this.messagesAddWeight(data.data.value);
break; break;
case 2: // RFID case 2: // RFID
@ -109,7 +111,15 @@ const mixin = {
break; break;
} }
}, },
/**
*
* data:{
* data: {
* value: ''
* },
* type: '',
* }
*/
/** /**
* 收到ws 消息 * 收到ws 消息
* @param {object} res 收到的消息数据 * @param {object} res 收到的消息数据

4
src/views/BtnPage/BtnPage.vue

@ -1,6 +1,6 @@
<template> <template>
<div class="wrap"> <div class="wrap">
<a-button type="primary" @click="sendData(20)">开始</a-button> <a-button type="primary" @click="sendData(20)">呼叫</a-button>
<a-button type="primary" v-for="(item, index) in nameList" :key="index" @click="sendData(index)"> {{ item.name }} </a-button> <a-button type="primary" v-for="(item, index) in nameList" :key="index" @click="sendData(index)"> {{ item.name }} </a-button>
<a-button type="primary" @click="sendData(21)">震动传感器</a-button> <a-button type="primary" @click="sendData(21)">震动传感器</a-button>
<a-button type="primary" @click="sendData(25)">药物剂量</a-button> <a-button type="primary" @click="sendData(25)">药物剂量</a-button>
@ -107,7 +107,7 @@ export default {
param: { param: {
authId: '1', authId: '1',
type: '7', type: '7',
value: '10,20,10', value: '10,20,30',
time: new Date().getTime(), time: new Date().getTime(),
}, },
}; };

7
src/views/Index/Index.vue

@ -50,11 +50,8 @@
</div> </div>
</div> </div>
</div> </div>
<div class="flex-2 ma-2" style="position:relative"> <div class="flex-2 ma-2" style="position: relative">
<iframe <iframe class="fill-width fill-height" src="https://www.thingjs.com/pp/6dab0a018283ef357a85684c"></iframe>
class="fill-width fill-height"
src="https://www.thingjs.com/pp/6dab0a018283ef357a85684c"
></iframe>
<!-- 地图 --> <!-- 地图 -->
<shanxi-map class="sxmap" /> <shanxi-map class="sxmap" />
<!-- 视频 --> <!-- 视频 -->

Loading…
Cancel
Save