examTeamApp/element/manuallyAdd/record.vue

379 lines
10 KiB
Vue
Raw Normal View History

2024-05-29 16:35:45 +08:00
<template>
2024-09-26 09:18:27 +08:00
<view class="wrapper" v-if="isRecord">
<view class="bg" @click="onTap">
<view class="edit" @click.stop>
2025-04-26 13:35:30 +08:00
<view class="title">{{$t("index.manualRecording")}}</view>
2024-09-26 09:18:27 +08:00
<view class="editem">
2025-04-26 13:35:30 +08:00
<view class="left">{{$t('common.titleDate')}}</view>
2024-09-26 09:18:27 +08:00
<view class="right">
2024-10-11 10:04:19 +08:00
<picker mode="date" :end="endDate" @change="changeLog" :fields="fields">
2025-04-26 13:35:30 +08:00
<view class="uni-input">{{regTime?regTime:$t('tips.verifyPicker')}}</view>
2024-09-26 09:18:27 +08:00
<icon class="iconfont icon-arrow-down-bold"></icon>
</picker>
</view>
</view>
<view v-if="rtype!=8&&rtype!=2">
2024-09-26 09:18:27 +08:00
<!-- 项目 -->
<view class="editem" v-if="info&&info.list.length">
2025-04-26 13:35:30 +08:00
<view class="left">{{$t('recordType')}}</view>
2024-09-26 09:18:27 +08:00
<view class="right">
<picker :range="info.list" range-key="name" :value="lableTndex" @change="bindLableChange">
2025-04-26 13:35:30 +08:00
<view class="uni-input">{{name?name:$t('tips.verifyPicker')}}</view>
2024-09-26 09:18:27 +08:00
<icon class="iconfont icon-arrow-down-bold"></icon>
</picker>
</view>
</view>
<!-- 项目时长类型 -->
<view class="editem" v-if="info&&info.list.length&&listType">
2024-09-27 17:35:10 +08:00
<view class="name">{{describe}}</view>
2024-09-26 09:18:27 +08:00
<view class="right" v-if="listType==4">
<picker mode="multiSelector" :range="timeList" :value="timesTndex" @change="bindTimeChange">
2025-04-26 13:35:30 +08:00
<view class="size16">{{time_m?time_m+':':$t('tips.verifyPicker')}}{{time_s?time_s:''}}
</view>
2024-09-26 09:18:27 +08:00
</picker>
<uni-icons type="bottom" class="ml-15 c666"></uni-icons>
</view>
<view class="right" v-if="listType!=4">
2025-04-26 13:35:30 +08:00
<input :type="listType==1?'number':'digit'" v-model="number"
:placeholder="$t('tips.verifyRecord')">
2024-09-27 17:35:10 +08:00
{{unit}}
2024-09-26 09:18:27 +08:00
</view>
</view>
2024-09-27 17:35:10 +08:00
<view class="editem" v-if="info&&info.time">
2025-04-26 13:35:30 +08:00
<view class="name">{{$t('recordTime')}}</view>
2024-09-26 09:18:27 +08:00
<view class="right">
<picker mode="multiSelector" :range="timeList" :value="timesTndex" @change="bindTimeChange">
2025-04-26 13:35:30 +08:00
<view class="size16">{{time_m?time_m+':':$t('tips.verifyPicker')}}{{time_s?time_s:''}}
</view>
2024-09-26 09:18:27 +08:00
</picker>
<uni-icons type="bottom" class="ml-15 c666"></uni-icons>
</view>
</view>
2024-09-27 17:35:10 +08:00
<view class="editem" v-if="info&&info.number">
2025-04-26 13:35:30 +08:00
<view class="name">{{$t('recordNumber')}}</view>
2024-09-26 09:18:27 +08:00
<view class="right">
2025-04-26 13:35:30 +08:00
<input type="number" v-model="number" :placeholder="$t('tips.verifyRecord')">{{$t('skip.Number')}}
2024-09-26 09:18:27 +08:00
</view>
</view>
</view>
<!-- 身体 -->
<view class="" v-if="rtype==2">
2024-09-27 17:35:10 +08:00
<view class="editem" v-if="info&&info.height">
2025-04-26 13:35:30 +08:00
<view class="name">{{$t('common.infoHeight')}}</view>
2024-09-26 09:18:27 +08:00
<view class="right">
2025-04-26 13:35:30 +08:00
<input type="digit" v-model="height" :placeholder="$t('tips.verifyRecord')" />cm
2024-09-26 09:18:27 +08:00
</view>
</view>
2024-09-27 17:35:10 +08:00
<view class="editem" v-if="info&&info.weight">
2025-04-26 13:35:30 +08:00
<view class="name">{{$t('common.infoWeight')}}</view>
2024-09-26 09:18:27 +08:00
<view class="right">
2025-04-26 13:35:30 +08:00
<input type="digit" v-model="weight" :placeholder="$t('tips.verifyRecord')">kg
2024-09-26 09:18:27 +08:00
</view>
</view>
<view class="editem" v-if="userInfo.stage=='婴儿'">
2025-04-26 13:35:30 +08:00
<view class="left">{{$t('common.infoHead')}}</view>
<view class="right">
2025-04-26 13:35:30 +08:00
<input v-model="head" type="digit" :placeholder="$t('tips.verifyRecord')" />cm
</view>
</view>
2024-09-26 09:18:27 +08:00
</view>
<!-- 肺活量 -->
<view class="" v-if="rtype==8">
<view class="editem">
2025-04-26 13:35:30 +08:00
<view class="name">{{$t('recordNumberFirst')}}</view>
2024-09-26 09:18:27 +08:00
<view class="right">
2025-04-26 13:35:30 +08:00
<input type="digit" v-model="number1" :placeholder="$t('tips.verifyRecord')">ml
2024-09-26 09:18:27 +08:00
</view>
</view>
<view class="editem">
2025-04-26 13:35:30 +08:00
<view class="name">{{$t('recordNumberSecond')}}</view>
2024-09-26 09:18:27 +08:00
<view class="right">
2025-04-26 13:35:30 +08:00
<input type="digit" v-model="number2" :placeholder="$t('tips.verifyRecord')">ml
2024-09-26 09:18:27 +08:00
</view>
</view>
<view class="editem">
2025-04-26 13:35:30 +08:00
<view class="name">{{$t('recordNumberThird')}}</view>
2024-09-26 09:18:27 +08:00
<view class="right">
2025-04-26 13:35:30 +08:00
<input type="digit" v-model="number3" :placeholder="$t('tips.verifyRecord')">ml
2024-09-26 09:18:27 +08:00
</view>
</view>
</view>
2025-04-26 13:35:30 +08:00
<view class="btn close" @click="onTap()">{{$t("tips.btnSancellation")}}</view>
<view class="btn" @click="handleTarget">{{$t("tips.btnConfirm")}}</view>
2024-09-26 09:18:27 +08:00
</view>
</view>
2024-05-29 16:35:45 +08:00
</view>
</template>
<script>
import {
mapState
} from "vuex";
export default {
props: {
2024-09-27 17:35:10 +08:00
rtype: null,
2024-05-29 16:35:45 +08:00
},
data() {
2024-09-26 09:18:27 +08:00
return {
name: "",
number: '',
regTime: "",
number1: '',
number2: "",
number3: "",
time_m: "",
time_s: "",
weight: "",
height: '',
timeList: [],
lableTndex: 0,
timesTndex: [1, 0],
listType: null,
2024-09-27 17:35:10 +08:00
describe: "",
2024-10-11 10:04:19 +08:00
unit: "",
fields: "",
head: ""
2024-09-26 09:18:27 +08:00
}
2024-05-29 16:35:45 +08:00
},
computed: {
...mapState(["user", "isRecord", "PublicRecord", "labelList"]),
userInfo() {
return this.user
},
2024-09-26 09:18:27 +08:00
info() {
let that = this
2024-09-27 17:35:10 +08:00
let info = {
height: false,
weight: false,
number: false,
time: false,
list: []
}
2024-09-26 09:18:27 +08:00
if (that.PublicRecord.length) {
that.PublicRecord.forEach(ite => {
if (ite.id == that.rtype) {
info = ite
}
})
}
2024-09-27 17:35:10 +08:00
return that.PublicRecord.length ? info : null
2024-09-26 09:18:27 +08:00
},
endDate() {
return this.$tools.getDate("start")
},
startDate() {
return this.$tools.GetDateStr(-90);
},
},
mounted() {
let that = this
that.timeList = that.$tools.gethms()
2024-10-11 10:04:19 +08:00
// #ifdef APP-PLUS
that.fields = "time"
// #endif
// #ifndef APP-PLUS
that.fields = "day"
// #endif
2024-05-29 16:35:45 +08:00
},
methods: {
2024-09-26 09:18:27 +08:00
// 手动记录
handleTarget() {
let that = this
if (that.rtype == 2) {
that.handleinsertmeasure()
} else if (that.rtype == 6) {
that.handleskipmeasure()
} else if (that.rtype == 8) {
that.handleLungmeasure()
} else {
that.handlepublicmeasure()
}
},
// 通用
handlepublicmeasure() {
let that = this
if (!that.name) {
2025-04-26 13:35:30 +08:00
that.$tools.msg(that.$t("tips.verifyRecordType"))
2024-09-26 09:18:27 +08:00
return
}
if (!that.regTime) {
2025-04-26 13:35:30 +08:00
that.$tools.msg(that.$t("tips.verifyDate"))
2024-09-26 09:18:27 +08:00
return
}
if (that.listType == 4 && (!that.time_m || !that.time_s)) {
2025-04-26 13:35:30 +08:00
that.$tools.msg(that.$t("tips.verifyRecordTime"))
2024-09-26 09:18:27 +08:00
return
}
if (that.listType != 4 && !that.number) {
2025-04-26 13:35:30 +08:00
let msg = that.listType == 1 ? that.$t("tips.verifyRecordNumber") : that.$t("tips.verifyRecordTime")
2024-09-26 09:18:27 +08:00
that.$tools.msg(msg)
return
}
let time_m = that.time_m + ':' + that.time_s
that.$model.getpublicmeasure({
acd_id: that.rtype,
name: that.name,
record_time: that.regTime,
data: that.listType == 4 ? time_m : that.number,
aud_id: uni.getStorageSync('userid')
}).then(res => {
if (res.code != 0) return
that.$tools.msg(res.msg)
that.$store.dispatch("getUserInfo", {
aud_id: uni.getStorageSync('userid'),
})
that.$store.dispatch("getPublicContent", {
2024-09-27 17:35:10 +08:00
acd_id: that.rtype,
2024-09-26 09:18:27 +08:00
aud_id: uni.getStorageSync('userid')
})
that.onTap()
})
},
// 肺活量
handleLungmeasure() {
let that = this
if (!that.regTime) {
2025-04-26 13:35:30 +08:00
that.$tools.msg(that.$t("tips.verifyDate"))
2024-09-26 09:18:27 +08:00
return
}
if (!that.number1) {
2025-04-26 13:35:30 +08:00
that.$tools.msg(that.$t("lung.oneNumberTips"))
2024-09-26 09:18:27 +08:00
return
}
if (!that.number2) {
2025-04-26 13:35:30 +08:00
that.$tools.msg(that.$t("lung.twoNumberTips"))
2024-09-26 09:18:27 +08:00
return
}
if (!that.number3) {
2025-04-26 13:35:30 +08:00
that.$tools.msg(that.$t("lung.threeNumberTips"))
2024-09-26 09:18:27 +08:00
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.dispatch("getLungResult", {
aud_id: uni.getStorageSync('userid')
})
that.onTap()
})
},
// 跳绳
handleskipmeasure() {
let that = this
if (!that.regTime) {
2025-04-26 13:35:30 +08:00
that.$tools.msg(that.$t("tips.verifyDate"))
2024-09-26 09:18:27 +08:00
return
}
if (!that.number) {
2025-04-26 13:35:30 +08:00
that.$tools.msg(that.$t("tips.verifyRecordNumber"))
2024-09-26 09:18:27 +08:00
return
}
that.$model.getskipmeasure({
aud_id: uni.getStorageSync('userid'),
num: that.number,
r_time: that.regTime,
time_m: that.time_m,
time_s: that.time_s,
type: "free",
}).then(res => {
if (res.code != 0) return
that.$tools.msg(res.msg)
that.$store.dispatch("getSkipResult", {
aud_id: uni.getStorageSync('userid'),
})
that.onTap()
})
},
// 身体
handleinsertmeasure() {
let that = this
if (!that.regTime) {
2025-04-26 13:35:30 +08:00
that.$tools.msg(that.$t("tips.verifyDate"))
2024-09-26 09:18:27 +08:00
return
}
if (!that.height) {
2025-04-26 13:35:30 +08:00
that.$tools.msg(that.$t("tips.verifyHeight"))
2024-09-26 09:18:27 +08:00
return
}
if (!that.weight) {
2025-04-26 13:35:30 +08:00
that.$tools.msg(that.$t("tips.verifyWeight"))
2024-09-26 09:18:27 +08:00
return
}
that.$model.getinsertmeasure({
aud_id: uni.getStorageSync('userid'),
time: that.regTime,
weight: that.weight,
height: that.height,
2024-12-10 17:27:58 +08:00
head_data: that.head ? that.head : 0
2024-09-26 09:18:27 +08:00
}).then(res => {
if (res.code != 0) return
that.$tools.msg(res.msg)
that.$store.dispatch("getResult", {
aud_id: uni.getStorageSync('userid')
})
that.$store.dispatch("getUserInfo", {
aud_id: uni.getStorageSync('userid')
})
that.onTap()
})
},
bindTimeChange(e) {
let that = this
let m = e.target.value[0]
let s = e.target.value[1]
that.timesTndex = e.target.value
let time_m = Number(that.timeList[0][m].substring(0, 2)) * 60
let time_s = Number(that.timeList[1][s].substring(0, 2))
that.time_m = that.timeList[0][m].substring(0, 2)
that.time_s = that.timeList[1][s].substring(0, 2)
},
bindLableChange(e) {
console.log("e", e)
this.name = this.info.list[e.detail.value].name
this.listType = this.info.list[e.detail.value].type
2024-09-27 17:35:10 +08:00
this.describe = this.info.list[e.detail.value].describe
this.unit = this.info.list[e.detail.value].unit
2024-09-26 09:18:27 +08:00
},
changeLog(e) {
this.regTime = e.detail.value
},
onTap() {
let that = this
that.name = ""
that.weight = ""
that.height = ""
that.regTime = ""
that.number1 = ""
that.number2 = ""
that.number3 = ""
that.number = ''
that.time_m = ""
that.time_s = ""
that.lableTndex = 0
that.timesTndex = [1, 0]
that.listType = null
that.$store.commit("changeRecord", false);
},
2024-05-29 16:35:45 +08:00
}
}
</script>
<style scoped lang="scss">
.btn {
width: 40%;
float: right;
margin-top: 15px;
background: $maincolor !important;
}
.close {
background: #dfdfdf !important;
float: left;
}
</style>