173 lines
4.0 KiB
Vue
173 lines
4.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">
|
|
<picker :range="list" :value="lableTndex" @change="bindLableChange">
|
|
<view class="uni-input">{{name?name:'请选择'}}</view>
|
|
<icon class="iconfont icon-arrow-down-bold"></icon>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
<!-- -->
|
|
<view class="editem" @click="hideKeyboard">
|
|
<view class="left">日期</view>
|
|
<view class="right">
|
|
<picker mode="date" :end="endDate" @change="changeLog" fields="time">
|
|
<view class="uni-input">{{regTime?regTime:'请选择'}}</view>
|
|
<icon class="iconfont icon-arrow-down-bold"></icon>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
<view class="">
|
|
<view class="editem">
|
|
<view class="name">时长</view>
|
|
<view class="right">
|
|
<picker mode="multiSelector" :range="timeList" :value="timesTndex" @change="bindTimeChange">
|
|
<view class="size16">{{time_m?time_m+':':'请选择'}}{{time_s?time_s:''}}</view>
|
|
</picker>
|
|
<uni-icons type="bottom" class="ml-15 c666"></uni-icons>
|
|
</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 {
|
|
name: "",
|
|
regTime: "",
|
|
number: '',
|
|
timeList: [],
|
|
time_m: "",
|
|
time_s: "",
|
|
timesTndex: [1, 0],
|
|
lableTndex: 0,
|
|
}
|
|
},
|
|
props: {
|
|
type: {},
|
|
},
|
|
computed: {
|
|
...mapState(["labelList"]),
|
|
list() {
|
|
let that = this
|
|
let list = []
|
|
that.labelList.forEach(ite => {
|
|
if (ite.acd_id == that.type) {
|
|
list = ite.list
|
|
}
|
|
})
|
|
return list
|
|
},
|
|
endDate() {
|
|
return this.$tools.getDate("start")
|
|
},
|
|
startDate() {
|
|
return this.$tools.GetDateStr(-90);
|
|
},
|
|
},
|
|
mounted() {
|
|
this.timeList = this.$tools.gethms()
|
|
},
|
|
methods: {
|
|
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))
|
|
if (Number(time_m + time_s) < 30) {
|
|
that.time_m = '00'
|
|
that.time_s = '30'
|
|
} else {
|
|
that.time_m = that.timeList[0][m].substring(0, 2)
|
|
that.time_s = that.timeList[1][s].substring(0, 2)
|
|
}
|
|
},
|
|
// 手动记录
|
|
handleTarget() {
|
|
let that = this
|
|
if (!that.name) {
|
|
that.$tools.msg("请选择测量项目")
|
|
return
|
|
}
|
|
if (!that.regTime) {
|
|
that.$tools.msg("请选择日期")
|
|
return
|
|
}
|
|
if (!that.time_m || !that.time_s) {
|
|
that.$tools.msg("请输入时长")
|
|
return
|
|
}
|
|
that.$model.getpublicmeasure({
|
|
acd_id: that.type,
|
|
name: that.name,
|
|
record_time: that.regTime,
|
|
data: that.time_m + ':' + that.time_s,
|
|
aud_id: uni.getStorageSync('userid')
|
|
}).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("getPublicContent", {
|
|
acd_id: that.acd_id,
|
|
aud_id: uni.getStorageSync('userid')
|
|
})
|
|
that.regTime = ""
|
|
})
|
|
},
|
|
bindLableChange(e) {
|
|
let that = this
|
|
that.name = that.list[e.detail.value]
|
|
},
|
|
//
|
|
changeLog(e) {
|
|
this.regTime = e.detail.value
|
|
},
|
|
onTap() {
|
|
this.regTime = ""
|
|
this.name = ""
|
|
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> |