building-sign/pagesB/quitApply/quitApply.vue

208 lines
5.9 KiB
Vue
Raw Normal View History

2022-12-08 10:07:45 +00:00
<template>
<view class="pad-x120">
<!-- 头部 -->
<status-nav :ifReturn="true" navBarTitle="离职审核"></status-nav>
2022-12-08 10:07:45 +00:00
<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">
2023-01-14 03:15:59 +00:00
<view class="choose-all font26" v-if="status==0 && quitApplyList.length>0">
2022-12-08 10:07:45 +00:00
<view class="radio" :class="isAll?'checked':''" @tap="chooseAll"></view>
<view class="title">全选</view>
<view class="choose-all-btns font24" v-if="ids!==''">
<view class="btn color-blue" @tap="submitAll(1)"></view>
2023-01-14 03:15:59 +00:00
<view class="btn color-99 btn-no" @tap="submitAll(0)">退</view>
2022-12-08 10:07:45 +00:00
</view>
</view>
</view>
<!-- 打卡列表 -->
<view class="sign-record sign-record-other bg-white">
2023-01-14 03:15:59 +00:00
<view class="item font26" v-for="(item,index) in quitApplyList" :key="index">
2022-12-08 10:07:45 +00:00
<view class="radio" :class="item.ifcheck?'checked':''" @tap="chooseEv(index)" v-if="status==0"></view>
<view class="info" :class="status==0?'hide':''">
2023-01-14 03:15:59 +00:00
<text>姓名{{item.real_name}}</text>
<text>技术岗位{{item.position_name}}</text>
<text>入职工地{{item.worksite_name}}</text>
<text>入职时间{{item.work_at}}</text>
<text>申请时间{{item.created_at}}</text>
2022-12-08 10:07:45 +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>
<!-- 已确认 -->
2023-01-14 03:15:59 +00:00
<view class="state" :class="item.status==-1?'color-red':''" v-if="item.status==1 || item.status==-1">{{item.status==-1?'':''}}</view>
2022-12-08 10:07:45 +00:00
</view>
<!-- 加载更多 -->
2023-01-14 03:15:59 +00:00
<view class="more-tips font24">{{quitApplyList.length==total?'没有更多数据了':'下滑获取更多'}}</view>
2022-12-08 10:07:45 +00:00
</view>
</view>
<!-- 尾部 -->
<tabbar :userType="userType" current="2"></tabbar>
2022-12-08 10:07:45 +00:00
</view>
</template>
<script>
import subNav from '@/components/sub-nav/sub-nav.vue';
import tabbar from '@/components/tabbar/tabbar';
export default {
components:{
subNav,
tabbar
},
data() {
return {
statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度
userType:'director', //账户类型 工人worker 负责人director
2023-01-14 03:15:59 +00:00
quitApplyList:[], //离职列表
2022-12-08 10:07:45 +00:00
page:1,
size:10,
status:0,
total:0,
isAll:false, //是否全选
ids:'', //选中的id
}
},
onLoad() {
2023-01-14 03:15:59 +00:00
// 获取离职列表
this.getQuitApplyList();
2023-01-16 07:13:07 +00:00
},
onShow() {
2022-12-08 10:07:45 +00:00
},
onReachBottom() {
2023-01-14 03:15:59 +00:00
if(this.quitApplyList.length<this.total){
2022-12-08 10:07:45 +00:00
this.page++;
2023-01-14 03:15:59 +00:00
// 获取离职列表
this.getQuitApplyList();
2022-12-08 10:07:45 +00:00
}
},
onPullDownRefresh() {
this.page = 1;
2023-01-14 03:15:59 +00:00
// 获取离职列表
this.getQuitApplyList();
2022-12-08 10:07:45 +00:00
// 关闭下拉刷新
uni.stopPullDownRefresh();
},
methods: {
// 选择栏目
changeEv(index){
this.status = index;
this.page = 1;
2023-01-14 03:15:59 +00:00
// 获取离职列表
this.getQuitApplyList();
2022-12-08 10:07:45 +00:00
},
// 选中事件
chooseEv(index) {
2023-01-14 03:15:59 +00:00
this.quitApplyList[index].ifcheck = !this.quitApplyList[index].ifcheck;
let exit = this.quitApplyList.filter(item=>item.ifcheck==false);
2022-12-08 10:07:45 +00:00
if(exit.length>0){
this.isAll = false;
} else {
this.isAll = true;
}
2023-01-14 03:15:59 +00:00
let idsTemparr = this.quitApplyList.filter(item=>{return item.ifcheck==true})
2022-12-08 10:07:45 +00:00
let idsArr = [];
idsTemparr.forEach(item=>{
idsArr.push(item.id)
})
// 选中的id
this.ids = idsArr.join(',');
},
// 全选事件
chooseAll(){
2023-01-14 03:15:59 +00:00
let exit = this.quitApplyList.filter(item=>item.ifcheck==false);
2022-12-08 10:07:45 +00:00
if(exit.length>0){
this.isAll = true;
2023-01-14 03:15:59 +00:00
this.quitApplyList.forEach(item=>item.ifcheck = true);
2022-12-08 10:07:45 +00:00
} else {
this.isAll = false;
2023-01-14 03:15:59 +00:00
this.quitApplyList.forEach(item=>{item.ifcheck = false});
2022-12-08 10:07:45 +00:00
}
2023-01-14 03:15:59 +00:00
let idsTemparr = this.quitApplyList.filter(item=>{return item.ifcheck==true})
2022-12-08 10:07:45 +00:00
let idsArr = [];
idsTemparr.forEach(item=>{
idsArr.push(item.id)
})
// 选中的id
this.ids = idsArr.join(',');
},
// 确认&退回事件
submitEv(id,type){
let params = {
id:id,
type:type
}
2023-01-14 03:15:59 +00:00
this.$requst.post('/api/v1/manager/check-dimission',params).then(res=>{
2022-12-08 10:07:45 +00:00
if(res.code==0){
if(type==0){
this.$toolAll.tools.showToast('已退回');
}else{
this.$toolAll.tools.showToast('已确认');
}
2023-01-14 03:15:59 +00:00
// 获取离职列表
this.getQuitApplyList();
2022-12-08 10:07:45 +00:00
}
})
},
// 批量确认&退回事件
submitAll(type){
let params = {
id:this.ids,
type:type
}
2023-01-14 03:15:59 +00:00
this.$requst.post('/api/v1/manager/check-dimission',params).then(res=>{
2022-12-08 10:07:45 +00:00
if(res.code==0){
if(type==0){
this.$toolAll.tools.showToast('已退回');
}else{
this.$toolAll.tools.showToast('已确认');
}
2023-01-14 03:15:59 +00:00
// 获取离职列表
this.getQuitApplyList();
2022-12-08 10:07:45 +00:00
}
})
},
2023-01-14 03:15:59 +00:00
// 获取离职列表
getQuitApplyList(){
2022-12-08 10:07:45 +00:00
let params = {
page:this.page,
size:this.size,
status:this.status
}
2023-01-14 03:15:59 +00:00
if(this.page==1) this.quitApplyList = [];
this.$requst.post('/api/v1/manager/dimission-check-list',params).then(res=>{
2022-12-08 10:07:45 +00:00
if(res.code==0){
console.log(res,'离职列表');
2022-12-08 10:07:45 +00:00
this.total = res.data.total;
2023-01-14 03:15:59 +00:00
let quitApplyArr = [];
2022-12-08 10:07:45 +00:00
res.data.list.forEach(item=>{
let obj = {
id: item.id,
created_at:item.created_at,
status:item.status,
worksite_name: item.worksite_name,
2023-01-14 03:15:59 +00:00
real_name:item.real_name,
work_at: item.work_at,
position_name: item.position_name,
2022-12-08 10:07:45 +00:00
ifcheck:false,
}
2023-01-14 03:15:59 +00:00
quitApplyArr.push(obj);
2022-12-08 10:07:45 +00:00
})
2023-01-14 03:15:59 +00:00
this.quitApplyList = this.quitApplyList.concat(quitApplyArr);
2022-12-08 10:07:45 +00:00
}
})
},
}
}
</script>
<style scoped>
</style>