examTeamApp/components/manuallyAdd/lungAdd.vue

137 lines
3.0 KiB
Vue

<template>
<view class="wrapper">
<view class="bg" @click="onTap">
<view class="edit" @click.stop>
<view class="title">手动记录</view>
<!-- -->
<view class="editem" @click="hideKeyboard">
<view class="left">日期</view>
<view class="right">
<uni-datetime-picker type="datetime" @change="changeLog" :border="false" :end="endDate"
:clear-icon='false' :hide-second='true' />
</view>
</view>
<view class="">
<view class="editem">
<view class="name">第一次</view>
<view class="right">
<input type="digit" v-model="number1" placeholder="请输入">ml
</view>
</view>
<view class="editem">
<view class="name">第二次</view>
<view class="right">
<input type="digit" v-model="number2" placeholder="请输入">ml
</view>
</view>
<view class="editem">
<view class="name">第三次</view>
<view class="right">
<input type="digit" v-model="number3" placeholder="请输入">ml
</view>
</view>
</view>
<view class="btn close" @click="onTap()">取消</view>
<view class="btn" @click="handleTarget">确定</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from "vuex";
export default {
data() {
return {
regTime: "",
number1: '',
number2: "",
number3: ""
}
},
computed: {
...mapState(["user"]),
endDate() {
return this.$tools.getDate("start")
},
},
methods: {
// 手动记录
handleTarget() {
let that = this
if (!that.regTime) {
that.$tools.msg("请选择测量日期")
return
}
if (!that.number1) {
that.$tools.msg("请输入第一次吸气值")
return
}
if (!that.number2) {
that.$tools.msg("请输入第二次吸气值")
return
}
if (!that.number3) {
that.$tools.msg("请输入第三次吸气值")
return
}
that.$model.getLungmeasure({
aud_id: uni.getStorageSync('userid'),
time: that.regTime,
one: that.number1,
two: that.number2,
three: that.number3
}).then(res => {
if (res.code != 0) return
that.$tools.msg(res.msg)
that.$store.commit("changeRecord", false);
that.$store.dispatch("getUserInfo", {
aud_id: uni.getStorageSync('userid')
})
that.$store.dispatch("getLungResult", {
aud_id: uni.getStorageSync('userid')
})
this.regTime = ""
this.number1 = ""
this.number2 = ""
this.number3 = ""
})
},
//
changeLog(e) {
this.regTime = e
},
onTap() {
this.regTime = ""
this.number1 = ""
this.number2 = ""
this.number3 = ""
this.$store.commit("changeRecord", false);
},
hideKeyboard() {
uni.hideKeyboard()
},
}
}
</script>
<style scoped lang="scss">
.btn {
width: 40%;
float: right;
margin-top: 15px;
background: $maincolor !important;
}
.edit {
top: 20%
}
.close {
background: #fff !important;
float: left;
color: #333;
}
</style>