building-sign/pagesB/worker/worker.vue

160 lines
4.4 KiB
Vue
Raw Normal View History

2022-11-18 10:33:37 +00:00
<template>
<view class="pad-x120">
<!-- 头部 -->
2022-12-21 08:26:21 +00:00
<status-nav navBarTitle="工人列表"></status-nav>
2022-11-18 10:33:37 +00:00
<view class="content" :style="{'padding-top':statusHeight+50+'px'}">
<!-- 工人列表 -->
2023-01-14 03:15:59 +00:00
<view class="worker-record bg-white">
<view class="item font26" v-for="(item,index) in workerList" :key="index">
<view class="info enter-info">
<text>工地{{item.worksite_name}}</text>
<text>姓名{{item.real_name}}</text>
2022-11-28 06:26:17 +00:00
</view>
2023-01-14 03:15:59 +00:00
<!-- 星级 -->
<view class="star-rating">
<image src="/static/icon//icon-star-active.png" mode="widthFix" v-for="(item1,index1) in parseInt(item.star)" :key="index1"></image>
<image src="/static/icon/icon-star.png" mode="widthFix" v-for="(item1,index1) in 5-parseInt(item.star)" :key="index1"></image>
</view>
<!-- 操作 -->
<view class="handle-btns font24 color-blue">
<view class="btn" @tap="openStar(index,item.id)"></view>
<view class="btn" @tap="toRecord(item.id)"></view>
<view class="btn" @tap="toDetail(item.id)"></view>
2022-11-28 06:26:17 +00:00
</view>
2022-11-18 10:33:37 +00:00
</view>
2022-12-08 10:07:45 +00:00
</view>
2023-01-14 03:15:59 +00:00
<!-- 加载更多 -->
<view class="more-tips font24">{{workerList.length==total?'没有更多数据了':'下滑获取更多'}}</view>
2022-11-18 10:33:37 +00:00
</view>
<!-- 工人评定弹窗 -->
<view class="pop-up-bg" v-if="showEvaluate">
<view class="sign-cate bg-white">
<view class="title font34">工人评定</view>
<view class="txt evaluate-txt font28">
<view class="evaluate-tips">请根据工人本月的表现情况进行评定</view>
<view class="evaluate-stars" v-for="(item,index) in allStars" :key="index">
<image @tap="changeStars(index)" :src="index<=curStars-1?'/static/icon/icon-stars-active.png':'/static/icon/icon-stars.png'" mode="widthFix"></image>
</view>
</view>
<!-- 审核按钮 -->
<view class="sign-cate-btns color-white font30">
2023-01-14 03:15:59 +00:00
<view class="btn" @tap="showEvaluate=false"></view>
<view class="btn" @tap="submitEv"></view>
</view>
</view>
</view>
2022-11-18 10:33:37 +00:00
<!-- 尾部 -->
<tabbar :userType="userType" current="2"></tabbar>
2022-11-18 10:33:37 +00:00
</view>
</template>
<script>
import tabbar from '@/components/tabbar/tabbar';
export default {
components:{
tabbar
},
data() {
return {
statusHeight:uni.getSystemInfoSync().statusBarHeight, //状态栏高度
userType:'director', //账户类型 工人worker 负责人director
2023-01-14 03:15:59 +00:00
workerList:[], //打卡列表
2022-12-21 08:26:21 +00:00
page:1,
size:10,
total:0,
showEvaluate:false,//是否显示评定弹窗
allStars:5, //总共几星
curStars:0, //选择几星
2023-01-14 03:15:59 +00:00
workerId:0, //工人id
changeIndex:0,//改变星级位置
2022-11-18 10:33:37 +00:00
}
},
2022-12-21 08:26:21 +00:00
onLoad() {
2023-01-14 03:15:59 +00:00
// 获取工人列表
this.getWorkerList();
2023-01-16 07:13:07 +00:00
},
onShow() {
2022-12-21 08:26:21 +00:00
},
onReachBottom() {
if(this.signList.length<this.total){
this.page++;
2023-01-14 03:15:59 +00:00
// 获取工人列表
this.getWorkerList();
2022-12-21 08:26:21 +00:00
}
},
onPullDownRefresh() {
this.page = 1;
2023-01-14 03:15:59 +00:00
// 获取工人列表
this.getWorkerList();
2022-12-21 08:26:21 +00:00
// 关闭下拉刷新
uni.stopPullDownRefresh();
2022-12-08 10:07:45 +00:00
},
2022-11-18 10:33:37 +00:00
methods: {
2023-01-14 03:15:59 +00:00
// 打开工人评定
openStar(index,id){
this.showEvaluate = true;
this.curStars = 0;
this.changeIndex = index;
this.workerId = id;
},
// 选择几星
changeStars(index){
if(index!==this.curStars-1){
this.curStars = index+1;
}
},
2022-12-08 10:07:45 +00:00
2023-01-14 03:15:59 +00:00
// 工人评定
submitEv(){
2022-12-21 08:26:21 +00:00
let params = {
2023-01-14 03:15:59 +00:00
id:this.workerId,
star:this.curStars,
2022-12-21 08:26:21 +00:00
}
2023-01-14 03:15:59 +00:00
this.$requst.post('/api/v1/manager/star',params).then(res=>{
2022-12-21 08:26:21 +00:00
if(res.code==0){
2023-01-14 03:15:59 +00:00
this.$toolAll.tools.showToast('评定成功');
this.showEvaluate = false;
this.workerList[this.changeIndex].star = this.curStars;
}else{
this.$toolAll.tools.showToast(res.msg);
2022-12-08 10:07:45 +00:00
}
})
},
2023-01-14 03:15:59 +00:00
// 获取工人列表
getWorkerList(){
2022-12-21 08:26:21 +00:00
let params = {
page:this.page,
size:this.size,
}
2023-01-14 03:15:59 +00:00
if(this.page==1) this.workerList = [];
this.$requst.post('/api/v1/manager/worker-list',params).then(res=>{
2022-12-21 08:26:21 +00:00
if(res.code==0){
2023-01-14 03:15:59 +00:00
console.log(res,'工人列表');
2022-12-21 08:26:21 +00:00
this.total = res.data.total;
2023-01-14 03:15:59 +00:00
this.workerList = this.workerList.concat(res.data.list);
2022-12-21 08:26:21 +00:00
}
})
},
2023-01-14 03:15:59 +00:00
// 查看详情
toDetail(id){
uni.navigateTo({
url:`/pagesB/workerDetail/workerDetail?id=${id}&userType=director`,
})
},
// 评定记录
toRecord(id){
uni.navigateTo({
url:`/pagesB/evaluateRecord/evaluateRecord?id=${id}`,
})
},
2022-11-18 10:33:37 +00:00
}
}
</script>
<style scoped>
</style>