<template>
	<div>
		<common @asynCallBack="asynCallBack"></common>
		<top-header :pageTitle="pageTitle" :rightLink="rightLink" :doRightLink="doRightLink"></top-header>

		<div class="mui-content margin60">
			<div class="vongi-qingjiadt">
				<div class="mui-content-padded">
					<h5 class="flew-sp">监测频率<span>分钟</span></h5>
				</div>
				<form class="mui-input-group">
					<div class="mui-input-row">
						<label>监测频率</label>
						<input type="number" v-model="detail.frequency" />
					</div>
				</form>
			</div>
			<div class="vongi-qingjiadt">
				<div class="mui-content-padded">
					<h5 class="flew-sp">血压设置<span>毫米汞柱㎜Hg</span></h5>
				</div>
				<form class="mui-input-group">
					<div class="mui-input-row">
						<label>低压最小值</label>
						<input type="number" v-model="detail.bpLowMin" />
					</div>
					<div class="mui-input-row">
						<label>低压最大值</label>
						<input type="number" v-model="detail.bpLowMax" />
					</div>
					<div class="mui-input-row">
						<label>高压最小值</label>
						<input type="number" v-model="detail.bpHighMin" />
					</div>
					<div class="mui-input-row">
						<label>高压最大值</label>
						<input type="number" v-model="detail.bpHighMax" />
					</div>
				</form>
			</div>
			<div class="vongi-qingjiadt">
				<div class="mui-content-padded">
					<h5 class="flew-sp">心率设置<span>次/分钟</span></h5>
				</div>
				<form class="mui-input-group">
					<div class="mui-input-row">
						<label>最小值</label>
						<input type="number" v-model="detail.heartRateMin" />
					</div>
					<div class="mui-input-row">
						<label>最大值</label>
						<input type="number" v-model="detail.heartRateMax" />
					</div>
				</form>
			</div>
			<div class="vongi-qingjiadt">
				<div class="mui-content-padded">
					<h5 class="flew-sp">血氧设置<span>饱和度%</span></h5>
				</div>
				<form class="mui-input-group">
					<div class="mui-input-row">
						<label>最小值</label>
						<input type="number" v-model="detail.bloodOxMin" />
					</div>
					<div class="mui-input-row">
						<label>最大值</label>
						<input type="number" v-model="detail.bloodOxMax" />
					</div>
				</form>
			</div>
			<div class="vongi-qingjiadt">
				<div class="mui-content-padded">
					<h5 class="flew-sp">体温设置<span>摄氏度℃</span></h5>
				</div>
				<form class="mui-input-group">
					<div class="mui-input-row">
						<label>最小值</label>
						<input type="number" v-model="detail.tempMin" />
					</div>
				</form>
			</div>
		</div>
		<div class="fyy-footer">
			<div class="bindfyy-btn" @click="submit"><button type="submit" class="mui-btn mui-btn-pink ">提 交</button></div>
		</div>

		<loading :visible="isLoading"></loading>
	</div>
</template>

<script>
	import * as API_Health from '@/apis/Master/health'
	import Common from '$project/components/Common.vue'
	import Loading from '$project/components/Loading.vue'
	import TopHeader from '$project/components/TopHeader.vue'
	import NavMenu from '@/components/NavMenu.vue'
	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	export default {
		name: 'MasterHealthWarningSet',
		components: {
			Common,
			Loading,
			TopHeader,
			NavMenu
		},
		data() {
			return {
				isLoading: false,

				pageTitle: '预警参数',

				detail: {
					frequency: '',
					bpLowMin: '',
					bpLowMax: '',
					bpHighMin: '',
					bpHighMax: '',
					heartRateMin: '',
					heartRateMax: '',
					bloodOxMin: '',
					bloodOxMax: '',
					tempMin: ''
				},

				rightLink: {
					show: true,
					icon: '',
					style: 'font-size:14px;color:#000;',
					//title: '清空设置'
				},
			}
		},
		created() {},
		methods: {
			//获取手环数据
			getDetail() {
				this.isLoading = true;
				API_Health.getWarningConfig().then(response => {
					this.isLoading = false;

					this.detail = response;

				}).catch(error => {
					this.isLoading = false;
					mui.toast(error);
				})
			},
			//提交
			submit() {
				this.isLoading = true;
				API_Health.setWarningConfig(this.detail).then(response => {
					this.isLoading = false;

					mui.toast('提交成功');
					this.$router.go(-1);

				}).catch(error => {
					this.isLoading = false;
					mui.toast(error);
				})
			},
			doRightLink() {

			},
			asynCallBack() {},
		},
		mounted() {
			//获取手环数据
			this.getDetail();
		},
		destroyed() {

		},
		computed: {
			...mapGetters({
				openId: 'wx_openid',
				token: 'token',
				person_data: 'person_data',
				person_popedom: 'person_popedom',
				menu_list: 'menu_list',
				common_menu_list: 'common_menu_list',
				persion_home_model: 'persion_home_model'
			})
		}
	}
</script>

<style scoped src="$project/assets/css/pension.css"></style>
<style scoped src="$project/assets/css/xpwyfyy.css"></style>
<style src="$project/assets/css/iconfont.css"></style>
<style scoped>
	.vongi-qingjiadt input[type="number"] {
		text-align: right;
	}
</style>
