2022-11-16 10:20:26 +00:00
|
|
|
|
<template>
|
|
|
|
|
<view class="pad-x120">
|
|
|
|
|
<!-- 头部 -->
|
|
|
|
|
<status-nav navBarTitle="打卡记录"></status-nav>
|
|
|
|
|
<view class="content" :style="{'padding-top':statusHeight+50+'px'}">
|
2022-11-17 11:40:25 +00:00
|
|
|
|
<!-- 筛选 -->
|
2022-12-09 09:56:41 +00:00
|
|
|
|
<view class="screen-box screen-box-other">
|
2022-11-17 11:40:25 +00:00
|
|
|
|
<view class="item">
|
|
|
|
|
<picker class="font24" mode="selector" :range="worksiteList" @change="bindWorksiteChange" :value="worksiteIndex" :range-key="'name'">
|
|
|
|
|
<view class="name">
|
|
|
|
|
<text class="clips1" :class="worksiteIndex==-1?'color-99':''">{{worksiteIndex!==-1?worksiteList[worksiteIndex].name:'请选择工地'}}</text>
|
|
|
|
|
<image src="/static/icon/icon-arrow-02.png" mode="aspectFit"></image>
|
|
|
|
|
</view>
|
|
|
|
|
</picker>
|
|
|
|
|
</view>
|
2022-12-09 09:56:41 +00:00
|
|
|
|
<view class="item font26 color-blue" @tap="showCard=true">
|
|
|
|
|
<view class="name" style="justify-content: center;">补卡操作</view>
|
2022-11-17 11:40:25 +00:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2022-12-09 09:56:41 +00:00
|
|
|
|
<!-- 打卡日历 -->
|
|
|
|
|
<view class="sign-calendar">
|
|
|
|
|
<sign-calendar></sign-calendar>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 时间 -->
|
|
|
|
|
<view class="sign-record-date font26">2022年12月08日 打卡情况</view>
|
2022-11-17 11:40:25 +00:00
|
|
|
|
<!-- 打卡记录 -->
|
|
|
|
|
<view class="sign-record sign-record-other bg-white">
|
|
|
|
|
<view class="item font26" v-for="(item,index) in signList" :key="index">
|
|
|
|
|
<view class="info">
|
|
|
|
|
<text>{{item.type_text}}打卡:{{item.created_at.substr(item.created_at.length-8)}}</text>
|
|
|
|
|
<text>打卡工地:{{item.worksite_name}}</text>
|
|
|
|
|
</view>
|
2022-11-18 10:33:37 +00:00
|
|
|
|
<view class="state color-red" v-if="item.status==-1">{{item.status_text}}</view>
|
|
|
|
|
<view class="state color-blue" v-if="item.status==0">{{item.status_text}}</view>
|
|
|
|
|
<view class="state" v-if="item.status==1">{{item.status_text}}</view>
|
2022-11-17 11:40:25 +00:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 加载更多 -->
|
2022-11-18 10:33:37 +00:00
|
|
|
|
<view class="more-tips font24">{{signList.length==total?'没有更多数据了':'下滑获取更多'}}</view>
|
2022-11-16 10:20:26 +00:00
|
|
|
|
</view>
|
2022-12-09 09:56:41 +00:00
|
|
|
|
<!-- 补卡弹窗 -->
|
|
|
|
|
<view class="pop-up-bg" v-if="showCard">
|
|
|
|
|
<view class="sign-cate bg-white">
|
|
|
|
|
<view class="title font34">请选择补卡时间</view>
|
|
|
|
|
<view class="txt font28">
|
|
|
|
|
<view class="radio-item" @tap="changeSignType(index)" v-for="(item,index) in radioList" :key="index">
|
|
|
|
|
<view :class="radioIndex==index?'checked':''"></view>
|
|
|
|
|
<view>{{item.title}}打卡</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 审核按钮 -->
|
|
|
|
|
<view class="sign-cate-btns color-white font30">
|
|
|
|
|
<view class="btn" @tap="showCard=false,radioIndex=0">取消</view>
|
|
|
|
|
<view class="btn" @tap="submitEv">确认</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2022-11-16 10:20:26 +00:00
|
|
|
|
<!-- 尾部 -->
|
2022-12-22 08:47:05 +00:00
|
|
|
|
<tabbar :userType="userType" :current="userType=='worker'?2:4"></tabbar>
|
2022-11-16 10:20:26 +00:00
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
2022-12-09 09:56:41 +00:00
|
|
|
|
import signCalendar from '@/components/sign-calendar/sign-calendar';
|
2022-11-16 10:20:26 +00:00
|
|
|
|
import tabbar from '@/components/tabbar/tabbar';
|
2022-11-17 11:40:25 +00:00
|
|
|
|
function getDate(type) {
|
|
|
|
|
const date = new Date();
|
|
|
|
|
let year = date.getFullYear();
|
|
|
|
|
let month = date.getMonth() + 1;
|
|
|
|
|
let day = date.getDate();
|
|
|
|
|
if (type === 'start') {
|
|
|
|
|
year = year - 10;
|
|
|
|
|
}
|
|
|
|
|
month = month > 9 ? month : '0' + month;
|
|
|
|
|
day = day > 9 ? day : '0' + day;
|
|
|
|
|
return `${year}-${month}-${day}`;
|
|
|
|
|
}
|
2022-11-16 10:20:26 +00:00
|
|
|
|
export default {
|
|
|
|
|
components:{
|
2022-12-09 09:56:41 +00:00
|
|
|
|
signCalendar,
|
2022-11-16 10:20:26 +00:00
|
|
|
|
tabbar
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度
|
2022-12-22 08:47:05 +00:00
|
|
|
|
userType:'', //账户类型 工人:worker 负责人:director
|
2022-11-17 11:40:25 +00:00
|
|
|
|
signList:[], //打卡列表
|
2022-12-09 09:56:41 +00:00
|
|
|
|
radioList:[
|
|
|
|
|
{title:'上午上班',type:'in'},
|
|
|
|
|
{title:'上午下班',type:'out'},
|
|
|
|
|
{title:'下午上班',type:'in'},
|
|
|
|
|
{title:'下午下班',type:'out'}
|
|
|
|
|
],//打卡类型
|
|
|
|
|
radioIndex:0, //当前选择
|
2022-11-17 11:40:25 +00:00
|
|
|
|
page:1,
|
|
|
|
|
size:10,
|
|
|
|
|
total:0,
|
|
|
|
|
worksiteList:[], //工地列表
|
|
|
|
|
worksiteIndex:-1, //当前选择
|
|
|
|
|
date: getDate({format: true}),
|
|
|
|
|
startDate: getDate('start'),
|
|
|
|
|
beginDate:'', //开始日期
|
|
|
|
|
endDate:'', //结束日期
|
2022-12-09 09:56:41 +00:00
|
|
|
|
showCard:false, //是否显示补卡
|
2022-11-16 10:20:26 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2022-12-22 08:47:05 +00:00
|
|
|
|
onLoad(op) {
|
|
|
|
|
if(op.userType!==''){
|
|
|
|
|
this.userType = op.userType;
|
|
|
|
|
}
|
2022-11-17 11:40:25 +00:00
|
|
|
|
// 获取工地列表
|
|
|
|
|
this.getWorksiteList();
|
|
|
|
|
},
|
|
|
|
|
onShow() {
|
|
|
|
|
// 获取打卡列表
|
|
|
|
|
this.getSignList();
|
|
|
|
|
},
|
|
|
|
|
onReachBottom() {
|
|
|
|
|
if(this.signList.length<this.total){
|
|
|
|
|
this.page++;
|
|
|
|
|
// 获取打卡列表
|
|
|
|
|
this.getSignList();
|
|
|
|
|
}
|
2022-11-16 10:20:26 +00:00
|
|
|
|
},
|
2022-11-28 06:26:17 +00:00
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
this.page = 1;
|
|
|
|
|
// 获取打卡列表
|
|
|
|
|
this.getSignList();
|
|
|
|
|
// 关闭下拉刷新
|
|
|
|
|
uni.stopPullDownRefresh();
|
|
|
|
|
},
|
2022-11-28 09:44:22 +00:00
|
|
|
|
onShareAppMessage(res) {
|
|
|
|
|
let shareObj = {
|
|
|
|
|
title:'工地打卡',
|
|
|
|
|
path: '/pages/pagehome/pagehome',
|
|
|
|
|
imageUrl:'/static/share-logo.jpg',
|
|
|
|
|
}
|
|
|
|
|
// 返回shareObj
|
|
|
|
|
return shareObj;
|
|
|
|
|
},
|
2022-11-16 10:20:26 +00:00
|
|
|
|
methods: {
|
2022-11-17 11:40:25 +00:00
|
|
|
|
// 获取工地列表
|
|
|
|
|
getWorksiteList(){
|
|
|
|
|
this.$requst.get('/api/v1/common/worksite-list').then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
this.worksiteList = res.data.list;
|
|
|
|
|
this.isLoding = true;
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
2022-12-09 09:56:41 +00:00
|
|
|
|
// 改变上下班打卡
|
|
|
|
|
changeSignType(index){
|
|
|
|
|
if(this.radioIndex !== index){
|
|
|
|
|
this.radioIndex = index;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 确认补卡
|
|
|
|
|
submitEv(){
|
|
|
|
|
this.showCard = false;
|
|
|
|
|
},
|
|
|
|
|
|
2022-11-17 11:40:25 +00:00
|
|
|
|
// 获取打卡列表
|
|
|
|
|
getSignList(){
|
|
|
|
|
let params = {
|
|
|
|
|
page:this.page,
|
|
|
|
|
size:this.size,
|
|
|
|
|
worksite_id:this.worksiteIndex==-1?'':this.worksiteList[this.worksiteIndex].id,
|
|
|
|
|
begin_at:this.beginDate,
|
|
|
|
|
end_at:this.endDate
|
|
|
|
|
}
|
|
|
|
|
if(this.page==1) this.signList = [];
|
|
|
|
|
this.$requst.post('/api/v1/worker/clock-list',params).then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
console.log(res,'打卡记录');
|
|
|
|
|
this.total = res.data.total;
|
|
|
|
|
this.signList = this.signList.concat(res.data.list);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 选择工地
|
|
|
|
|
bindWorksiteChange(e) {
|
|
|
|
|
this.worksiteIndex = e.detail.value;
|
|
|
|
|
this.page = 1;
|
|
|
|
|
// 获取打卡列表
|
|
|
|
|
this.getSignList();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 选择开始日期
|
|
|
|
|
beginDateChange(e) {
|
|
|
|
|
this.beginDate = e.detail.value;
|
|
|
|
|
this.page = 1;
|
|
|
|
|
// 获取打卡列表
|
|
|
|
|
this.getSignList();
|
|
|
|
|
},
|
2022-11-16 10:20:26 +00:00
|
|
|
|
|
2022-11-17 11:40:25 +00:00
|
|
|
|
// 选择结束日期
|
|
|
|
|
endDateChange(e) {
|
|
|
|
|
this.endDate = e.detail.value;
|
|
|
|
|
this.page = 1;
|
|
|
|
|
// 获取打卡列表
|
|
|
|
|
this.getSignList();
|
|
|
|
|
},
|
2022-11-16 10:20:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
|
|
</style>
|