2022-11-15 10:03:13 +00:00
|
|
|
|
<template>
|
|
|
|
|
<view class="pad-x120">
|
|
|
|
|
<!-- 头部 -->
|
2022-11-18 10:33:37 +00:00
|
|
|
|
<status-nav :ifReturn="false" navBarTitle="工地加班"></status-nav>
|
|
|
|
|
<view class="content" :style="{'padding-top':statusHeight+50+'px'}">
|
|
|
|
|
<!-- 导航 -->
|
|
|
|
|
<view class="pull-nav" :style="{'top':statusHeight+50+'px'}">
|
|
|
|
|
<sub-nav @changeEv="changeEv"></sub-nav>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 全选 -->
|
|
|
|
|
<view class="choose-all-bg">
|
|
|
|
|
<view class="choose-all font26" v-if="status==0 && overtimeList.length>0">
|
|
|
|
|
<view class="radio" :class="isAll?'checked':''" @tap="chooseAll"></view>
|
|
|
|
|
<view class="title">全选</view>
|
2022-11-23 08:46:52 +00:00
|
|
|
|
<view class="choose-all-btns font24" v-if="ids!==''">
|
2022-11-18 10:33:37 +00:00
|
|
|
|
<view class="btn color-blue" @tap="submitAll(1)">一键确认</view>
|
|
|
|
|
<view class="btn color-99 btn-no" @tap="submitAll(0)">退回</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 加班列表 -->
|
|
|
|
|
<view class="sign-record sign-record-other bg-white">
|
|
|
|
|
<view class="item font26" v-for="(item,index) in overtimeList" :key="index">
|
|
|
|
|
<view class="radio" :class="item.ifcheck?'checked':''" @tap="chooseEv(index)" v-if="status==0"></view>
|
|
|
|
|
<view class="info" :class="status==0?'hide':''">
|
|
|
|
|
<text>工地:{{item.worksite_name}}</text>
|
|
|
|
|
<text>姓名:{{item.worker_name}}</text>
|
|
|
|
|
<text>加班时长:{{item.time}}小时</text>
|
|
|
|
|
<text>提交时间:{{item.create_time}}</text>
|
2022-11-22 05:47:31 +00:00
|
|
|
|
<text>备注:{{item.remarks}}</text>
|
2022-11-18 10:33:37 +00:00
|
|
|
|
</view>
|
|
|
|
|
<!-- 待确认 -->
|
|
|
|
|
<view class="examine-btns font24" v-if="item.status==0">
|
|
|
|
|
<view class="btn color-blue" @tap="submitEv(item.id,1)">确认</view>
|
|
|
|
|
<view class="btn color-99" @tap="submitEv(item.id,0)">退回</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 已确认 -->
|
|
|
|
|
<view class="state" :class="item.status==-1?'color-red':''" v-if="item.status==1 || item.status==-1">{{item.status_text}}</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- 加载更多 -->
|
|
|
|
|
<view class="more-tips font24">{{overtimeList.length==total?'没有更多数据了':'下滑获取更多'}}</view>
|
|
|
|
|
</view>
|
2022-11-15 10:03:13 +00:00
|
|
|
|
<!-- 尾部 -->
|
|
|
|
|
<tabbar :userType="userType" current="3"></tabbar>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
<script>
|
2022-11-18 10:33:37 +00:00
|
|
|
|
import subNav from '@/components/sub-nav/sub-nav.vue';
|
2022-11-15 10:03:13 +00:00
|
|
|
|
import tabbar from '@/components/tabbar/tabbar';
|
|
|
|
|
export default {
|
|
|
|
|
components:{
|
2022-11-18 10:33:37 +00:00
|
|
|
|
subNav,
|
2022-11-15 10:03:13 +00:00
|
|
|
|
tabbar
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度
|
|
|
|
|
userType:'director', //账户类型 工人:worker 负责人:director
|
2022-11-18 10:33:37 +00:00
|
|
|
|
overtimeList:[], //打卡列表
|
|
|
|
|
page:1,
|
|
|
|
|
size:10,
|
|
|
|
|
status:0,
|
|
|
|
|
total:0,
|
|
|
|
|
isAll:false, //是否全选
|
|
|
|
|
ids:'', //选中的id
|
2022-11-15 10:03:13 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
|
|
|
|
|
2022-11-18 10:33:37 +00:00
|
|
|
|
},
|
|
|
|
|
onShow() {
|
|
|
|
|
// 获取加班列表
|
|
|
|
|
this.getOvertimeList();
|
|
|
|
|
},
|
|
|
|
|
onReachBottom() {
|
|
|
|
|
if(this.overtimeList.length<this.total){
|
|
|
|
|
this.page++;
|
|
|
|
|
// 获取加班列表
|
|
|
|
|
this.getOvertimeList();
|
|
|
|
|
}
|
2022-11-15 10:03:13 +00:00
|
|
|
|
},
|
2022-11-28 06:26:17 +00:00
|
|
|
|
onPullDownRefresh() {
|
|
|
|
|
this.page = 1;
|
|
|
|
|
// 获取加班列表
|
|
|
|
|
this.getOvertimeList();
|
|
|
|
|
// 关闭下拉刷新
|
|
|
|
|
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-15 10:03:13 +00:00
|
|
|
|
methods: {
|
2022-11-18 10:33:37 +00:00
|
|
|
|
// 选择栏目
|
|
|
|
|
changeEv(index){
|
|
|
|
|
this.status = index;
|
|
|
|
|
this.page = 1;
|
|
|
|
|
// 获取加班列表
|
|
|
|
|
this.getOvertimeList();
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 选中事件
|
|
|
|
|
chooseEv(index) {
|
|
|
|
|
this.overtimeList[index].ifcheck = !this.overtimeList[index].ifcheck;
|
|
|
|
|
let exit = this.overtimeList.filter(item=>item.ifcheck==false);
|
|
|
|
|
if(exit.length>0){
|
|
|
|
|
this.isAll = false;
|
|
|
|
|
} else {
|
|
|
|
|
this.isAll = true;
|
|
|
|
|
}
|
|
|
|
|
let idsTemparr = this.overtimeList.filter(item=>{return item.ifcheck==true})
|
|
|
|
|
let idsArr = [];
|
|
|
|
|
idsTemparr.forEach(item=>{
|
|
|
|
|
idsArr.push(item.id)
|
|
|
|
|
})
|
|
|
|
|
// 选中的id
|
|
|
|
|
this.ids = idsArr.join(',');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 全选事件
|
|
|
|
|
chooseAll(){
|
|
|
|
|
let exit = this.overtimeList.filter(item=>item.ifcheck==false);
|
|
|
|
|
if(exit.length>0){
|
|
|
|
|
this.isAll = true;
|
|
|
|
|
this.overtimeList.forEach(item=>item.ifcheck = true);
|
|
|
|
|
} else {
|
|
|
|
|
this.isAll = false;
|
|
|
|
|
this.overtimeList.forEach(item=>{item.ifcheck = false});
|
|
|
|
|
}
|
|
|
|
|
let idsTemparr = this.overtimeList.filter(item=>{return item.ifcheck==true})
|
|
|
|
|
let idsArr = [];
|
|
|
|
|
idsTemparr.forEach(item=>{
|
|
|
|
|
idsArr.push(item.id)
|
|
|
|
|
})
|
|
|
|
|
// 选中的id
|
|
|
|
|
this.ids = idsArr.join(',');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 确认&退回事件
|
|
|
|
|
submitEv(id,type){
|
|
|
|
|
let params = {
|
|
|
|
|
id:id,
|
|
|
|
|
type:type
|
|
|
|
|
}
|
|
|
|
|
this.$requst.post('/api/v1/manager/check-overtime',params).then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
if(type==0){
|
|
|
|
|
this.$toolAll.tools.showToast('已退回');
|
|
|
|
|
}else{
|
|
|
|
|
this.$toolAll.tools.showToast('已确认');
|
|
|
|
|
}
|
|
|
|
|
// 获取加班列表
|
|
|
|
|
this.getOvertimeList();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
// 批量确认&退回事件
|
|
|
|
|
submitAll(type){
|
|
|
|
|
let params = {
|
|
|
|
|
id:this.ids,
|
|
|
|
|
type:type
|
|
|
|
|
}
|
|
|
|
|
this.$requst.post('/api/v1/manager/check-overtime',params).then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
if(type==0){
|
|
|
|
|
this.$toolAll.tools.showToast('已退回');
|
|
|
|
|
}else{
|
|
|
|
|
this.$toolAll.tools.showToast('已确认');
|
|
|
|
|
}
|
|
|
|
|
// 获取加班列表
|
|
|
|
|
this.getOvertimeList();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2022-11-15 10:03:13 +00:00
|
|
|
|
|
2022-11-18 10:33:37 +00:00
|
|
|
|
// 获取加班列表
|
|
|
|
|
getOvertimeList(){
|
|
|
|
|
let params = {
|
|
|
|
|
page:this.page,
|
|
|
|
|
size:this.size,
|
|
|
|
|
status:this.status
|
|
|
|
|
}
|
|
|
|
|
if(this.page==1) this.overtimeList = [];
|
|
|
|
|
this.$requst.post('/api/v1/manager/overtime-list',params).then(res=>{
|
|
|
|
|
if(res.code==0){
|
|
|
|
|
console.log(res,'打卡列表');
|
|
|
|
|
this.total = res.data.total;
|
|
|
|
|
let overtimeArr = [];
|
|
|
|
|
res.data.list.forEach(item=>{
|
|
|
|
|
let obj = {
|
|
|
|
|
id: item.id,
|
|
|
|
|
worksite_name:item.worksite_name,
|
|
|
|
|
worker_name:item.worker_name,
|
|
|
|
|
time:item.time,
|
|
|
|
|
create_time: item.create_time,
|
|
|
|
|
status:item.status,
|
|
|
|
|
status_text:item.status_text,
|
2022-11-22 05:47:31 +00:00
|
|
|
|
remarks:item.remarks,
|
2022-11-18 10:33:37 +00:00
|
|
|
|
ifcheck:false,
|
|
|
|
|
}
|
|
|
|
|
overtimeArr.push(obj);
|
|
|
|
|
})
|
|
|
|
|
this.overtimeList = this.overtimeList.concat(overtimeArr);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
2022-11-15 10:03:13 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
|
|
</style>
|