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

175 lines
4.1 KiB
Vue
Raw Normal View History

2023-12-19 14:41:16 +08:00
<template>
<view>
<view class="ythTimer">
<view style="width: 30%;">
<!-- <lauwen-select :options="options" :defaultIndex="lauwentext" :height="20" :padding="15" :fontSize="'28rpx'"
@getValue="getValue"></lauwen-select> -->
<uni-data-select v-model="yearValue" :localdata="range" @change="change"
:clear="false"></uni-data-select>
</view>
<view class="conWidth">
<view v-if="nurseData && nurseData.length != 0">
<view class="conItem" v-for="(item,index) in nurseData" :key="index">
<view class="conTitle">
<view style="font-size: 36rpx;color: #333;">
{{ item.schemaName ? item.schemaName : '计划外照护' }}
</view>
</view>
<view style="margin-top: 8px;line-height: 20px;">
<view style="font-size: 24rpx;color: #999;">
完成时间{{ item.performanceDate }}
</view>
<view style="font-size: 24rpx;color: #999;">
完成医生{{ item.doctorName }}
</view>
</view>
<view style="border-bottom: 1px solid #EEEEEE;margin: 8px 0;"></view>
<view style="text-align: center;" @click="goToDetail(item)">
<span style="color: #1872f8;font-size: 26rpx;">查看详情</span>
</view>
</view>
</view>
<view class="empty" v-else>
暂无记录
</view>
</view>
</view>
</view>
</template>
<script>
import lauwenSelect from "@/components/lauwen-select/lauwenSelect.vue"
import {
getNurseList
} from '@/api/pagesC/nurseRecord/index.js'
export default {
components: {
lauwenSelect
},
data() {
return {
yearValue: '',
lauwentext: 1,
range: [],
form: {
pageNum: 1,
pageSize: 15
},
nurseData: '',
total: ''
};
},
onLoad() {
let data = new Date()
const getYear = (val) => {
// 获取指定年份开始到现在年份的数组
//获取到从那一年开始
let timList = [];
let smallYears = val;
let date = new Date(); //获取当前时间
let NowYears = date.getFullYear();
var Years = NowYears - smallYears;
let arrTim = [];
for (let index = 0; index <= Years; index++) {
arrTim.push(NowYears--);
}
arrTim.forEach((tim) => {
timList.push(tim);
});
return timList
}
let arr = getYear(2022) //传入指定的开始年份
// let Yearoption = [] //以一个Obj push到Array里面
for (let i = 0; i < arr.length; i++) {
this.yearValue = arr[i]
this.range.push({
text: arr[i],
value: arr[i]
})
}
uni.$showMsg = function(title = '数据加载失败!', duration = 1500) {
uni.showToast({
title,
duration,
icon: 'none'
})
}
this.yearValue = data.getFullYear()
this.nurseData = []
this.getZhList()
},
onReachBottom() {
if (this.form.pageNum * 15 >= this.total) {
return uni.$showMsg('数据加载完毕!')
} else {
this.form.pageNum++
this.getZhList() //调用函数
}
},
methods: {
change(e) {
this.nurseData = []
this.yearValue = e
this.getZhList()
},
// 获取列表
getZhList() {
let userInfo = uni.getStorageSync('userinfo')
let data = {
2023-12-19 15:17:58 +08:00
identity: userInfo.cardNo,
2023-12-28 15:38:01 +08:00
// identity: '370503195407100031',
2023-12-19 14:41:16 +08:00
year: this.yearValue,
pageNum: this.form.pageNum,
pageSize: this.form.pageSize
}
getNurseList(data).then(res => {
// console.log(res);
this.nurseData = res.data.list
// for (var i = 0; i < res.data.data.list.length; i++) {
// that.nurseData.push(res.data.data.list[i])
// }
this.total = res.data.total
})
},
getValue(index) {
this.showIndex = index
},
// 查看详情
goToDetail(item) {
console.log(item);
uni.navigateTo({
url: `../nurseRecordDetail/nurseRecordDetail?perRecordId=${item.perRecordId}`
})
}
}
}
</script>
<style lang="scss">
.empty {
text-align: center;
padding: 50rpx;
color: #999;
}
page {
background-color: #fff;
}
.ythTimer {
width: 93%;
margin: 0 auto;
padding: 20rpx 0 50rpx;
.conWidth {
margin-top: 24px;
.conItem {
padding: 20rpx 30rpx;
background-color: #f8f8f8;
margin: 16px auto;
}
}
}
</style>