xinelu-applet-ui/pagesC/healthdata/healthdata.vue

240 lines
6.9 KiB
Vue
Raw Permalink Normal View History

2023-10-19 15:49:55 +08:00
<template>
<view class="app">
<u-tabs :list="tabList" :current="tabindex" @change="tabchange" active-color='#26A888'
:show-bar='false'></u-tabs>
<view class="content">
<view v-if="tabindex == 0">
2024-02-21 17:05:58 +08:00
<blood-sugar :current="tabindex" :echartData="list" @taptimeindex='taptimeindex' :tablelist='tablelist'
2023-10-19 15:49:55 +08:00
v-on:websocket-message="handleWebSocketMessage"></blood-sugar>
</view>
<view v-if="tabindex == 1">
<blood-pressure :tablelist='tablelist' @tapdeviceUser='tapdeviceUser' :current="tabindex"
:echartData="list" @taptimeindex='taptimeindex'
v-on:websocket-message="handleWebSocketMessage"></blood-pressure>
2023-10-19 15:49:55 +08:00
</view>
2023-10-20 14:20:18 +08:00
<view v-if="tabindex == 2">
2024-02-21 17:05:58 +08:00
<BloodFat :current="tabindex" :echartData="list" @taptimeindex='taptimeindex' :tablelist='tablelist'
2023-10-20 14:20:18 +08:00
v-on:websocket-message="handleWebSocketMessage"></BloodFat>
</view>
<view v-if="tabindex == 3">
2024-02-21 17:05:58 +08:00
<BMI :current="tabindex" :echartData="list" @taptimeindex='taptimeindex' :tablelist='tablelist'
2023-10-20 14:20:18 +08:00
v-on:websocket-message="handleWebSocketMessage"></BMI>
</view>
<view v-if="tabindex == 4">
2024-02-21 17:05:58 +08:00
<Blood-oxygen :current="tabindex" :echartData="list" @taptimeindex='taptimeindex' :tablelist='tablelist'
2023-10-20 14:20:18 +08:00
v-on:websocket-message="handleWebSocketMessage"></Blood-oxygen>
</view>
<view v-if="tabindex == 5">
2024-02-21 17:05:58 +08:00
<Heart-rate :current="tabindex" :echartData="list" @taptimeindex='taptimeindex' :tablelist='tablelist'
@tapdeviceUser='tapdeviceUser' v-on:websocket-message="handleWebSocketMessage"></Heart-rate>
2023-10-20 14:20:18 +08:00
</view>
2023-10-19 15:49:55 +08:00
<view v-if="tabindex == 6">
2024-02-21 17:05:58 +08:00
<Temperature :current="tabindex" :echartData="list" @taptimeindex='taptimeindex' :tablelist='tablelist'
2023-10-20 14:20:18 +08:00
v-on:websocket-message="handleWebSocketMessage"></Temperature>
2023-10-19 15:49:55 +08:00
</view>
2024-05-15 10:08:22 +08:00
<view v-if="tabindex == 7">
<Dynamicbloodpressure :tablelist='tablelist' @tapdeviceUser='tapdeviceUser' :current="tabindex"
:echartData="list" @taptimeindex='taptimeindex' v-on:websocket-message="handleWebSocketMessage">
</Dynamicbloodpressure>
</view>
2023-10-19 15:49:55 +08:00
</view>
</view>
</template>
<script>
import {
2024-02-21 17:05:58 +08:00
record,
getList
2023-10-19 15:49:55 +08:00
} from '@/api/pagesC/healthdata/index.js'
2024-02-03 10:21:02 +08:00
import BloodPressure from '../BloodPressure/BloodPressure.vue'
import BloodSugar from '../BloodSugar/BloodSugar.vue'
import Temperature from '../Temperature/Temperature.vue'
import BloodFat from '../BloodFat/BloodFat.vue'
import BMI from '../BMI/BMI.vue'
import BloodOxygen from '../BloodOxygen/BloodOxygen.vue'
import HeartRate from '../HeartRate/HeartRate.vue'
2024-05-15 10:08:22 +08:00
import Dynamicbloodpressure from '../Dynamicbloodpressure/Dynamicbloodpressure.vue'
2023-10-19 15:49:55 +08:00
export default {
components: {
BloodPressure,
BloodSugar,
2023-10-20 14:20:18 +08:00
Temperature,
BloodFat,
BMI,
BloodOxygen,
2024-05-15 10:08:22 +08:00
HeartRate,
Dynamicbloodpressure
2023-10-19 15:49:55 +08:00
},
data() {
return {
tabindex: 0,
tabList: [{
name: '血糖',
}, {
name: '血压',
}, {
name: '血脂',
}, {
name: 'BMI',
}, {
name: '血氧',
}, {
name: '心率',
}, {
name: '体温',
2024-05-15 10:08:22 +08:00
}, {
name: '动态血压',
2023-10-19 15:49:55 +08:00
}, ],
list: null,
type: 0,
deviceUser: '',
2024-02-21 17:05:58 +08:00
tabletotal: 0,
tablelist: [],
pageNum: 1,
2023-10-19 15:49:55 +08:00
};
},
onLoad(options) {
this.tabindex = options.index
},
onShow() {
this.info();
2024-02-21 17:05:58 +08:00
this.getinfo();
2023-10-19 15:49:55 +08:00
},
methods: {
tapdeviceUser(e) {
this.deviceUser = e
this.info()
this.getinfo();
},
2023-10-19 15:49:55 +08:00
taptimeindex(e) {
this.type = e
this.info()
2024-02-21 17:05:58 +08:00
this.getinfo();
2023-10-19 15:49:55 +08:00
},
info() {
let userinfo = uni.getStorageSync('userinfo');
var obj
2024-05-15 16:59:45 +08:00
if (this.tabindex == 1 || this.tabindex == 5 || this.tabindex == 7) {
obj = {
label: Number(this.tabindex) + 1,
identity: userinfo.cardNo,
type: this.type,
deviceUsers: this.deviceUser,
}
} else {
obj = {
label: Number(this.tabindex) + 1,
identity: userinfo.cardNo,
type: this.type,
}
2023-10-19 15:49:55 +08:00
}
record(obj).then(res => {
this.list = res.data
2024-02-21 11:47:29 +08:00
this.list.list.forEach(e => {
e.bucket == '1' ? e.timename = '凌晨' : ''
e.bucket == '2' ? e.timename = '早餐前' : ''
e.bucket == '3' ? e.timename = '早晨后' : ''
e.bucket == '4' ? e.timename = '午餐前' : ''
e.bucket == '5' ? e.timename = '午餐后' : ''
e.bucket == '6' ? e.timename = '晚餐前' : ''
e.bucket == '7' ? e.timename = '晚餐后' : ''
e.bucket == '8' ? e.timename = '睡前' : ''
})
2023-10-19 15:49:55 +08:00
})
},
2024-02-21 17:05:58 +08:00
getinfo() {
this.tablelist = []
this.tabletotal = 0
this.pageNum = 1
let userinfo = uni.getStorageSync('userinfo');
var obj
2024-05-15 16:59:45 +08:00
if (this.tabindex == 1 || this.tabindex == 5 || this.tabindex == 7) {
obj = {
label: Number(this.tabindex) + 1,
identity: userinfo.cardNo,
type: this.type,
deviceUsers: this.deviceUser,
pageNum: this.pageNum,
pageSize: 15,
}
} else {
obj = {
label: Number(this.tabindex) + 1,
identity: userinfo.cardNo,
type: this.type,
pageNum: this.pageNum,
pageSize: 15,
}
2024-02-21 17:05:58 +08:00
}
getList(obj).then(res => {
this.tablelist = res.data.list.list
this.tabletotal = res.data.list.total
this.tablelist.forEach(e => {
e.bucket == '1' ? e.timename = '凌晨' : ''
e.bucket == '2' ? e.timename = '早餐前' : ''
e.bucket == '3' ? e.timename = '早晨后' : ''
e.bucket == '4' ? e.timename = '午餐前' : ''
e.bucket == '5' ? e.timename = '午餐后' : ''
e.bucket == '6' ? e.timename = '晚餐前' : ''
e.bucket == '7' ? e.timename = '晚餐后' : ''
e.bucket == '8' ? e.timename = '睡前' : ''
})
})
},
2023-10-19 15:49:55 +08:00
tabchange(e) {
2024-02-22 10:25:07 +08:00
this.type = 0
this.deviceUser = ''
2023-10-19 15:49:55 +08:00
this.list = null
this.tabindex = e
setTimeout(() => {
this.info();
2024-02-21 17:05:58 +08:00
this.getinfo();
2023-10-19 15:49:55 +08:00
}, 1000)
},
2024-02-21 11:47:29 +08:00
},
onReachBottom() { //下滑加载
2024-02-21 17:05:58 +08:00
if (this.tablelist.length >= this.tabletotal) {} else {
this.pageNum++;
let userinfo = uni.getStorageSync('userinfo');
var obj = {
label: Number(this.tabindex) + 1,
identity: userinfo.cardNo,
type: this.type,
pageNum: this.pageNum,
pageSize: 15,
}
getList(obj).then(res => {
res.data.list.list.forEach(e => {
e.bucket == '1' ? e.timename = '凌晨' : ''
e.bucket == '2' ? e.timename = '早餐前' : ''
e.bucket == '3' ? e.timename = '早晨后' : ''
e.bucket == '4' ? e.timename = '午餐前' : ''
e.bucket == '5' ? e.timename = '午餐后' : ''
e.bucket == '6' ? e.timename = '晚餐前' : ''
e.bucket == '7' ? e.timename = '晚餐后' : ''
e.bucket == '8' ? e.timename = '睡前' : ''
this.tablelist.push(e)
})
this.tabletotal = res.data.list.total
})
}
2024-02-21 11:47:29 +08:00
},
onPullDownRefresh() { //下拉刷新
2024-02-21 17:05:58 +08:00
this.getinfo();
this.info();
2024-02-21 11:47:29 +08:00
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
2023-10-19 15:49:55 +08:00
}
</script>
<style lang="scss">
page {
background-color: #F7F5F5;
}
::v-deep .u-tabs {
background-color: #F7F5F5 !important;
}
2024-02-03 10:21:02 +08:00
</style>