123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527 |
- <template>
- <view class="content">
- <view class="select-top">
- <view class="">
- 本月统计
- </view>
- <view class="top-right">
- <view class="select-time">
- <picker mode="date" @change="bindDateChange" fields="month">
- <view class="uni-input">{{showdate}}</view>
- </picker>
- <image src="../../static/img/downjian.png" mode="widthFix"></image>
- </view>
- </view>
- </view>
- <view class="dk-info">
- <view class="dk-day big">
- <view class="dk-left">
- {{dk_detail.clock_in}}
- </view>
- <view class="dk-center">
- /
- </view>
- <view class="dk-right err">
- {{dk_detail.no_clocking}}
- </view>
- </view>
- <view class="dk-tit">
- <view class="dk-left">
- 需要打卡次数
- </view>
- <view class="dk-center">
- /
- </view>
- <view class="dk-right">
- 缺卡次数
- </view>
- </view>
- <view class="dk-detail">
- <view class="detail-item green">
- <view class="">
- {{dk_detail.normal}}
- </view>
- <view class="item-tit">
- 正常打卡(次)
- </view>
- </view>
- <view class="detail-item">
- <view class="">
- {{dk_detail.early}}
- </view>
- <view class="item-tit">
- 早退(次)
- </view>
- </view>
- <view class="detail-item">
- <view class="err">
- {{dk_detail.late}}
- </view>
- <view class="item-tit">
- 迟到(次)
- </view>
- </view>
- </view>
- </view>
- <scroll-view scroll-y="true" class="yg-list" :style="{'height': height}">
- <template v-for="item in list">
- <view class="yg-wrap">
- <view class="yg-name">
- {{ item.time + ' '+ item.name}}
- </view>
- <view class="dk-status" :class="{'err': item.status == -1 }" @click="openDetail(item)">
- {{item.status == 0 ? '正常': (item.status == -1 ? '异常': '正常')}}
- <image :src="item.open? '../../static/img/downup.png': '../../static/img/downxia.png' " mode="">
- </image>
- </view>
- </view>
- <template v-if="item.open">
- <view class="info-info">
- <view class="base-left">
- <view class="left-wrap" style="height: 267rpx;" v-for="itemt in item.time_slot">
- <view class="">
- {{itemt[0]}}
- </view>
- <view class="jg">
- </view>
- <view class="">
- {{itemt[1]}}
- </view>
- </view>
- </view>
- <view class="base-right">
- <view class="right-item" v-for="(clockitem,clockindex) in item.clock"
- :class="{err: clockitem.timeResult != 'Normal' && clockitem.timeResult != 'wks','hui': clockitem.timeResult== 'wks'}">
- <view class="item-tit">
- {{(clockindex%2 == 0) ? '上班':'下班'}}
- </view>
- <view class="" v-if="clockitem.timeResult != 'wks'">
- {{showDkTime(clockitem)}}
- </view>
- </view>
- </view>
- </view>
- </template>
- </template>
- </scroll-view>
- </view>
- </template>
- <script>
- import dkdetailVue from './dkdetail.vue';
- export default {
- data() {
- return {
- id: '',
- dk_detail: {},
- showdate: '',
- height: '',
- list: [
- ]
- }
- },
- onLoad(opt) {
- if (opt.type) {
- this.id = this.$store.state.userInfo.staffId
- console.log(this.$store.state.userInfo)
- this.getTime()
- } else {
- this.id = opt.id
- this.getTime()
- }
- },
- onShow() {},
- onReachBottom() {
- },
- onReady() {
- var obj = this;
- uni.getSystemInfo({
- success: resu => {
- const query = uni.createSelectorQuery();
- query.select('.yg-list').boundingClientRect();
- query.exec(function(res) {
- obj.height = resu.windowHeight - res[0].top + 'px';
- });
- },
- fail: res => {}
- });
- },
- methods: {
- showDkTime(item) {
- // Normal:正常
- // Early:早退
- // Late:迟到
- // SeriousLate:严重迟到
- // Absenteeism:旷工迟到
- //NotSigned : 未打卡
- let str = ''
- switch (item.timeResult) {
- case 'NotSigned':
- str = '缺卡'
- break;
- case 'Normal':
- str = '考勤机打卡(' + item.userCheckTime.split(' ')[1] + ')(正常打卡)'
- break;
- case 'Early':
- str = '考勤机打卡(' + item.userCheckTime.split(' ')[1] + ')(早退)'
- break;
- case 'Late':
- str = '考勤机打卡(' + item.userCheckTime.split(' ')[1] + ')(迟到)'
- break;
- case 'SeriousLate':
- str = '考勤机打卡(' + item.userCheckTime.split(' ')[1] + ')(严重迟到)'
- break;
- case 'Absenteeism':
- str = '考勤机打卡(' + item.userCheckTime.split(' ')[1] + ')(旷工迟到)'
- break;
- default:
- str = ''
- // break;
- }
- return str
- },
- openDetail(item) {
- item.open = !item.open
- },
- getTopDetail() {
- this.$u.api.ExaminationDetails({
- staffId: this.id,
- month: this.showdate //选择月份
- }).then(({
- data
- }) => {
- console.log(data,'打卡详情')
- this.dk_detail = data
- })
- },
- getBtmDetail() {
- this.$u.api.scheduling_details({
- month: this.showdate,
- staffId: this.id,
- }).then(({
- data
- }) => {
- this.list = []
- console.log('拿到打卡数据', data)
- this.list = data.reverse().map(item => {
- item.open = false
- let dk = item.time_slot.length
- let dkLength = dk * 2
- // 没有开始打卡
- if (item.status == 0) {
- try {
- // console.log(item.clock.length,'item.clock.length')
- if (item.clock) {
- if (item.clock.length < dkLength) {
- for (let i = 0; i < dkLength; i++) {
- console.log('进入到了这里')
- if (!item.clock[i]) {
- item.clock[i] = {
- baseCheckTime: "",
- userCheckTime: "",
- timeResult: "wks"
- }
- }
- console.log(item.clock, 'item.clock')
- }
- }
- } else {
- item.clock = []
- for (let i = 0; i < dkLength; i++) {
- item.clock[i] = {
- baseCheckTime: "",
- userCheckTime: "",
- timeResult: "wks"
- }
- }
- }
- } catch (e) {
- //TODO handle the exception
- console.log(e, '错误')
- }
- }
- // 打卡了但是异常
- if (item.status == -1) {
- // 一天全没打卡
- if (!item.clock) {
- item.clock = []
- for (let i = 0; i < dkLength; i++) {
- item.clock[i] = {
- baseCheckTime: "",
- userCheckTime: "",
- timeResult: "NotSigned"
- }
- }
- }
- // 打了但没打完
- if (item.clock.length < dkLength) {
- for (let i = 0; i < dkLength; i++) {
- if (!item.clock[i]) {
- item.clock[i] = {
- baseCheckTime: "",
- userCheckTime: "",
- timeResult: "NotSigned"
- }
- }
- }
- }
- }
- if (item.status == 1) {
- }
- return item
- })
- // console.log(res,'data')
- })
- },
- // 选择年月
- bindDateChange(e) {
- let time = e.detail.value.split('-')
- this.showdate = time[0] + '-' + time[1]
- this.getTopDetail()
- this.getBtmDetail()
- },
- // 获取当前年月
- getTime() {
- let date = new Date()
- let M = (date.getMonth() + 1) > 9 ? (date.getMonth() + 1) : ('0' + (date.getMonth() + 1))
- console.log(M)
- this.showdate = date.getFullYear() + '-' + M
- this.getTopDetail()
- this.getBtmDetail()
- },
- }
- }
- </script>
- <style lang="scss">
- .err {
- color: #E05742;
- }
- .hui {
- color: #aaa;
- }
- .select-top {
- width: 100%;
- height: 100rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- border: 1px solid #F5F5F5;
- font-size: 32rpx;
- font-weight: bold;
- color: #000000;
- padding: 0 30rpx;
- background-color: #fff;
- .top-right {
- font-size: 28rpx;
- font-weight: bold;
- color: #000000;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- image {
- width: 19rpx;
- height: 11rpx;
- }
- }
- }
- .dk-info {
- height: 326rpx;
- width: 100%;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- background-color: #fff;
- margin-bottom: 20rpx;
- .big {
- font-size: 46rpx !important;
- font-weight: 800;
- color: #000000;
- margin-bottom: 10rpx;
- }
- .dk-day,
- .dk-tit {
- display: flex;
- flex-direction: row;
- justify-content: center;
- width: 100%;
- font-size: 26rpx;
- .dk-left {
- width: 48%;
- text-align: right;
- }
- .dk-center {
- width: 4%;
- flex-shrink: 0;
- text-align: center;
- color: #D7D7D7;
- }
- .dk-right {
- width: 48%;
- }
- }
- .dk-detail {
- display: flex;
- justify-content: center;
- width: 100%;
- margin-top: 50rpx;
- .detail-item {
- width: 30%;
- text-align: center;
- font-size: 28rpx;
- font-weight: bold;
- color: #000000;
- .item-tit {
- margin-top: 15rpx;
- font-size: 24rpx;
- font-weight: 500;
- color: #666666;
- }
- }
- }
- }
- .yg-list {
- background-color: #fff;
- width: 100%;
- .yg-wrap {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 40rpx 0 30rpx;
- height: 100rpx;
- border-bottom: 1px solid #F2F2F2;
- font-size: 28rpx;
- font-weight: bold;
- color: #000000;
- .yg-name {}
- .dk-status {
- display: flex;
- align-items: center;
- image {
- width: 19rpx;
- height: 11rpx;
- margin-left: 10rpx;
- }
- }
- }
- }
- .info-info {
- width: 100%;
- // height: 267rpx;
- background-color: #f8f8f8;
- display: flex;
- .base-left {
- flex-shrink: 0;
- width: 180rpx;
- height: 100%;
- // height: 267rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- font-size: 30rpx;
- font-weight: 800;
- color: #000000;
- .left-wrap {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- }
- .jg {
- width: 5rpx;
- height: 75rpx;
- background: #ECECEC;
- margin: 20rpx 0;
- }
- }
- .base-right {
- flex-grow: 1;
- width: 100%;
- .right-wrap {
- // height: 135rpx;
- }
- .up {
- border-bottom: 1px solid #E4E4E4;
- }
- .right-item {
- // height: 50%;
- height: 135rpx;
- padding-top: 30rpx;
- font-size: 26rpx;
- font-weight: 500;
- border-bottom: 1px solid #E4E4E4;
- &:last-of-type {
- border-bottom: none;
- }
- .item-tit {
- font-size: 30rpx;
- font-weight: 800;
- }
- }
- }
- }
- .select-time {
- position: absolute;
- top: 30rpx;
- right: 30rpx;
- font-size: 28rpx;
- font-weight: 500;
- color: #000;
- display: flex;
- align-items: center;
- font-weight: bold;
- image {
- width: 17rpx;
- margin-left: 10rpx;
- }
- }
- </style>
|