247 lines
5.2 KiB
Vue

<template>
<view class="addIssue">
<view class="fixedheader">
<headers :showBack="true">
<view class="headerName">
今日参建单位出勤排行
</view>
</headers>
</view>
<view class="content" :style="{paddingTop: mobileTopHeight + 44 + 'px'}">
<view class="content-header">
<view @click="onChartsTypeClick(item)" :class="{'header_active': chartsType == item.id}" v-for="item in chartsTypeList" :key="item.id">{{item.title}}</view>
</view>
<view class="box3_main">
<view class="box3_main-box">
<view>参建单位名称</view>
<view>出勤</view>
<view>在场</view>
<view class="flex-center">
出勤率
<view class="icon-screen">
<view @click="onSequenceClick(item)" v-for="item in 2" :key="item"
:class="{'icon-screen_active': item == sequenceType}"></view>
</view>
</view>
</view>
<view class="box3_main-box2">
<view class="box3_main-box box3_main-box1" v-for="item in projectCompanyWorkTotalList"
:key="item.id">
<view>{{item.enterpriseName}}</view>
<view>{{item.attendancePersonNum}}</view>
<view>{{item.presencePersonNum}}</view>
<view>{{item.attendancePersonRate ? item.attendancePersonRate : 0}}%</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
mobileTopHeight: 0,
projectDetail: {},
projectCompanyWorkTotalList: [],
sequenceType: 1,
chartsTypeList: [{
id: 1,
title: "总包"
}, {
id: 0,
title: "分包"
}],
chartsType: 0,
}
},
onLoad() {
this.projectDetail = JSON.parse(uni.getStorageSync('projectDetail'))
this.getQueryAttendanceOfEachCompany();
},
mounted() {
var that = this
uni.getSystemInfo({
success(res) {
that.mobileTopHeight = res.statusBarHeight ? res.statusBarHeight : 0;
uni.setStorageSync('systemInfo', res)
console.log(res)
}
})
},
methods: {
onChartsTypeClick(item){
this.chartsType = item.id;
this.getQueryAttendanceOfEachCompany();
},
onSequenceClick(type) {
this.sequenceType = type;
if (type == 1) {
this.projectCompanyWorkTotalList = this.projectCompanyWorkTotalList.sort((a, b) => b
.attendancePersonRate - a.attendancePersonRate);
} else if (type == 2) {
this.projectCompanyWorkTotalList = this.projectCompanyWorkTotalList.sort((a, b) => a
.attendancePersonRate - b.attendancePersonRate);
}
},
// 今日参建单位出勤排行
getQueryAttendanceOfEachCompany() {
var that = this
this.sendRequest({
url: 'xmgl/workerAppHome/queryAttendanceOfEachCompany',
data: {
projectSn: this.projectDetail.projectSn,
isCountMainEnterprise: this.chartsType,
// type: 1,
},
method: "POST",
success(res) {
if (res.code == 200) {
that.projectCompanyWorkTotalList = res.result.projectCompanyWorkTotalList.map(item => {
return {
...item,
attendancePersonRate: item.attendancePersonRate ? item
.attendancePersonRate : 0,
}
});
that.onSequenceClick(that.sequenceType)
}
}
})
},
}
}
</script>
<style scoped lang="scss">
.content {
padding: 26rpx;
height: 100vh;
}
.content-header {
width: 218rpx;
height: 64rpx;
background: #F2F3F7;
border-radius: 6rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto;
padding: 4rpx;
>view {
width: 50%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-size: 24rpx;
color: #4D4D4D;
border-radius: 6rpx;
}
.header_active {
background: #FFFFFF;
color: #3190F3;
}
}
.fixedheader {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 2;
/deep/ .headerBox {
border-bottom: none;
}
.headerName {
z-index: 1;
}
}
.flex-center {
display: flex;
align-items: center;
}
.icon-screen {
display: flex;
flex-direction: column;
margin-left: 22rpx;
>view:nth-child(1) {
border-bottom: 12rpx solid #333333;
border-right: 10rpx solid transparent;
border-left: 10rpx solid transparent;
}
>view:nth-child(2) {
border-top: 12rpx solid #333333;
border-right: 10rpx solid transparent;
border-left: 10rpx solid transparent;
margin-top: 4rpx;
}
.icon-screen_active {
border-bottom-color: #108BC7 !important;
border-top-color: #108BC7 !important;
}
}
.box3_main {
margin-top: 26rpx;
height: calc(100% - 64rpx - 26rpx);
>view:first-child {
background: #F2F3F5;
}
.box3_main-box {
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 20rpx;
height: 76rpx;
border-radius: 6rpx;
>view {
display: flex;
justify-content: center;
}
>view:nth-child(1) {
width: 35%;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
/* 限制为两行 */
overflow: hidden;
}
>view:nth-child(2),
>view:nth-child(3) {
width: 20%;
}
>view:nth-child(4) {
width: 25%;
}
}
.box3_main-box1:nth-child(odd) {
background-color: #FAFAFA;
}
.box3_main-box2 {
height: calc(100% - 76rpx);
overflow-y: scroll;
}
}
</style>