YNUtdPlatform/pages/realName/workAttendance/statistics/detail.vue

222 lines
5.5 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="page">
<u-navbar class="u-navbar" title="考勤详情" placeholder @leftClick="leftClick" leftIconColor="#fff" bgColor="#00337A" :titleStyle="{ color: '#FFF', fontSize: '32rpx' }"/>
<view class="view-box">
<!-- <view style="width: 96%;height: auto;padding: 10rpx auto;display: flex;align-items: center;margin-bottom: 20rpx;">
<u-search shape="square" placeholder="人员姓名" v-model="keyword" :showAction="false"></u-search>
<view class="searchBtn" @click="searchList">搜索</view>
</view> -->
<view style="width: 96%;height: auto;padding: 10rpx auto;display: flex;align-items: center;">
<uni-datetime-picker v-model="range" type="daterange" rangeSeparator="至"/>
<view class="searchBtn" @click="searchList">搜索</view>
<!-- <view class="resetBtn" @click="resetSearch">重置</view> -->
</view>
</view>
<!-- 列表 -->
<view class="list-box">
<view v-if="listData.length==0" style="width: 96%;height: 60vh;display: flex;flex-direction: column;justify-content: center;align-items: center;" >
<image src="../../../../static/realName/noData.png" style="width: 100rpx;height: 120rpx;" mode=""></image>
<view>暂无数据</view>
</view>
<u-list height="78vh" v-if="listData.length>0">
<u-list-item v-for="(item, index) in listData" :key="index">
<view class="list-item">
<view class="content-box">
<view class="item-text" >
<text class="label" style="font-weight: bold;">上班打卡时间</text>
<text class="info" v-if="item.onTime">{{item.onTime}}</text>
<text class="info" v-else style="color: red;">未打卡</text>
</view>
<view class="item-text">
<text class="label" style="font-weight: bold;">下班打卡时间</text>
<text class="info" v-if="item.offTime">{{item.offTime}}</text>
<text class="info" v-else style="color: red;">未打卡</text>
</view>
<view class="item-text">
<text class="label"style="font-weight: bold;">上班时长</text>
<text class="info">{{getTimeDuration(item.onTime,item.offTime)}}</text>
</view>
<view class="item-text">
<text class="label"style="font-weight: bold;">考勤是否有效</text>
<text class="info" style="color: #06E7A3;" v-if="item.onTime&&item.offTime">有效</text>
<text class="info" style="color: red;" v-else>无效</text>
</view>
</view>
</view>
</u-list-item>
</u-list>
</view>
</view>
</template>
<script>
import config from '@/config'
export default {
data() {
return {
idNumber:"",
proId:"",
range:[],
keyword:'',
listData:[],
number:0,
}
},
onLoad(option) {
console.log(option)
this.idNumber=option.idNumber;
this.proId=option.proId;
this.range[0]=option.startDay;
this.range[1]=option.endDay;
this.loadList()
},
onShow() {
},
methods: {
//搜索
searchList(value){
this.loadList()
},
loadList(){
let param={
idNumber:this.idNumber,
proId:this.proId,
startDay:this.range[0],
endDay:this.range[1],
}
uni.request({
url: config.realAppUrl+'/faceContrast/getFaceContrastListById',
method: 'post',
data: param,
header: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: uni.getStorageSync('realNameToken')
},
success: res => {
console.log(res)
res = res.data;
if(res.code==200){
this.listData=res.data;
// this.$forceUpdate()
// console.log(this.listData)
}else{
uni.showToast({
title: res.msg,
icon: 'none'
})
}
},
fail: err => {
console.log(err)
}
})
},
getTimeDuration(startTime, endTime) {
if (!endTime) {
console.log("没有结束时间");
return 0;
}
let tTime = new Date(endTime.replace(' ', 'T')) - new Date(startTime.replace(' ', 'T'));
tTime = tTime / 1000 / 60 / 60;
if (tTime >= 1) {
let cost = tTime.toFixed(2);
// let tSec = parseFloat((tTime - tMin).toFixed(1)) * 60;
return `${cost}`
}
return `${tTime.toFixed(2)}`;
},
// 返回
leftClick() {
console.log('返回')
uni.navigateBack({
delta: 1 // 返回
});
}
},
}
</script>
<style lang="scss">
.searchBtn{
width: 120rpx;
height:60rpx;
line-height: 60rpx;
text-align: center;
border-radius: 10rpx;
background-color: #00337A;
color: #FFF;
margin-left: 20rpx;
}
.resetBtn{
width: 120rpx;
height:60rpx;
line-height: 60rpx;
text-align: center;
border-radius: 10rpx;
background-color: #fff;
color: #000;
margin-left: 20rpx;
border: 1rpx solid #00337A;
}
.view-box{
width: 94%;
margin: 20rpx auto;
background-color: #FFF;
border-radius: 10rpx;
padding:20rpx;
}
.page {
width: 100vw;
height: 100vh;
background-color: #EFEFEF;
box-sizing: border-box;
// padding: 0 20px;
.list-box{
width: 90%;
height: auto;
// border: 1px solid #000;
margin: 0rpx auto;
.list-item{
width: 100%;
height: auto;
background-color: #fff;
border-radius: 20rpx;
margin: 20rpx 0;
.content-box{
width: 100%;
height: auto;
padding: 10rpx 0;
border-bottom: 1rpx solid #eee;
.item-text{
width: 95%;
margin-left: 20rpx;
margin-top: 15rpx;
// display: flex;
align-items: center;
position: relative;
.label{
color: #999;
font-weight: 500;
}
.info-right{
position: absolute;
top: 0rpx;
right: 40rpx;
}
.info{
color: #000;
}
}
}
}
}
}
</style>