309 lines
7.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="fullHeight">
<view class="" style="position: fixed; top: 0; left: 0; width: 100%; z-index: 10;background-color: #fff;">
<headers :showBack="true" class="fixedHeaderBox">
<view class="headerName">
考勤记录
</view>
</headers>
<view class="searchBox selectContent" :style="{ 'padding-top': (statusBarHeight+52) * 1.5 + 'rpx' }">
<text>考勤日期</text>
<picker mode="date" @change="changeDate" :value="searchForm.attendanceDate" class="selectItem">
<view class="selectVideoBox">
<text class="videoName">{{ searchForm.attendanceDate }}</text>
<uni-icons2 class="arrow" type="arrowdown" size="15"></uni-icons2>
</view>
</picker>
<!-- <picker mode="selector" :range="personTypeArr" @change="changePersonType" range-key="name"
:value="personTypeIndex" style="margin-left:20rpx" class="selectItem">
<view class="selectVideoBox">
<text class="videoName">{{ personTypeArr[personTypeIndex].name }}</text>
<uni-icons2 class="arrow" type="arrowdown" size="15"></uni-icons2>
</view>
</picker> -->
</view>
<!-- <view class="middleBox" :style="{ 'padding-top': (statusBarHeight+52+40) * 1.5 + 'rpx' }">
<view class="box">
<view class="num">
{{ statictisData.total_person }}
</view>
<view class="txt">
出勤人数
</view>
</view>
<view class="box">
<view class="num">
{{ searchForm.personType == 1 ? statictisData.totalTeamNum : statictisData.totalDepartmentNum }}
</view>
<view class="txt">
{{ searchForm.personType == 1 ? '出勤班组' : '出勤部门' }}
</view>
</view>
</view> -->
</view>
<view class="listBox" style="padding-top: 100px;">
<!-- @click="searchPerson(item.id)" -->
<view class="personItem" v-for="item in list" :key="item.id">
<image v-if="item.fieldAcquisitionUrl" :src="url_config+'image/'+item.fieldAcquisitionUrl"
class="profile_photo"></image>
<image v-else src="/static/profile_photo.png" class="profile_photo"></image>
<view class="personInfo">
<view class="name">
{{ item.workerName }}
</view>
<view class="teamName">
{{ item.teamName ? item.teamName : item.departmentName }}
</view>
<view class="small">
{{ item.sex == 2 ? '女' : '男' }} {{ item.age }}
</view>
</view>
<!-- <image src="/static/icon-right.png" class="icon-right"></image> -->
</view>
<view class="placeholderBox" v-show="list.length===0">
<image src="/static/noData.png" class="noDataImg"></image>
<view class="text">
暂无数据
</view>
</view>
</view>
<view class="loadMoreBox" v-if="isLoadMore&&list.length>0">
<uni-load-more :status="loadStatus" iconType="auto"></uni-load-more>
</view>
</view>
</template>
<script>
import headers from "@/components/headers/headers.vue"
import {
GetDateStr
} from "@/static/js/util.js"
export default {
components: {
headers
},
data() {
return {
searchForm: {
pageNo: 1,
pageSize: 10,
projectSn: "",
attendanceDate: ''
},
projectDetail: {},
list: [],
statusBarHeight: 0,
loadStatus: 'more',
isLoadMore: false,
personTypeArr: [{
name: '施工人员',
value: 1
}, {
name: '管理人员',
value: 2
}],
personTypeIndex: 0,
statictisData: {
totalDepartmentNum: 0,
totalTeamNum: 0,
total_person: 0,
},
workerInfo: {}
};
},
onLoad(option) {
this.workerInfo = JSON.parse(decodeURIComponent(option.item));
},
mounted() {
this.statusBarHeight = uni.getStorageSync('systemInfo').statusBarHeight
this.projectDetail = JSON.parse(uni.getStorageSync('projectDetail'))
this.searchForm.projectSn = this.projectDetail.projectSn
this.searchForm.attendanceDate = GetDateStr(0, '-')
this.loadData()
},
onShow() {
uni.removeStorageSync('person')
},
onReachBottom() {
if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
this.isLoadMore = true
this.searchForm.pageNo += 1
this.loadData()
}
},
onPullDownRefresh() {
this.searchForm.pageNo = 1
this.list = []
this.loadData()
},
methods: {
changeDate(e) {
this.searchForm.attendanceDate = e.target.value
this.list = []
this.searchForm.pageNo = 1
this.loadData()
},
changePersonType(e) {
this.personTypeIndex = e.target.value
this.searchForm.personType = this.personTypeArr[this.personTypeIndex].value
this.list = []
this.searchForm.pageNo = 1
this.loadData()
},
searchPerson(id) {
uni.navigateTo({
url: './searchTeam/personDetail?id=' + id
})
},
loadData() {
var that = this
let requestData = {
...this.searchForm,
personSn: this.workerInfo.personSn
}
this.sendRequest({
url: 'xmgl/workerInfo/selectAttendanceWorkerListByDate',
data: requestData,
method: "POST",
success(res) {
that.statictisData = res.result.count
that.list = that.list.concat(res.result.page.records)
if (res.result.page.records.length < that.searchForm
.pageSize) { //判断接口返回数据量小于请求数据量,则表示此为最后一页
that.isLoadMore = true
that.loadStatus = 'nomore'
} else {
that.isLoadMore = false
// that.loadStatus='more'
}
uni.stopPullDownRefresh()
console.log('that.isLoadMore', that.isLoadMore)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.searchBox {
// background-color: #2b8df3;
padding: 0 30rpx 10rpx;
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 1;
}
.selectContent {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
.selectItem {
flex: 1;
}
}
.listBox {
margin: 30rpx;
}
.personItem {
display: flex;
align-items: center;
box-shadow: 0px 4px 26rpx 0px rgba(212, 220, 236, 0.53);
position: relative;
margin-bottom: 10rpx;
padding: 30rpx;
border-radius: 16rpx;
// padding: 0 30rpx;
font-size: 30rpx;
.teamName {
font-size: 26rpx;
}
.small {
font-size: 24rpx;
opacity: 0.8;
}
}
.profile_photo {
width: 100rpx;
height: 120rpx;
margin-right: 20rpx;
}
.icon-right {
position: absolute;
width: 16rpx;
height: 28rpx;
right: 30rpx;
top: calc(50% - 7px);
}
.selectVideoBox {
border: 1px solid rgba(42, 43, 91, 0.2);
border-radius: 36rpx;
height: 70rpx;
font-size: 30rpx;
// display: inline-block;
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
.videoName {
padding: 0 24rpx 0 30rpx;
// border-right: 1px solid rgba(42, 43, 91, 0.2);
line-height: 70rpx;
height: 70rpx;
}
.arrow {
padding: 0 24rpx 0 4rpx;
margin-left: 20rpx;
}
}
.middleBox {
display: flex;
align-items: center;
margin: 10rpx 30rpx 20rpx;
.box {
flex: 1;
// display: inline-flex;
// align-items: center;
// height: 65px;
padding: 4px 0 6px;
&:first-child {
margin-right: 30rpx;
}
.txt {
color: rgba(55, 45, 102, 0.6);
font-size: 26rpx;
text-align: center;
}
.num {
font-size: 40rpx;
font-weight: bold;
text-align: center;
}
}
}
.box {
box-shadow: 0 4px 24px 0px rgba(212, 220, 236, 0.69);
border-radius: 16rpx;
}
</style>