Files
dvcp_v2_wxcp_app/src/saas/AppCountryAlbum/Attendance.vue

334 lines
7.3 KiB
Vue
Raw Normal View History

2022-03-08 17:02:42 +08:00
<template>
<div class="Attendance">
<div class="Attendance-top">
<div>
<div class="left">
2022-05-23 15:23:10 +08:00
<h2>{{ DD }}</h2>
2022-03-08 17:02:42 +08:00
<div class="left-wrapper__right">
2022-05-23 15:23:10 +08:00
<h3>{{ yyyyMM }}</h3>
2022-03-08 17:02:42 +08:00
<p>·数据统计</p>
</div>
</div>
2022-05-23 15:23:10 +08:00
<picker mode="date" :value="date" @change="onDateChange">
<div class="right">
<image src="./images/qiehuan.png" />
<span>切换日期</span>
</div>
</picker>
2022-03-08 17:02:42 +08:00
</div>
</div>
<div class="info">
<div class="info-tab">
<div class="left">
2022-05-24 16:31:10 +08:00
<span @click="changeTab(0)" :class="[currIndex === 0 ? 'active' : '']">全部 {{ attendanceCount.all || 0 }}</span>
<span @click="changeTab(1)" :class="[currIndex === 1 ? 'active' : '']">已出勤 {{ attendanceCount.hasIn || 0 }}</span>
<span @click="changeTab(2)" :class="[currIndex === 2 ? 'active' : '']">未出勤 {{ attendanceCount.hasOut || 0 }}</span>
2022-03-08 17:02:42 +08:00
</div>
2022-05-23 15:23:10 +08:00
<div class="right" @click="linkTo('./AttendanceSetting')">考勤设置</div>
2022-03-08 17:02:42 +08:00
</div>
<div class="info-table">
<div class="table-header">
<span>人员</span>
<span>上下班时间</span>
<span>工作时长</span>
</div>
<div class="table-body">
2022-05-24 11:14:29 +08:00
<div class="table-row" v-for="(item, index) in list" :key="index">
2022-03-08 17:02:42 +08:00
<div class="table-row__left">
2022-05-24 11:14:29 +08:00
<h2><AiOpenData v-if="item.userId" type="userName" :openid="item.userId"></AiOpenData></h2>
<p>已上传{{ item.photoCount || 0 }}</p>
2022-03-08 17:02:42 +08:00
</div>
2022-05-24 11:14:29 +08:00
<span>{{ item.workInTime }}-{{ item.workOutTime || '' }}</span>
<span>{{ item.workHours || 0 }}小时</span>
2022-03-08 17:02:42 +08:00
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'Attendance',
appName: '考勤统计',
data () {
return {
2022-05-23 15:23:10 +08:00
date: '',
currIndex: 0,
2022-05-23 18:00:28 +08:00
list: [],
2022-05-24 16:31:10 +08:00
attendanceCount: {},
all: '1',
hasIn: '',
hasOut: ''
2022-03-08 17:02:42 +08:00
}
},
2022-05-23 15:23:10 +08:00
computed: {
yyyyMM () {
if (this.date) {
return this.date.substr(0, 8)
}
return ''
},
2022-03-08 17:02:42 +08:00
2022-05-23 15:23:10 +08:00
DD () {
if (this.date) {
return this.date.substr(8)
}
return ''
}
},
created () {
this.date = this.$dayjs(new Date).format('YYYY年MM月DD')
this.getList()
2022-05-23 18:00:28 +08:00
this.getTotal()
2022-03-08 17:02:42 +08:00
},
methods: {
linkTo (url) {
uni.navigateTo({
url
})
2022-05-23 15:23:10 +08:00
},
2022-05-24 16:31:10 +08:00
changeTab (index) {
if (index === 0) {
this.all = '1'
this.hasIn = ''
this.hasOut = ''
} else if (index === 1) {
this.all = ''
this.hasIn = '1'
this.hasOut = ''
} else {
this.all = ''
this.hasIn = ''
this.hasOut = '1'
}
this.currIndex = index
this.getList()
},
2022-05-23 15:23:10 +08:00
onDateChange (e) {
const values = e.detail.value.split('-')
this.date = `${values[0]}${values[1]}${values[2]}`
this.$nextTick(() => {
this.getList()
2022-05-23 18:00:28 +08:00
this.getTotal()
})
},
getTotal () {
this.$http.post(`/api/appattendancerecord/attendanceCount?queryTime=${this.date.replace(/年|月/g, '-')}`).then(res => {
if (res.code === 0) {
this.attendanceCount = res.data
}
2022-05-23 15:23:10 +08:00
})
},
getList () {
2022-05-24 16:31:10 +08:00
this.$loading()
this.$http.post(`/api/appattendancerecord/alldetail?all=${this.all}&hasIn=${this.hasIn}&hasOut=${this.hasOut}&queryTime=${this.date.replace(/年|月/g, '-')}`).then(res => {
2022-05-23 15:23:10 +08:00
if (res.code === 0) {
2022-05-24 11:14:29 +08:00
this.list = res.data.map(v => {
return {
...v,
2022-05-24 16:31:10 +08:00
workInTime: v.workInTime ? this.$dayjs(v.workInTime).format('hh:mm') : '',
workOutTime: v.workOutTime ? this.$dayjs(v.workOutTime).format('hh:mm') : ''
2022-05-24 11:14:29 +08:00
}
})
2022-05-24 16:31:10 +08:00
this.$hideLoading()
2022-05-23 15:23:10 +08:00
}
})
2022-03-08 17:02:42 +08:00
}
}
}
</script>
<style lang="scss" scoped>
.Attendance {
padding: 0 0 0;
* {
box-sizing: border-box;
line-height: 1;
}
i, em {
font-style: normal;
}
.info-table {
margin-top: 32px;
padding: 0 32px;
.table-header {
display: flex;
align-items: center;
height: 96px;
background: #F4F9FD;
border-radius: 8px;
span {
flex: 1;
text-align: center;
color: #333333;
font-size: 28px;
}
}
.table-body {
.table-row {
display: flex;
align-items: center;
height: 160px;
border-radius: 8px;
text-align: center;
&:nth-of-type(2n) {
background: #F4F9FD;
}
div {
h2 {
margin-bottom: 16px;
color: #333333;
font-size: 34px;
}
p {
color: #999999;
font-size: 28px;
}
}
div, span {
flex: 1;
}
span {
color: #333;
font-size: 28px;
}
}
}
}
.info {
position: relative;
top: -116px;
margin: 0 32px;
padding: 0 0 86px 0;
background: #FFFFFF;
box-shadow: 0px 4px 8px 0px rgba(17, 67, 110, 0.02);
border-radius: 16px;
.info-tab {
display: flex;
align-items: center;
justify-content: space-between;
height: 108px;
padding: 0 32px 0 16px;
.left {
display: flex;
align-items: center;
height: 100%;
span {
width: 124px;
height: 108px;
line-height: 108px;
margin-right: 32px;
text-align: center;
color: #999999;
font-size: 28px;
transition: all ease 0.3s;
&:last-child {
margin-right: 0;
}
&.active {
color: #1365DD;
border-bottom: 2px solid #1365DD;
}
}
}
.right {
font-size: 28px;
font-weight: 400;
color: #3975C6;
}
}
}
.Attendance-top {
height: 320px;
width: 100%;
padding: 58px 32px 0;
background: #3975C6;
& > div {
display: flex;
justify-content: space-between;
align-items: center;
}
.right {
display: flex;
align-items: center;
height: 56px;
padding: 0 36px;
background: #285DA4;
border-radius: 28px;
image {
width: 36px;
height: 26px;
margin-right: 12px;
}
span {
color: #FFFFFF;
font-size: 28px;
}
}
.left {
display: flex;
align-items: center;
line-height: 1;
h2 {
margin-right: 16px;
font-size: 100px;
font-weight: 600;
color: #FFFFFF;
}
h3 {
margin-bottom: 8px;
color: #a9c3e6;
font-size: 28px;
}
p {
font-size: 32px;
color: #FFFFFF;
}
}
}
}
2022-05-23 15:23:10 +08:00
</style>