13 changed files with 429 additions and 206 deletions
@ -1,107 +1,165 @@ |
|||||
var option = { |
import { mapState } from 'vuex'; |
||||
legend: { |
const mixin = { |
||||
x: 'center', |
data() { |
||||
y: 'top', |
return { |
||||
data: ['传感器1', '传感器2'], |
series1: [10, 20, 30, 10, 20, 30, 10, 20, 30], // 传感器1
|
||||
textStyle: { |
series2: [20, 30, 10, 20, 30, 10, 20, 30, 10], // 传感器2
|
||||
fontWeight: 'normal', |
series3: [30, 10, 20, 30, 10, 20, 30, 10, 20], // 传感器3
|
||||
color: '#ccc', //标题颜色
|
}; |
||||
}, |
|
||||
}, |
|
||||
xAxis: { |
|
||||
type: 'category', |
|
||||
boundaryGap: false, |
|
||||
axisLine: { |
|
||||
//y轴
|
|
||||
show: false, |
|
||||
}, |
|
||||
}, |
|
||||
yAxis: { |
|
||||
show: true, |
|
||||
type: 'value', |
|
||||
splitLine: { show: false }, //去除网格线
|
|
||||
nameTextStyle: { |
|
||||
color: '#abb8ce', |
|
||||
show: false, |
|
||||
}, |
|
||||
axisLabel: { |
|
||||
color: '#abb8ce', |
|
||||
show: false, |
|
||||
}, |
|
||||
axisTick: { |
|
||||
//y轴刻度线
|
|
||||
show: false, |
|
||||
}, |
|
||||
axisLine: { |
|
||||
//y轴
|
|
||||
show: false, |
|
||||
}, |
|
||||
}, |
}, |
||||
series: [ |
computed: { |
||||
{ |
...mapState('messages', ['vibrationSensor']), |
||||
name: '传感器1', |
option() { |
||||
data: [320, 932, 401, 834, 290, 530, 620], |
return { |
||||
type: 'line', |
legend: { |
||||
smooth: true, |
x: 'center', |
||||
symbol: 'none', |
y: '8%', |
||||
itemStyle: { |
data: ['传感器1', '传感器2', '传感器3'], |
||||
color: { |
textStyle: { |
||||
type: 'linear', |
fontWeight: 'normal', |
||||
x: 0, |
color: '#ccc', //标题颜色
|
||||
y: 0, |
}, |
||||
x2: 0, |
}, |
||||
y2: 1, |
xAxis: { |
||||
colorStops: [ |
type: 'category', |
||||
{ |
boundaryGap: false, |
||||
offset: 0, |
axisLine: { |
||||
color: 'rgba(10,73,130,1)', // 0% 处的颜色
|
//y轴
|
||||
|
show: false, |
||||
|
}, |
||||
|
}, |
||||
|
yAxis: { |
||||
|
show: true, |
||||
|
type: 'value', |
||||
|
splitLine: { show: false }, //去除网格线
|
||||
|
nameTextStyle: { |
||||
|
color: '#abb8ce', |
||||
|
show: false, |
||||
|
}, |
||||
|
axisLabel: { |
||||
|
color: '#abb8ce', |
||||
|
show: false, |
||||
|
}, |
||||
|
axisTick: { |
||||
|
//y轴刻度线
|
||||
|
show: false, |
||||
|
}, |
||||
|
axisLine: { |
||||
|
//y轴
|
||||
|
show: false, |
||||
|
}, |
||||
|
}, |
||||
|
series: [ |
||||
|
{ |
||||
|
name: '传感器1', |
||||
|
data: this.series1, |
||||
|
type: 'line', |
||||
|
smooth: true, |
||||
|
symbol: 'none', |
||||
|
itemStyle: { |
||||
|
color: { |
||||
|
type: 'linear', |
||||
|
x: 0, |
||||
|
y: 0, |
||||
|
x2: 0, |
||||
|
y2: 1, |
||||
|
colorStops: [ |
||||
|
{ |
||||
|
offset: 0, |
||||
|
color: 'rgba(10,73,130,1)', // 0% 处的颜色
|
||||
|
}, |
||||
|
{ |
||||
|
offset: 1, |
||||
|
color: 'rgba(10,73,130,0)', // 100% 处的颜色
|
||||
|
}, |
||||
|
], |
||||
|
global: false, // 缺省为 false
|
||||
|
}, |
||||
}, |
}, |
||||
{ |
areaStyle: {}, |
||||
offset: 1, |
lineStyle: { normal: { color: 'rgb(39,149,243)', width: 2 } }, |
||||
color: 'rgba(10,73,130,0)', // 100% 处的颜色
|
}, |
||||
|
{ |
||||
|
name: '传感器2', |
||||
|
data: this.series2, |
||||
|
type: 'line', |
||||
|
smooth: true, |
||||
|
symbol: 'none', |
||||
|
itemStyle: { |
||||
|
color: { |
||||
|
type: 'linear', |
||||
|
x: 0, |
||||
|
y: 0, |
||||
|
x2: 0, |
||||
|
y2: 1, |
||||
|
colorStops: [ |
||||
|
{ |
||||
|
offset: 0, |
||||
|
color: 'rgba(91,225,251,1)', // 0% 处的颜色
|
||||
|
}, |
||||
|
{ |
||||
|
offset: 1, |
||||
|
color: 'rgba(91,225,251,0)', // 100% 处的颜色
|
||||
|
}, |
||||
|
], |
||||
|
global: false, // 缺省为 false
|
||||
|
}, |
||||
}, |
}, |
||||
], |
areaStyle: {}, |
||||
global: false, // 缺省为 false
|
lineStyle: { |
||||
}, |
normal: { |
||||
}, |
color: 'rgb(91,225,251)', |
||||
areaStyle: {}, |
width: 2, |
||||
lineStyle: { normal: { color: 'rgb(39,149,243)', width: 2 } }, |
}, |
||||
}, |
|
||||
{ |
|
||||
name: '传感器2', |
|
||||
data: [420, 232, 401, 234, 490, 230, 420], |
|
||||
type: 'line', |
|
||||
smooth: true, |
|
||||
symbol: 'none', |
|
||||
itemStyle: { |
|
||||
color: { |
|
||||
type: 'linear', |
|
||||
x: 0, |
|
||||
y: 0, |
|
||||
x2: 0, |
|
||||
y2: 1, |
|
||||
colorStops: [ |
|
||||
{ |
|
||||
offset: 0, |
|
||||
color: 'rgba(91,225,251,1)', // 0% 处的颜色
|
|
||||
}, |
}, |
||||
{ |
}, |
||||
offset: 1, |
{ |
||||
color: 'rgba(91,225,251,0)', // 100% 处的颜色
|
name: '传感器3', |
||||
|
data: this.series3, |
||||
|
type: 'line', |
||||
|
smooth: true, |
||||
|
symbol: 'none', |
||||
|
itemStyle: { |
||||
|
color: { |
||||
|
type: 'linear', |
||||
|
x: 0, |
||||
|
y: 0, |
||||
|
x2: 0, |
||||
|
y2: 1, |
||||
|
colorStops: [ |
||||
|
{ |
||||
|
offset: 0, |
||||
|
color: 'rgba(241,158,194,1)', // 0% 处的颜色
|
||||
|
}, |
||||
|
{ |
||||
|
offset: 1, |
||||
|
color: 'rgba(241,158,194,0)', // 100% 处的颜色
|
||||
|
}, |
||||
|
], |
||||
|
global: false, // 缺省为 false
|
||||
|
}, |
||||
}, |
}, |
||||
], |
areaStyle: {}, |
||||
global: false, // 缺省为 false
|
lineStyle: { |
||||
}, |
normal: { |
||||
}, |
color: 'rgb(241,158,194)', |
||||
areaStyle: {}, |
width: 2, |
||||
lineStyle: { |
}, |
||||
normal: { |
}, |
||||
color: 'rgb(91,225,251)', |
}, |
||||
width: 2, |
], |
||||
}, |
}; |
||||
}, |
}, |
||||
|
}, |
||||
|
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 option; |
export default mixin; |
||||
|
@ -0,0 +1,169 @@ |
|||||
|
<template> |
||||
|
<div class="wrap"> |
||||
|
<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" @click="sendData(21)">震动传感器</a-button> |
||||
|
<a-button type="primary" @click="sendData(25)">药物剂量</a-button> |
||||
|
<a-button type="primary" @click="sendData(26)">团注剂量</a-button> |
||||
|
<a-button type="primary" @click="sendData(27)">维持剂量</a-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { record } from 'config/api'; |
||||
|
export default { |
||||
|
name: 'BtnPage', |
||||
|
data() { |
||||
|
return { |
||||
|
str: '模拟按钮界面', |
||||
|
nameList: [ |
||||
|
{ |
||||
|
name: '分诊区', |
||||
|
value: '01', |
||||
|
}, |
||||
|
{ |
||||
|
name: '急救医生', |
||||
|
value: '0B', |
||||
|
}, |
||||
|
{ |
||||
|
name: '采血车', |
||||
|
value: '0C', |
||||
|
}, |
||||
|
{ |
||||
|
name: 'CT室', |
||||
|
value: '03', |
||||
|
}, |
||||
|
{ |
||||
|
name: '介入室', |
||||
|
value: '05', |
||||
|
}, |
||||
|
{ |
||||
|
name: '平车停放点', |
||||
|
value: '20', |
||||
|
}, |
||||
|
{ |
||||
|
name: '卒中中心门口', |
||||
|
value: '21', |
||||
|
}, |
||||
|
{ |
||||
|
name: '急救大楼门', |
||||
|
value: '22', |
||||
|
}, |
||||
|
{ |
||||
|
name: '抢救室门', |
||||
|
value: '23', |
||||
|
}, |
||||
|
{ |
||||
|
name: '走廊', |
||||
|
value: '24', |
||||
|
}, |
||||
|
{ |
||||
|
name: '心电图室门口', |
||||
|
value: '25', |
||||
|
}, |
||||
|
{ |
||||
|
name: '专用电梯口(一楼)', |
||||
|
value: '26', |
||||
|
}, |
||||
|
{ |
||||
|
name: '专用电梯口(四楼)', |
||||
|
value: '27', |
||||
|
}, |
||||
|
{ |
||||
|
name: 'CCU导管室门口', |
||||
|
value: '28', |
||||
|
}, |
||||
|
{ |
||||
|
name: '急救护士', |
||||
|
value: '30', |
||||
|
}, |
||||
|
{ |
||||
|
name: '专科医生', |
||||
|
value: '31', |
||||
|
}, |
||||
|
{ |
||||
|
name: '专科护士', |
||||
|
value: '32', |
||||
|
}, |
||||
|
], |
||||
|
}; |
||||
|
}, |
||||
|
methods: { |
||||
|
async sendData(index) { |
||||
|
try { |
||||
|
let params = {}; |
||||
|
console.log(index); |
||||
|
if (index === 20) { |
||||
|
params = { |
||||
|
param: { |
||||
|
authId: '1', |
||||
|
type: '1', |
||||
|
value: '80000', |
||||
|
time: new Date().getTime(), |
||||
|
}, |
||||
|
}; |
||||
|
} else if (index === 21) { |
||||
|
params = { |
||||
|
param: { |
||||
|
authId: '1', |
||||
|
type: '7', |
||||
|
value: '10,20,10', |
||||
|
time: new Date().getTime(), |
||||
|
}, |
||||
|
}; |
||||
|
} else if (index === 25) { |
||||
|
params = { |
||||
|
param: { |
||||
|
authId: '1', |
||||
|
type: '8', |
||||
|
value: '50.2', |
||||
|
time: new Date().getTime(), |
||||
|
}, |
||||
|
}; |
||||
|
} else if (index === 26) { |
||||
|
params = { |
||||
|
param: { |
||||
|
authId: '1', |
||||
|
type: '9', |
||||
|
value: '6.4', |
||||
|
time: new Date().getTime(), |
||||
|
}, |
||||
|
}; |
||||
|
} else if (index === 27) { |
||||
|
params = { |
||||
|
param: { |
||||
|
authId: '1', |
||||
|
type: '10', |
||||
|
value: '60.1', |
||||
|
time: new Date().getTime(), |
||||
|
}, |
||||
|
}; |
||||
|
} else if (index < 20) { |
||||
|
params = { |
||||
|
param: { |
||||
|
authId: '1', |
||||
|
type: '2', |
||||
|
value: this.nameList[index].value, |
||||
|
time: new Date().getTime(), |
||||
|
}, |
||||
|
}; |
||||
|
} |
||||
|
const res = await record(params); |
||||
|
const { msg, data, code } = res.data; |
||||
|
console.log('data:' + data); |
||||
|
} catch (error) { |
||||
|
console.log(error); |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="stylus" scoped> |
||||
|
.wrap { |
||||
|
button { |
||||
|
margin: 10px; |
||||
|
flex: 0 0 8%; |
||||
|
} |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue